Commit Graph

561 Commits

Author SHA1 Message Date
Maxime Coste
9edeb08e3a Avoid zero terminated string based console printing 2015-04-01 13:44:04 +01:00
Maxime Coste
758bfe7284 number to string conversion avoids memory allocations 2015-03-31 13:53:40 +01:00
Maxime Coste
6e1a388544 Replace various adhoc operator+ based formatting with format func 2015-03-30 23:06:02 +01:00
Maxime Coste
16037744b7 Add exception type name when failing with an uncaught exception 2015-03-25 13:42:36 +00:00
Maxime Coste
48007d5de2 Only do tty validation when using a NCursesUI 2015-03-24 19:38:03 +00:00
Maxime Coste
7eaa6976b9 Use a dummy UI when running tests, so that we do not need a tty 2015-03-24 13:14:02 +00:00
Maxime Coste
b5854ece43 Change ParameterParser switch interface, use an Optional<StringView>
Merge has_option and option_value into a single method get_switch.
2015-03-14 19:16:46 +00:00
Maxime Coste
65fd0df041 More code style cleanup 2015-03-14 17:30:44 +00:00
Maxime Coste
2747c4dd3e exception::what returns a StringView rather than a const char* 2015-03-13 13:15:51 +00:00
Maxime Coste
f2b8b1ae2b Fix compilation on clang 2015-03-12 13:04:53 +00:00
Maxime Coste
3c1a325b6f Refactor String, use a common StringOps interface, hide std::string 2015-03-10 19:50:22 +00:00
Maxime Coste
1cec8df45e ArrayView content is not const anymore
As in upcoming std c++ array_view, ArrayView<T> points to mutable
data, use ArrayView<const T> or alias ConstArrayView<T> for const
data.
2015-03-09 13:54:09 +00:00
Maxime Coste
0bbaef6e48 Use a sorted array for keymap rather than an unordered map
with ~100 entry, a binary search finds in < 7 step, unordered map
is overkill.
2015-03-08 11:40:50 +00:00
Maxime Coste
8df77121d7 Rename safe_ptr and ref_ptr to SafePtr and RefPtr 2015-02-19 13:58:25 +00:00
Maxime Coste
340fc63f84 Improve code compatibility 2015-02-02 18:46:55 +00:00
Maxime Coste
bb915f0bc5 Fix filename completion 2015-01-15 19:26:38 +00:00
Maxime Coste
76d806e98d Replace InternedStrings with SharedString, shared_ptr based 2015-01-15 19:26:38 +00:00
Maxime Coste
2a878d51fd Even more memory tracking 2015-01-14 19:16:32 +00:00
Maxime Coste
da562e03a0 replace all std::vector with Vector 2015-01-12 13:58:41 +00:00
Maxime Coste
0bdf1778cb Some more memory tracking 2015-01-12 13:32:14 +00:00
Maxime Coste
295a97f2a6 Rename memoryview to ArrayView 2015-01-06 13:43:37 +00:00
Maxime Coste
8cc96ec36b Add a join function for joining strings using a specific char 2014-12-28 11:16:51 +00:00
Maxime Coste
248c1bda02 Style tweak 2014-12-26 10:53:30 +00:00
Maxime Coste
2e1c6eaff7 sort includes 2014-12-24 13:03:17 +00:00
Maxime Coste
064fb81b8d Move containers utils to containers.hh and add filtered/transformed utils 2014-12-23 13:40:26 +00:00
Eike Plack
9f81093411 Expose buffer list to shell over $kak_buflist 2014-12-23 02:49:53 +01:00
Maxime Coste
1c8ee78d1a Do not register timers for transient input handlers 2014-12-18 23:12:58 +00:00
Maxime Coste
4827ae0a53 Do not wait for the first event before drawing clients 2014-12-18 19:01:18 +00:00
Maxime Coste
f32ab5793e Remove unneeded includes 2014-12-11 13:10:41 +00:00
Maxime Coste
0a57fa0766 Rename ncurses.{cc,hh} to ncurses_ui.{cc,hh} 2014-12-09 13:57:21 +00:00
Maxime Coste
87d312b6d4 More string cleanups 2014-12-08 13:59:29 +00:00
Maxime Coste
a3b3001d8f Rework client pending key handling, fix insert/normal timers 2014-11-29 20:14:52 +00:00
Maxime Coste
49931fbf05 Separate events between normal and urgent ones
Run urgent ones while executing %sh blocks.

Fixes #236
2014-11-25 13:52:06 +00:00
Maxime Coste
27b1e8944f const String& to StringView 2014-11-14 22:40:51 +00:00
Maxime Coste
fab9c92006 change filter mode to make backup of files to .kak-bak and edit in place
Add a -q option to filter mode to be quiet about errors while applying
keys.
2014-11-11 23:40:07 +00:00
Maxime Coste
b2407d9dfa Add ui_options option for UserInterface configuration
ui_options is a std::unordered_map<String, String> that gets
forwarded to the user interface. Add support ncurses_status_on_top.
2014-11-10 23:29:16 +00:00
Maxime Coste
80b50cd737 Simplify RemoteClient creation code 2014-11-05 13:57:12 +00:00
Maxime Coste
e38ba6ce3d Add scope class and encapsulate Options, Keymaps, Aliases and Hooks in it 2014-10-30 14:04:57 +00:00
Maxime Coste
8649371ff2 Add kak binary location to PATH env var automatically
That way the kak binary can be guaranteed to be available even
if not in user PATH.
2014-10-30 14:02:13 +00:00
Maxime Coste
185b980718 Add scoped aliases
aliases are now stored in window, buffer, or globally.
2014-10-30 14:02:13 +00:00
Maxime Coste
2944dbc332 Style fixes 2014-10-28 20:01:55 +00:00
Maxime Coste
54fd0aab22 Fix filter mode 2014-10-27 17:54:20 +00:00
Maxime Coste
992c74a06d small formatting tweak 2014-10-26 20:21:01 +00:00
Maxime Coste
1128d941ff Do not write pid and session name in debug buffer on startup 2014-10-14 13:42:47 +01:00
Maxime Coste
2adaa7bdfa Do not assert on SIGTERM and backup modified buffers on signal induced termination 2014-10-13 13:38:28 +01:00
Maxime Coste
d55d041c6a Add support for interned strings
Use interned strings for Modification contents and word database.
Interned strings are guaranteed not to move in memory and are
reference counted.
2014-10-01 00:20:12 +01:00
Maxime Coste
507cdd7272 Start with the whole buffer selected in filter mode 2014-09-28 23:58:34 +01:00
Maxime Coste
af1134bd75 Fix confusion between -n and -d switches in main 2014-09-18 18:43:42 +01:00
Maxime Coste
5c3f01fea2 Add exception reporting in filter mode 2014-08-17 15:19:04 +01:00
Maxime Coste
8d4531d419 Add support for reading from stdin/writing to stdout in filter mode
Note that kakoune still needs to read the whole buffer first, only
once stdin is closed can it execute the keys.
2014-08-15 13:21:54 +01:00
Maxime Coste
eff32aa1a1 Refactor, remove kakoune function and move it inside main. 2014-08-14 23:57:13 +01:00
Maxime Coste
ceb10665d1 Add support for running kakoune as a filter, using -f 'keys'
It will cycle on every given files, apply the keys and write to
<filename>.kak-out. Only normal/insert mode is available, kakrc
are not read.
2014-08-14 23:51:24 +01:00
Maxime Coste
0588780866 Refactor main loops, use separate functions for each running mode
Server, Client, and Pipe are handle through separate functions,
with the kakoune function handling parameter parsing.
2014-08-14 20:37:36 +01:00
Maxime Coste
2204b7cf06 Defer deletion of buffers to after the event loop
We can have SelectionList in flights on the buffer, so mark
it for deletion by moving it in a buffer trash, and effectively
delete it later, at a point where there should not be any further
access to it.
2014-08-12 19:24:09 +01:00
Maxime Coste
b96f653b6c Fix numbering with '#' register 2014-07-14 19:00:54 +01:00
Maxime Coste
a32b49acd1 Rename ColorPair to Face and ColorRegistry to FaceRegistry
Face also stores the attributes
2014-07-11 00:27:43 +01:00
Maxime Coste
7235180614 Use main selection index as default when accessing only one register value
Fixes #117
2014-06-21 11:31:08 +01:00
Maxime Coste
d33554a1cc Add support for long names for registers
We can now access register / with the name slash, * with star,
and | with pipe

Fixes #23
2014-06-06 00:49:36 +01:00
Maxime Coste
1498fa9e4a Add kak_selections_desc en vars, containing : separated descs
descs are now <line>.<column>+<len>
Fixes #144
2014-05-25 18:27:51 +01:00
Maxime Coste
f08966197e Change # register to contain selection number
Using <c-r># in insert will allow easy numbering
2014-05-23 20:27:35 +01:00
Maxime Coste
8356e44ad5 Improve error reporting when parsing commands
*debug* will contain line and column informations along
with the responsible command name.
2014-05-07 20:39:59 +01:00
Maxime Coste
c06f986a02 Add unistd.h to main, needed for dup 2014-04-30 19:08:06 +01:00
Maxime Coste
479c067a40 Add support for running Kakoune with redirected stdin
Will read to a *stdin* fifo buffer
2014-04-29 21:37:11 +01:00
Maxime Coste
7190791927 Move some buffer related utility functions to buffer_utils.{cc,hh} 2014-04-28 19:48:23 +01:00
Maxime Coste
7cdb94d5c7 Use StringView in shell manager 2014-04-21 00:26:20 +01:00
Maxime Coste
203a7732f5 Add support for querying client environement variables
At connection, a remote client sends all its environement to the
server, which then provides access to client env through
kak_client_env_VAR_NAME variables in the shell.
2014-04-07 23:47:51 +01:00
Maxime Coste
e1a9d5f71e Fix clang compilation 2014-04-02 22:33:52 +01:00
Maxime Coste
da9d099f3b Remove Range struct, merge it back in Selection 2014-03-29 08:55:45 +00:00
Maxime Coste
93ecc3efd6 style tweak 2014-03-22 21:00:24 +00:00
Maxime Coste
459cb212e5 Correctly handle failing to connect to the given session in client mode 2014-03-21 13:42:37 +00:00
Maxime Coste
11c62e583c Add -p <session> option to kak, which forward commands on stdin to session
This allows using directly the kak binary in place of socat for piping commands
to a foreing session.
2014-03-02 02:01:09 +00:00
Maxime Coste
486d1269e0 Consistently name -foo things 'switches' 2014-03-02 01:08:11 +00:00
Maxime Coste
9451782648 Add command switches information, and automatically display it 2014-03-02 01:08:11 +00:00
Maxime Coste
7f9f887b4a All commands now take directly a parameter parser
The command parameters description are now stored in a ParameterDesc
structure.
2014-03-02 01:08:11 +00:00
Maxime Coste
c49e79c9e8 Add buffile env var for getting the buffer filename 2014-02-27 06:44:22 +00:00
Maxime Coste
2159fc9563 Rename selections first,last to more explicit anchor,cursor 2014-01-28 19:06:52 +00:00
Maxime Coste
e364137196 Fix compilation with clang 3.4 2014-01-27 20:28:38 +00:00
Maxime Coste
a6d14cecbe Remove session socket on error signal 2014-01-27 19:53:17 +00:00
Maxime Coste
cccb07c7cd Catch parameter errors on startup and display option informations 2014-01-23 19:36:07 +00:00
Maxime Coste
219f4c9c19 minor code cleanup 2014-01-12 21:25:21 +00:00
Maxime Coste
fa72d27f9a Make kak more installable
* Kak relies on the kakrc file to be in ../share/kak/kakrc relative
to kak binary rather than in the same directory
* Added an install target to the Makefile
2013-12-23 21:36:05 +00:00
Maxime Coste
ea95632709 Move Editor::selections_content to Context 2013-12-15 20:37:07 +00:00
Maxime Coste
935bc3cec9 Add Context::selections method, and use it in priority to the Editor's one 2013-12-15 14:25:23 +00:00
Maxime Coste
6afef079b6 Remove Editor::main_selection(|index), directly use the SelectionList method 2013-12-14 14:38:17 +00:00
Maxime Coste
91cc8dd8bf Add cursor_char_column env variable 2013-12-11 13:46:33 +00:00
Maxime Coste
45d5dbcc85 Add support for defining and referencing highlighters
* defhl <name> defines a shared highlighter
* addhl -def-group <name> adds highlighters to the defined highlighter
* addhl ref <name> add the defined highlighter to the window's ones
2013-12-03 22:07:23 +00:00
Maxime Coste
a443ff7ea6 indent fixes 2013-12-03 19:49:09 +00:00
Maxime Coste
62137f364d tweak initial debug infos 2013-11-15 23:47:44 +00:00
Maxime Coste
f8cadc0c57 move Client::m_name to context, no more need for DraftUI 2013-11-14 20:51:25 +00:00
Maxime Coste
471aeaab9a remove filters, use hooks instead 2013-11-04 22:02:44 +00:00
Maxime Coste
dc1fbcdaa2 minor style fix 2013-10-26 19:23:00 +01:00
Maxime Coste
2c09da50be Add key mapping support 2013-10-25 00:30:46 +01:00
Maxime Coste
bc051c53af Cleanup dynamic registers init, and add # register for selection count 2013-10-01 19:52:19 +02:00
Maxime Coste
fb80ef092e clean up env var registration 2013-10-01 19:47:37 +02:00
Maxime Coste
3021c7f60a Remove $kak_socket replaced with $kak_session
use /tmp/kak-$kak_session to get the socket path
2013-09-25 19:04:52 +01:00
Maxime Coste
124be2ac2e extract client main to a run_client function 2013-09-23 20:28:15 +02:00
Maxime Coste
ce4ed44496 Add missing newlines to printed messages 2013-09-21 17:10:37 +02:00
Maxime Coste
b1d62a307d Add a -d command line option for running Kakoune as a headless server 2013-09-19 20:09:53 +01:00
Maxime Coste
415be1d2c7 Add a -s command line option for specifying session name 2013-09-19 19:54:14 +01:00
Maxime Coste
0b63074f90 extract main kakoune code to a kakoune function 2013-09-19 19:53:04 +01:00
Maxime Coste
fd021de7d7 use directly context.client() for getting the kak_client env var value 2013-09-12 23:49:08 +02:00
Maxime Coste
823812fd1a rename InputHandler to Client 2013-09-12 23:47:23 +02:00
Maxime Coste
ac7e437730 Move Client responsibilities to InputHandler
InputHandler owns it's UserInterface, and is directly stored by the ClientManager.
2013-09-12 23:39:34 +02:00
Maxime Coste
3150fe97cf selections env var is : separated, and : in selections are escaped 2013-08-28 18:52:29 +01:00
Maxime Coste
af8e8d27d4 Minor code cleanups 2013-07-28 16:40:02 +02:00
Maxime Coste
c1b2f7ef6a use C locale function instead of C++ ones 2013-07-02 19:48:04 +01:00
Maxime Coste
a3e032abd6 enable /proc/ method for runtime_directory with cygwin 2013-06-19 19:29:05 +01:00
Maxime Coste
4ef1bfa4db Use coord instead of iterators for selections 2013-06-04 14:21:07 +02:00
Maxime Coste
7f8d5c1fd0 Remove Range::content 2013-05-30 13:59:38 +02:00
Maxime Coste
93dd1ff3c7 Remove begin/end from Ranges, replace with min/max
Ranges should not be utf8 aware (needed for end), and a lot of
uses for end() were in fact looking for max.
2013-05-30 13:59:38 +02:00
Maxime Coste
26f0fd4cc6 Use more std::* for string handling 2013-05-13 18:43:38 +02:00
Maxime Coste
ba562367f0 catch errors when opening files given on command line 2013-04-29 13:50:13 +02:00
Maxime Coste
38bd8c243f add KakBegin and KakEnd hooks 2013-04-19 13:45:44 +02:00
Maxime Coste
5b61672948 add window_{width,height} env var 2013-04-18 14:28:53 +02:00
Maxime Coste
485a50bb4b handle client_removed exception out of ClientManager as well 2013-04-15 18:55:41 +02:00
Maxime Coste
da4be95c90 Handle SIGHUP gracefully 2013-04-15 18:50:45 +02:00
Maxime Coste
cc91a71a96 move Client as a public class instead of a ClientManager implementation detail 2013-04-15 14:28:21 +02:00
Maxime Coste
5653af15ed move normal mode implementation to normal.{cc,hh} 2013-04-12 14:28:13 +02:00
Maxime Coste
46deca4f3f Add zj and zk command for scrolling the window 2013-04-12 01:31:21 +02:00
Maxime Coste
e4d87ee1f1 hide ncurses.h include in ncurses.cc 2013-04-12 01:28:22 +02:00
Maxime Coste
99bb24dd09 add z prefixed 'window commands'
* zz or zc for centering selection on window (replaces alt-c)
* zt and zb for placing the main selection on top/bottom
2013-04-11 21:01:27 +02:00
Maxime Coste
35d0d5b2ea exceptions: use const char* what() instead of String description() 2013-04-11 13:57:35 +02:00
Maxime Coste
1398641d22 Add gt, gb and gc to goto the first/last/middle displayed line 2013-04-10 19:02:28 +02:00
Maxime Coste
270e950cf1 sort includes directives 2013-04-09 20:05:40 +02:00
Maxime Coste
5adee4a6a7 rename assert to kak_assert to avoid collisions 2013-04-09 20:04:11 +02:00
Maxime Coste
240e0321e8 ge goto end, last character of buffer 2013-04-09 19:32:44 +02:00
Maxime Coste
7f535988f0 gg is back to goto top 2013-04-09 19:32:26 +02:00
Maxime Coste
61293e8d60 use gk and gj for goto first/last line instead of gt and gb 2013-04-09 14:23:26 +02:00
Maxime Coste
43b5bd5260 add ga binding to go to last buffer 2013-04-09 14:22:21 +02:00
Maxime Coste
624c112d08 tweak prompt text 2013-04-06 15:43:33 +02:00
Maxime Coste
be9bfa479f use more explicit prompts for search and pipe, use color to validate 2013-04-06 13:02:16 +02:00
Maxime Coste
1ab8120147 refactor regex based selectors, move regex construction out of them 2013-04-05 19:28:08 +02:00
Maxime Coste
c53319ce5e refactor regex prompting commands 2013-04-05 18:29:05 +02:00
Maxime Coste
9bb9eda302 Dynamically change prompt color for regex prompt depending on regex validity 2013-04-04 19:09:34 +02:00
Maxime Coste
6e2fa38c15 InputHandler::prompt takes a color pair to use 2013-04-04 19:09:19 +02:00
Maxime Coste
f540566b1b UserInterface: status line messages are now DisplayLines
This add color support for the status line
2013-04-04 18:50:00 +02:00
Maxime Coste
4aa5a9a3f6 display a message in the status line when yanking 2013-04-03 19:18:17 +02:00
Maxime Coste
c6262fc5e1 use Y for concatenated yank 2013-04-03 19:14:38 +02:00
Maxime Coste
d56f6444b5 Add alt-[kK] for keeping only selections matching/not matching a given regex 2013-04-03 19:07:43 +02:00
Maxime Coste
0395f3b9fc fix compilation with clang++ 2013-04-03 18:51:40 +02:00
Maxime Coste
07f3bbe523 add alt-* for not smart set search pattern to selection 2013-04-02 18:46:33 +02:00
Maxime Coste
585e64fd10 add swap case support with the ~ key 2013-03-29 19:35:48 +01:00
Maxime Coste
1f4072dc72 use a scoped edition in Repeated so that repeated actions have a single undo group 2013-03-29 19:35:48 +01:00
Maxime Coste
ee0e640384 kak_bufname env var use display_name 2013-03-26 19:28:44 +01:00
Maxime Coste
14933bdeaf % register uses the buffer display name 2013-03-26 13:40:04 +01:00
Maxime Coste
07866e6ae9 show informations on uncaught std::exceptions 2013-03-22 14:29:22 +01:00
Maxime Coste
60599917cc add a kak_selections env var, which contains all selections separated by a comma 2013-03-21 19:10:18 +01:00
Maxime Coste
5fe7315df9 add 'r' object alias for [] (range) 2013-03-18 22:31:05 +01:00
Maxime Coste
354ae7ad89 Editor: keep selections sorted and use an index for the main one 2013-03-18 19:09:07 +01:00
Maxime Coste
a981d41cde Editor: replace selections().back() with main_selection() 2013-03-15 18:22:08 +01:00