Commit Graph

490 Commits

Author SHA1 Message Date
Maxime Coste
2a291e6868 add an eval command which send it's arguments to the command evaluator 2012-05-03 07:24:27 +00:00
Maxime Coste
b8fe942dbb Implement our own String class in preparation to encoding support. 2012-04-14 01:23:20 +00:00
Maxime Coste
9337938403 replace std::string references with String 2012-04-14 01:17:09 +00:00
Maxime Coste
af5c528f04 use std::upper_bound in DisplayBuffer::atom_containing to run in O(log n) 2012-04-05 02:00:34 +00:00
Maxime Coste
e4b872abd2 remove ModificationListener and use a list of iterators to update instead
This permits to fix a bug in BufferIterator::upgrade, replaced by
BufferIterator::on_insert and BufferIterator::on_erase. ModificationListener
was only used to updating iterators anyway.
2012-04-04 13:56:19 +00:00
Maxime Coste
6cedff8fb2 fix some corner cases in Buffer modification 2012-04-04 12:25:42 +00:00
Maxime Coste
46c65fea10 Option name completion support 2012-04-03 18:25:27 +00:00
Maxime Coste
1d106fd31e add set{g,global,b,buffer,w,window} command to allow changing options 2012-04-03 14:04:02 +00:00
Maxime Coste
873c853f7c gdb: do not catch throw, but break when constructing an assert_failed exception 2012-04-03 13:42:20 +00:00
Maxime Coste
f3dd65fbf1 add an OptionManager class and use it to manage tabstops
OptionManager map names to options, and may delegate option resolution
to it's parent if it does not contains the asked for option. That way
Buffers can override global options, and Windows can override Buffer
options.
2012-04-03 13:39:20 +00:00
Maxime Coste
c8447658c0 fix tab insertion 2012-04-03 13:38:01 +00:00
Maxime Coste
30bc1bad8f WindowHighlighterFactory class which passes the Window to the higlighter function 2012-04-03 13:22:07 +00:00
Maxime Coste
d1cc86d95d fix error message in HighlighterGroup 2012-04-03 13:08:13 +00:00
Maxime Coste
9444c84b1c rename HooksManager to HookManager 2012-04-03 12:01:01 +00:00
Maxime Coste
2cd318e50d fix BufferIterator::update when removing an end of line 2012-04-01 15:40:25 +00:00
Maxime Coste
7f425c4467 add an editor unit test 2012-04-01 15:39:53 +00:00
Maxime Coste
07e1fcf67b specialize BufferIterator::operator-- 2012-03-31 15:21:14 +00:00
Maxime Coste
45e362d213 specialize BufferIterator::operator++ to speed up Kakoune 2012-03-30 12:01:18 +00:00
Maxime Coste
2e7cd2233c add a Line::length method 2012-03-30 12:00:40 +00:00
Maxime Coste
0ba7c7286d Store buffer content in a list of lines
Instead of a big std::string, buffer now store it's content in a
list of lines. In order to achieve O(log(n)) random access, lines
contains both their content and their offset since the start of
the file, making binary search usable.

BufferIterator now have a LineAndColumn coordinate into the buffer
instead of an offset so that access is still O(1).
2012-03-30 11:37:18 +00:00
Maxime Coste
c336bf1365 set print pretty in gdbinit 2012-03-27 13:27:35 +00:00
Maxime Coste
f43d206e4e remove unused measure_string from window.cc 2012-03-26 23:13:09 +00:00
Maxime Coste
63d1c4471c catch throw in gdbinit 2012-03-26 14:23:27 +00:00
Maxime Coste
a555e28b4e add basic unit tests run at startup 2012-03-21 19:27:36 +00:00
Maxime Coste
0748aa042b add a COMMA macro for assert parameters 2012-03-25 20:15:54 +00:00
Maxime Coste
3dd96565b3 display modified buffers names when quit fails 2012-03-25 20:12:35 +00:00
Maxime Coste
792f0f7f2e BufferManager no longer owns buffers, only register them 2012-03-26 14:21:49 +00:00
Maxime Coste
3c798a4ee8 remove useless Window::cursor_{position,iterator} 2012-03-21 19:26:42 +00:00
Maxime Coste
60fb523d62 add some missing operators to LineAndColumn 2012-03-21 14:13:26 +00:00
Maxime Coste
3dd82a2b85 get rid of Buffer::at 2012-03-19 14:04:33 +00:00
Maxime Coste
a377ff79aa buffer style fix 2012-03-12 21:39:54 +00:00
Maxime Coste
3c105592e0 get rid of Buffer::compute_lines 2012-03-12 21:31:27 +00:00
Maxime Coste
97b8905a6d fix update_lines on empty buffer 2012-03-12 14:26:46 +00:00
Maxime Coste
cd615b35a2 generalize do_select_surrounding in do_select_object and add a whole word selector 2012-03-12 14:23:30 +00:00
Maxime Coste
df0f7b4689 rename BufferString to String 2012-03-08 21:23:29 +00:00
Maxime Coste
f2fd2b125a support read error in shell_eval 2012-03-08 21:15:37 +00:00
Maxime Coste
97648b1fda add some highlighting for git 2012-03-08 20:58:22 +00:00
Maxime Coste
c98657a512 fix some unitialized variable use (thanks valgrind) 2012-03-08 20:49:10 +00:00
Maxime Coste
8bc6ed6cbb add gdb pretty printers for kakoune data structures 2012-03-08 20:32:13 +00:00
Maxime Coste
782b557660 factor word and WORD selectors 2012-03-07 19:20:32 +00:00
Maxime Coste
7e01867d55 'I' now inserts before the first non blank character of the line instead of the first character of the line 2012-03-07 19:19:33 +00:00
Maxime Coste
c183acb800 use an Editor in write_debug 2012-03-06 23:12:48 +00:00
Maxime Coste
c99a6a3e4c fix last line handling in window display buffer 2012-03-06 14:27:49 +00:00
Maxime Coste
0ce3bc4621 simplify and optimize buffer line handling 2012-03-06 14:27:03 +00:00
Maxime Coste
0a385885ff correctly handle boost::regex_error in selectors 2012-03-04 20:11:22 +00:00
Maxime Coste
583de3ba6e do not take a std::string by value in runtime_error constructor 2012-03-04 20:10:09 +00:00
Maxime Coste
ded05bb5d3 NCurses: support default colors 2012-03-04 19:55:38 +00:00
Maxime Coste
d91ac911e7 fix complete_filename when directory does not exist 2012-03-04 19:43:47 +00:00
Maxime Coste
454258a495 fix shell_eval when no buffer in context 2012-03-04 19:42:31 +00:00
Maxime Coste
1f854bc0cc fix select_surrounding when selection is on the closing char 2012-02-29 14:27:25 +00:00
Maxime Coste
8275fe30f9 support appending with search 2012-02-28 20:50:47 +00:00
Maxime Coste
c4ad372d91 call compute_lines before hooks at Buffer construction 2012-02-28 14:23:52 +00:00
Maxime Coste
bc3d20bf2a document Selection class 2012-02-27 20:01:59 +00:00
Maxime Coste
5bddd166f1 fix Buffer::line_length for last line 2012-02-27 19:52:36 +00:00
Maxime Coste
c03506ca04 save and restore " and / registers in exec_keys 2012-02-27 19:51:30 +00:00
Maxime Coste
13d74414e1 fix exec_commands_in_file parsing of [\'"`] strings 2012-02-27 14:25:07 +00:00
Maxime Coste
b6b66aecc9 fix number_lines line count computing 2012-02-27 14:24:14 +00:00
Maxime Coste
7f175da3fd Selection: handle last buffer character deleted case 2012-02-22 22:03:11 +00:00
Maxime Coste
416a1805b3 Fix last line handling in buffer 2012-02-22 22:02:43 +00:00
Maxime Coste
a386315bde Buffer: optimize line updating when applying a modification 2012-02-22 21:54:25 +00:00
Maxime Coste
030450838a fix Buffer::line_length for last line 2012-02-22 21:49:00 +00:00
Maxime Coste
275c0c67d4 Final attribute support for DisplayAtom
When DisplayAtoms have the Final attributes, highlighters
may not modify them anymore.
2012-02-22 21:48:14 +00:00
Maxime Coste
aeac9484b0 compute the number of digits needed in number_lines highlighter 2012-02-22 20:43:59 +00:00
Maxime Coste
46c614c4a2 fix skip_while 2012-02-16 14:28:22 +00:00
Maxime Coste
7026693ecd move ncurses function to ncurses.{cc,hh} 2012-02-16 14:25:16 +00:00
Maxime Coste
d548037922 tweak kakrc highlighting 2012-02-16 14:04:19 +00:00
Maxime Coste
6aacebd2e0 Add an echo command which print it's params in the status line 2012-02-15 14:24:52 +00:00
Maxime Coste
91f2292ec5 Support shell expansion in place of command name in command manager 2012-02-15 14:19:57 +00:00
Maxime Coste
e9af61eb9f def command takes an optional argument for parameter policy
-env-params puts parameters in kak_param{0..9}
-append-params appends parameters to the ones defined in the command
2012-02-15 13:58:08 +00:00
Maxime Coste
03976e0a01 edit command supports optional line and column parameter 2012-02-13 21:54:30 +00:00
Maxime Coste
3019ce3d3c edit command switch to the given buffer if it is already opened
use edit! (or e!) to force reloading of the buffer
2012-02-13 21:48:16 +00:00
Maxime Coste
38d921f3d2 add alt command which alternate between c/cpp and h/hpp file 2012-02-13 21:43:22 +00:00
Maxime Coste
3273551665 add 'def' command to define new user commands 2012-02-13 21:40:09 +00:00
Maxime Coste
5f86941b8f support multiline strings when executing file commands 2012-02-13 21:39:41 +00:00
Maxime Coste
2c8a6ca56a Support shell commands expansion in CommandManager 2012-02-13 21:38:07 +00:00
Maxime Coste
b49279503b fix include in context.hh 2012-02-13 21:32:54 +00:00
Maxime Coste
f541a639f2 support memoryview construction from iterators 2012-02-13 14:14:26 +00:00
Maxime Coste
9304e41326 support register access through ctrl-r in ncurses_prompt 2012-02-13 13:37:41 +00:00
Maxime Coste
333b470dd2 giving a count to paste selects which selections yank buffer to use
3p will paste using the yank buffer of the third selection instead
of each selection using it's own.
2012-02-10 14:00:21 +00:00
Maxime Coste
0352ad7983 Editor: replace all captures if one capture is present
before, selecting with 2 captures after selecting with 3 captures
would keep the third capture from the first selection.
2012-02-10 13:58:29 +00:00
Maxime Coste
d84d085cc2 Merge captures into registers, implements register insertion 2012-02-09 23:47:55 +00:00
Maxime Coste
04a37d8895 Editor refactoring, merge undo and batch management 2012-02-07 23:41:10 +00:00
Maxime Coste
333e87dedd add a Register class, registers can now contain a list of string
That way, registers can be used to store per selection data
2012-02-07 23:01:02 +00:00
Maxime Coste
9b5e9ffee2 selectors now take a Selection as parameter instead of a BufferIterator 2012-02-07 14:26:51 +00:00
Maxime Coste
1e5d930f35 extract exec_keys function from exec_string 2012-02-07 13:35:41 +00:00
Maxime Coste
0483e951ad use memoryview instead of std::vector where applicable 2012-02-03 19:14:35 +00:00
Maxime Coste
ac02ccb53d add a memoryview class
memoryview is a non owning typed view over a memory range, usefull
to pass arrays as parameters without data copying.
2012-02-03 19:13:02 +00:00
Maxime Coste
96b167859a batches support in Editor, used by IncrementalInserter and exec_string
Editor groups all modification together in one undo group when batching.
nested batches are supported.
2012-02-03 13:55:22 +00:00
Maxime Coste
96101b4392 Use an Editor instead of a Window as much as possible 2012-02-02 20:48:03 +00:00
Maxime Coste
69d96c90da extract an Editor class from Window and refactor 2012-01-31 19:12:06 +00:00
Maxime Coste
d23a175533 insert include guards in C++ header files at creation 2012-01-31 14:07:41 +00:00
Maxime Coste
a783d06bf1 tweak c++ highlighting 2012-01-31 14:03:51 +00:00
Maxime Coste
3ef9895a97 Buffer: support creation of temporary windows to apply commands when no windows are in context 2012-01-31 14:03:10 +00:00
Maxime Coste
830d96f7a1 Buffer: add NewFile buffer type for buffer with an non existing yet file 2012-01-31 14:01:48 +00:00
Maxime Coste
959ec46a16 Context: add methods bool has_{buffer,window) 2012-01-31 13:38:06 +00:00
Maxime Coste
6579b43ffb make parse_keys handle <c-*> and <a-*> keys. 2012-01-29 22:49:14 +00:00
Maxime Coste
73a8950e73 File: parse_filename function which handle ~ and environment variable in filenames 2012-01-29 22:24:43 +00:00
Maxime Coste
589b8e68bb history support in prompt 2012-01-25 22:32:17 +00:00
Maxime Coste
14d17a4493 add a find(container, value) utility function 2012-01-25 22:31:47 +00:00
Maxime Coste
6411193f10 SelectionHighlighter: reverse color of the last char of each selection
the terminal cursor is now longer shown
2012-01-25 20:22:33 +00:00
Maxime Coste
0e805238b5 tweak cpp highlighting 2012-01-25 19:35:53 +00:00
Maxime Coste
a72d185f79 remove DynamicBufferIterator and make Selection a ModificationListener
DynamicBufferIterator is only used by Selections. And each selection
had two iterators, resulting in two ModificationListeners registered
in the buffer instead of one now.
2012-01-25 19:32:06 +00:00
Maxime Coste
382d5a334c do not use a DynamicBufferIterator in IncrementalInserter::IncrementalInserter 2012-01-25 18:59:11 +00:00
Maxime Coste
c837336474 optimize SelectionHighlighters, stop copying Selections 2012-01-25 18:51:47 +00:00
Maxime Coste
d1c29d2b78 moving no longer clears multiple selections 2012-01-25 14:23:02 +00:00
Maxime Coste
81138b224f fix line break support in insert_char 2012-01-24 23:19:26 +00:00
Maxime Coste
381d884c16 use a settable get_key function to be able to override key reading 2012-01-24 23:18:59 +00:00
Maxime Coste
e0b216d576 HooksManager: do not propagate hooks runtime exception 2012-01-24 23:17:26 +00:00
Maxime Coste
1fd8ec8bfd support Ctrl-R <reg> when inserting to insert a register 2012-01-24 19:08:57 +00:00
Maxime Coste
a62d56064f replace ncurses getch calls with a get_key method 2012-01-23 14:17:31 +00:00
Maxime Coste
950a734ce5 adapt rc files to the new hook command 2012-01-23 14:00:33 +00:00
Maxime Coste
a1ff9999f5 the hook command takes a first parameter to specify the hook owner
currently 'global' and 'window' are accepted owners. 'window' will
add the hook to the current context window.
2012-01-23 13:58:43 +00:00
Maxime Coste
c38f244c06 Window have it's own hooks manager 2012-01-23 13:57:24 +00:00
Maxime Coste
945ad361fb HooksManager: forward declare Context instead of including context.hh 2012-01-23 13:56:43 +00:00
Maxime Coste
db9040e29e HooksManager: extract the Singleton version as GlobalHooksManager 2012-01-23 13:40:42 +00:00
Maxime Coste
73ae3d292f implement finding kak executable path on MacOS 2012-01-20 21:12:57 +00:00
Maxime Coste
bb36271ae5 HighlighterGroup: use idvaluemap::complete_id_if in complete_group_id 2012-01-19 20:53:15 +00:00
Maxime Coste
ce6b4c2cc4 idvaluemap: complete_id_if method for conditional id completion 2012-01-19 20:52:08 +00:00
Maxime Coste
2824bd9a46 HighlighterGroup: move to it's own file, Window uses them directly 2012-01-19 20:37:29 +00:00
Maxime Coste
541872cafa completion support for addgrouphl and rmgrouphl 2012-01-18 11:33:58 +00:00
Maxime Coste
cffdbcb689 replace addhl -group with addgrouphl command, and add rmgrouphl 2012-01-18 00:15:10 +00:00
Maxime Coste
ae8882b0de Context: do not permit access to window or buffer if null 2012-01-15 21:33:35 +00:00
Maxime Coste
a6930395b8 tweak kakrc files highlighting 2012-01-15 17:50:46 +00:00
Maxime Coste
c1f625054a split kakrc with filetype specific files in rc/
cpp highlighting is now specified by rc/cpp.kak.
2012-01-15 17:35:25 +00:00
Maxime Coste
c62b3b251d add a runtime command to execute files in the runtime directory 2012-01-15 17:34:05 +00:00
Maxime Coste
f99c3a1a6a kakrc: use a hlkakrc highlighter group for kakrc highlighting regex 2012-01-15 13:48:48 +00:00
Maxime Coste
f3e8498a58 addhl supports a -group option
-group <group_id> can be used to add the highlighter in a
highlighter group which will be then handled as a whole.
2012-01-15 13:47:12 +00:00
Maxime Coste
98f937146a HighlighterRegistry: add add_highlighter_to_group method 2012-01-15 13:46:45 +00:00
Maxime Coste
2cfa70a466 Window: add get_highlighter_group method 2012-01-15 13:46:12 +00:00
Maxime Coste
0c1e763d66 Highlighters: add an HighlighterGroup class 2012-01-15 13:45:18 +00:00
Maxime Coste
5092456186 Highlighters: move HighlighterParameters definition from highlighter_registry.hh to highlighter.hh 2012-01-15 13:44:16 +00:00
Maxime Coste
7599edffa9 idvaluemap: add missing includes 2012-01-15 13:40:58 +00:00
Maxime Coste
0234378bcf kakrc: refactor using lists of commands for hooks 2012-01-15 03:04:37 +00:00
Maxime Coste
f259af9326 CommandManager: add flags support and IgnoreSemiColons flag
commands are now registred with flags, and the IgnoreSemiColons
flag permit to specify a command which needs all the parameters
on the line, bypassing the command sequence operator ';'.

the hook command is tagged as such.
2012-01-15 03:02:08 +00:00
Maxime Coste
be5cf92367 Completion: sort results in complete_filename 2012-01-15 02:02:18 +00:00
Maxime Coste
f673f3c334 Completion: handle hidden files in complete_filenam 2012-01-15 02:01:58 +00:00
Maxime Coste
49ea6f7103 correctly clear the window status line 2012-01-15 01:45:23 +00:00
Maxime Coste
4a5758ebb3 CommandManager: support ';' as a command separator 2012-01-15 01:37:35 +00:00
Maxime Coste
272f2d87a1 Highlighters: tweak colorize_cplusplus 2012-01-14 14:12:20 +00:00
Maxime Coste
95db828e17 CommandManager: use directly first command parameter as the command name 2012-01-14 14:02:54 +00:00
Maxime Coste
66d91b8828 support '\' as a line continuation marker when executing commands in file 2012-01-14 13:50:45 +00:00
Maxime Coste
fea81e1378 kakrc: add support for kakrc file highlighting 2012-01-14 01:04:08 +00:00
Maxime Coste
50ce3d1549 Document some Kakoune concepts, as Window, Buffer, DisplayAtom... 2012-01-11 14:21:58 +00:00
Maxime Coste
9557167f26 <space> with a count argument replaces current selections with the counth selection. 2012-01-09 14:28:01 +00:00
Maxime Coste
e02cb4e5bd Selectors: select_next_match starts from cursor+1
so searching effectively starts on the character after current
selection end. Which makes repeating 'n' on a one character match
work.
2012-01-09 14:22:52 +00:00
Maxime Coste
8b1b1d9cd8 Selectors: add select_surrounding to select blocks
Alt-a followed by []()<>{}bB selects the block surrounding current
selection end.

Alt-i is similar but selects only the inside of the block.
2012-01-04 14:18:08 +00:00
Maxime Coste
e59bdd931e search for kakrc next to the kak executable instead of in the current directory 2011-12-28 22:57:48 +00:00
Maxime Coste
4de41197c0 Add a | key that pipes each selection through an external filter 2011-12-28 19:04:06 +00:00
Maxime Coste
c9ac4d615d Highlighters: tweak colorize_cplusplus 2011-12-28 18:52:35 +00:00
Maxime Coste
0e398566d2 Buffer: fix compute_lines on empty_buffer 2011-12-28 18:52:14 +00:00