Commit Graph

1655 Commits

Author SHA1 Message Date
Maxime Coste
02b7786bcd fix complete_filename 2012-08-07 00:16:51 +02:00
Maxime Coste
b69134c36f new regex highlighter parameters syntax, support per capture highlight 2012-08-07 00:13:54 +02:00
Maxime Coste
a38a9c3bf2 Commands take a mutable context, main_context is gone ! 2012-08-06 22:02:11 +02:00
Maxime Coste
a712dd5bbe Completions functions take a Context parameter 2012-08-06 21:37:43 +02:00
Maxime Coste
39797f87dc command_manager: cleanup command execution, lazy exec shell commands 2012-08-06 19:29:51 +02:00
Maxime Coste
4dc9973288 Registers need a context to return their values 2012-08-05 20:13:41 +02:00
Maxime Coste
18ca422306 Context: only buffer context are not allowed, an editor is always needed 2012-08-05 20:12:43 +02:00
Maxime Coste
1ce2d3e302 cleanup keymap definition 2012-08-05 19:53:39 +02:00
Maxime Coste
0164d78c10 Use a context as parameter to keymap functions 2012-08-05 19:39:37 +02:00
Maxime Coste
12e2ce0f3c Context: store an editor instead of a window 2012-08-05 18:23:37 +02:00
Maxime Coste
2cc01d3407 move SafeCountable functionality to Editor from Window 2012-08-05 18:23:09 +02:00
Maxime Coste
d91070f5b7 Context: add a numeric_param property 2012-08-05 16:46:10 +02:00
Maxime Coste
9fcb89c8fc Window: tolerate invisible cursor when it is the end of the buffer 2012-08-02 07:04:42 +02:00
Maxime Coste
23f72851e4 Buffer: fix insert at end of buffer 2012-08-02 07:04:04 +02:00
Maxime Coste
407782a742 command_manager.cc: use anonymous namespace 2012-08-02 06:41:55 +02:00
Maxime Coste
2d2ac98511 fix global.kak, eval command no longer exists 2012-08-02 06:41:08 +02:00
Maxime Coste
2071db3558 Tokens are CommandManager implementation details
CommandParameters go back to memoryview<String>
2012-08-01 14:27:34 +02:00
Maxime Coste
36070dd429 CommandManager: rework command parser
a new type of strings is supported inspired by the ruby strings.
%<delimiter>content<delimiter>, if opening delimiter is one of
([{<, then closing delimiter is the matching )]}> and balanced
delimiters in the string needs not to be escaped, else the closing
delimiter is the same as the opening one.

shell expansion is available through %sh<delimiter>command<delimiter>
syntax.

Command flags have been removed, as these strings provide proper nesting
support, so now, you can for example do:

def command %{ echo %sh{ ls } }
2012-07-31 14:22:57 +02:00
Maxime Coste
ac2676cbcf ShellManager: catch all exception once we are in child process 2012-07-31 14:21:25 +02:00
Maxime Coste
b65f8cc887 CommandParameters is a list of Tokens instead of Strings
CommandManager string parsing is less ad-hoc.
2012-07-31 00:06:50 +02:00
Maxime Coste
a3cb9bfc5e editor.cc: remove unused id_not_unique 2012-07-30 13:39:38 +02:00
Maxime Coste
6bd67c01cc refactor insertion and insertion replay functions 2012-07-27 10:22:33 +02:00
Maxime Coste
0e9b0c8b3a insert_char: remove 'ctrl-r %' handling, already provided by dynamic register 2012-07-25 14:29:51 +02:00
Maxime Coste
af203b2b94 diff.kak: recognize patch files 2012-07-25 14:14:25 +02:00
Maxime Coste
6fc0432e9f add inline keyword in cpp highlighting 2012-07-20 13:36:06 +02:00
Maxime Coste
435797e34f global: quote tag pattern 2012-07-18 19:03:20 +02:00
Maxime Coste
399b9b6235 optimize regex highlighter's regex 2012-07-18 19:02:41 +02:00
Maxime Coste
4908b2c3ef Fix end_it computation in Buffer::insert, avoid clamping in iterator_at 2012-07-18 14:12:41 +02:00
Maxime Coste
c915e18950 Move selection to last modification position in editor::{undo,redo} 2012-07-16 21:53:00 +02:00
Maxime Coste
31c0931dff Go back to a generic BufferChangeListener interface for selection update 2012-07-16 21:51:37 +02:00
Maxime Coste
fe988868e5 IncrementalInserter preserves selections 2012-07-16 21:21:56 +02:00
Maxime Coste
5a671db12c Correct multi select unit test 2012-07-16 21:14:52 +02:00
Maxime Coste
1d5180e782 Window: handle horizontal scrolling correctly
Window::scroll_to_keep_cursor_visible_ifn now highlights the cursor
line in order to find its real display position (for example if the
number_lines highlighter is present it may modify the position).
2012-07-15 01:48:50 +02:00
Maxime Coste
6e072d1a61 ncurses: fix first ~ line drawing 2012-07-12 23:59:02 +02:00
Maxime Coste
03d8efc249 DisplayBuffer: add range and compute_range methods 2012-07-12 23:51:13 +02:00
Maxime Coste
b1a087485c DisplayBuffer rewrite, a DisplayBuffer is now a list of DisplayLines
Code is now greatly simplified using this architecture, and
DisplayAtoms no longer know their DisplayCoords and can be in any
order.
2012-07-12 23:19:10 +02:00
Maxime Coste
2830825c56 BufferIterator: allow invalid iterator in operator= 2012-07-12 23:11:16 +02:00
Maxime Coste
71fcc123bc Window: remove iterator_at and line_and_column_at methods 2012-07-12 14:28:58 +02:00
Maxime Coste
06dd3f8aad Add Editor::replace(memoryview) and bind alt-P to replace paste 2012-07-11 14:15:27 +02:00
Maxime Coste
5cbded8221 make display buffers and highlighters handle better longer than display lines
still work in progress, I think the whole display system will in fact need
a rewrite.
2012-07-03 23:23:07 +02:00
Maxime Coste
d092afead9 make DisplayBuffer::atom_containing easier to understand 2012-07-03 21:12:05 +02:00
Maxime Coste
d7e1cab116 DisplayAtom: support empty replacement 2012-07-03 19:13:16 +02:00
Maxime Coste
603cfd3108 do not catch exception in commands, let them propagate 2012-06-30 00:44:14 +02:00
Maxime Coste
f11d44246c add safe_ptr::operator=(safe_ptr&&) and safe_ptr::reset(T*) 2012-06-30 00:33:36 +02:00
Maxime Coste
dfbda951d3 support static and dynamic registers, add '%' (filename) and '.' (selection) registers 2012-06-29 18:37:17 +02:00
Maxime Coste
5b2ef1da6a IncrementalInsertor::insert takes a memoryview<String> rather than a Register 2012-06-29 18:35:48 +02:00
Maxime Coste
7aa533c049 simplify Register interface 2012-06-29 13:25:34 +02:00
Maxime Coste
49e1d91804 Buffer: pass by value instead of by reference when object will be copied anyway
Let copy elision and move semantics kick in
2012-06-29 13:19:29 +02:00
Maxime Coste
36e4dacdf5 Fix BufferIterator::on_erase and tweak Buffer 2012-06-28 14:26:01 +02:00
Maxime Coste
9b6b6b6b17 Rename UI to Client 2012-06-28 14:11:43 +02:00
Maxime Coste
286462a2f6 Add Context::option_manager()
it returns the more specific option manager available
(window -> buffer -> global)
2012-06-28 14:01:37 +02:00
Maxime Coste
9c78453cb7 Context references buffer and window with a safe_ptr 2012-06-28 13:46:14 +02:00
Maxime Coste
4dfc910195 BufferManager use safe_ptr to reference the Buffers 2012-06-28 13:45:42 +02:00
Maxime Coste
1289268174 Add SafeCountable and safe_ptr classes
safe_ptr is a smart pointer which manage a safe count in pointed
objects. SafeCountable provides the interface needed for safe_ptr
and assert the safe count is zero in destructor.

This permits to have pointers that guarantees their pointed object is
alive.
2012-06-28 13:42:55 +02:00
Maxime Coste
e7e9b8a6cd add rc/diff.kak and load in kakrc 2012-06-27 14:29:12 +02:00
Maxime Coste
70bd18e1f2 add kak_opt_.* environement variable retriever to access options from shell. 2012-06-27 14:28:43 +02:00
Maxime Coste
ecb3a737a9 Tweak String class, and cleanup usages
remove String::clear, add operator=(String&&) add str_to_int(const String&)
to replace atoi.
2012-06-27 14:26:29 +02:00
Maxime Coste
7fb49b183e ShellManager environment variable use a regex instead of an exact match
when a kakoune releated env var used in a shell command, the ShellManager
tries to match it with given regex and the first that matches calls its
value retriever.

For this to be useful, EnvVarRetrievers now also take the variable
name in its parameters.
2012-06-25 19:40:18 +02:00
Maxime Coste
cffb895797 remove ugly id_to_str param in idvaluemap and str_to_str 2012-06-25 19:11:13 +02:00
Maxime Coste
ccec35f88c code cleanups in buffer 2012-06-25 19:05:32 +02:00
Maxime Coste
d1c4a655b9 git.kak: use filetype option 2012-06-15 14:24:57 +02:00
Maxime Coste
11e8d07797 cleanup kakrc.kak 2012-06-14 21:52:47 +00:00
Maxime Coste
c8fdbc2a60 support buffer as a hook target 2012-06-14 20:51:01 +00:00
Maxime Coste
0e8add34ae delete buffer deletes the current buffer when no params given 2012-06-14 18:05:42 +00:00
Maxime Coste
eb34f6db73 execute BufClose hook in Buffer destructor 2012-06-14 17:44:28 +00:00
Maxime Coste
fd8517f91e fix some warnings detected with clang 2012-06-05 13:33:02 +00:00
Maxime Coste
5936aa6710 rework cpp.kak and kakrc.kak to use the filetype option 2012-06-14 13:21:22 +00:00
Maxime Coste
dc91f344f7 Reorder managers creation in main 2012-06-14 13:20:40 +00:00
Maxime Coste
f7ee2801e9 Windows call the WinSetOption hook when an option changes 2012-06-14 13:19:38 +00:00
Maxime Coste
a943e08dc7 Refactor OptionManager, add OptionManagerWatcher
- use set_option to set an option, instead of operator[] (no-const)
- keeps a list of OptionManagerWatcher to notify when an option change
  it also notifies when an option changes in his parent and the option
  is not overridden.
2012-06-14 13:16:44 +00:00
Maxime Coste
109c11f29c BufferManager deletes remaining buffers in his destructor 2012-06-14 13:15:30 +00:00
Maxime Coste
cab03ef1c6 When creating an Option, OptionManager takes it's initial value from it's parent if possible 2012-06-12 18:28:25 +00:00
Maxime Coste
bc359d7c90 BufCreate hook is always called for every buffer, BufNew is called when creating a new file 2012-06-12 18:27:57 +00:00
Maxime Coste
20315eac85 replace Option::operator {String,int} with Option::as_{string,int} 2012-06-12 18:26:20 +00:00
Maxime Coste
c0987ebacc Add a FilterGroup, and cleanup HighlighterGroup
FilterGroup is similar to HighlighterGroup, it permits grouping
together filters for easy removal.
2012-06-12 18:24:29 +00:00
Maxime Coste
5710893dd5 Cleanup utils.hh, remove auto_raii in favor of on_scope_end 2012-06-12 18:45:13 +00:00
Maxime Coste
e36b3565bf call SetOption hook when setting an option 2012-06-12 13:10:52 +00:00
Maxime Coste
67c6b6834e execute kakrc after creating an UI 2012-06-12 13:10:33 +00:00
Maxime Coste
9bcfda3226 HookManager are now hierarchical from window to buffer to global
window hooks also executes buffer hook which also execute global hooks
2012-06-07 13:29:44 +00:00
Maxime Coste
6a416abae2 abstract ui functions in a UI base class 2012-06-05 23:15:19 +00:00
Maxime Coste
02051bb067 fix runtime directory detection on MacOS 2012-06-05 14:23:47 +00:00
Maxime Coste
61bd77d529 fix compilation on MacOS 2012-06-05 13:31:14 +00:00
Maxime Coste
546a999416 global: select the tag, fail nicely 2012-06-04 14:27:56 +00:00
Maxime Coste
419d5691a1 add a try command
use try <commands...> catch <failure_commands...>
2012-06-04 14:27:34 +00:00
Maxime Coste
310bc42d54 tweak cpp highlighting 2012-06-04 14:14:01 +00:00
Maxime Coste
a7c33207d6 check if no modification were made in Buffer::end_undo_group 2012-06-04 14:12:37 +00:00
Maxime Coste
589aad5f9c sort command names completion candidates 2012-06-02 15:49:56 +00:00
Maxime Coste
f972428823 The def command do not override commands by default, use -allow-override 2012-06-02 15:49:35 +00:00
Maxime Coste
942e63d836 correctly implement std::hash<String> 2012-05-30 14:20:21 +02:00
Maxime Coste
d7c917c96e include <unistd.h> in order to get read and write 2012-05-30 14:19:53 +02:00
Maxime Coste
6792696ba2 enable global and line numbering in kakrc 2012-05-29 11:35:30 +00:00
Maxime Coste
2c4bc5582a Alt-Space permits to remove a selection by index 2012-05-29 11:15:43 +00:00
Maxime Coste
3bfd774f49 Restore piping support.
Add a ShellManager::pipe method, which pipes a string into the
command. Not quite satisfied with this interface.
2012-05-29 10:39:03 +00:00
Maxime Coste
84c1cad3d5 tweak cpp highlighting 2012-05-29 09:23:53 +00:00
Maxime Coste
c7ad724aec global.kak: support tag name completion 2012-05-29 05:23:36 +00:00
Maxime Coste
02c89022e4 Correctly set env vars in define_command 2012-05-29 05:43:09 +00:00
Maxime Coste
d599542473 Support -shell-completion option in the def command
-shell-completion takes some shell code as parameter which
should returns a newline separated list of completion candidates.
2012-05-29 05:22:18 +00:00
Maxime Coste
62202a46c1 Add some string helpers and unit tests
functions int_to_str(int) and split(const String&, Character),
plus corresponding unit tests
2012-05-29 05:19:50 +00:00
Maxime Coste
96c440fcaa CommandManager::execute can take an optional EnvVarMap argument which is used for shell evaluation 2012-05-29 05:42:26 +00:00
Maxime Coste
8fedbbf07b ShellManager::eval now takes an additional env_var map 2012-05-29 05:19:27 +00:00
Maxime Coste
e57ddd3bab Factorize some duplicated completer code in register_commands 2012-05-29 03:34:54 +00:00
Maxime Coste
30d9e10ac6 DisplayBuffer optimization, suppressed some paranoid checks 2012-05-29 00:33:55 +00:00
Maxime Coste
6fa40796e7 Fix Window::scroll_to_keep_cursor_visible_ifn 2012-05-29 00:14:05 +00:00
Maxime Coste
7451423ce3 global.kak: the 'tag' command uses 'menu -auto-single' 2012-05-28 23:52:26 +00:00
Maxime Coste
1257d432b4 the 'menu' commands now takes an optional -auto-single option
-auto-single tell the 'menu' command not to prompt when there
is only a single choice, and to automatically execute it's
command.
2012-05-28 23:50:11 +00:00
Maxime Coste
d96427b831 Add a delbuf (db) command which delete an existing buffer 2012-05-28 22:51:12 +00:00
Maxime Coste
393b9b24e2 Unify command parameter parsing with a ParametersParser class 2012-05-25 05:07:37 +00:00
Maxime Coste
05442857e6 add rc/global.kak file which provides the tag command using GNU GLOBAL 2012-05-18 05:23:02 +00:00
Maxime Coste
5f2471c147 add an initial menu command, which presents several choices to users
usage is "menu 'label1' 'command1' 'label2' 'command2' ..."
2012-05-18 05:20:46 +00:00
Maxime Coste
56efb42962 add a selection environement variable to access the last selection content 2012-05-07 06:56:53 +00:00
Maxime Coste
ff86d9781d move commands to commands.{cc,hh} 2012-05-07 03:13:34 +00:00
Maxime Coste
dd7228b098 fix DisplayBuffer::atom_containing when where is before first atom 2012-05-04 06:39:03 +00:00
Maxime Coste
55516af9d7 remove {add,rm}grouphl, go back to a -group arg in {add,rm}hl
more consistency, more shared code
2012-05-04 04:25:09 +00:00
Maxime Coste
7158aa00b7 use ShellManager in do_pipe 2012-05-03 07:33:13 +00:00
Maxime Coste
0c596a9d64 Add a ShellManager which handles executing shell commands
ShellManager provides shell commands with environement variable
to retrieve some internal values in the shell parameters.
2012-05-03 07:25:13 +00:00
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
Maxime Coste
aa1c4d64f9 Completions: complete_filename correctly support directories 2011-12-22 13:44:04 +00:00
Maxime Coste
6fa5d809ef whitespace fix 2011-12-22 13:33:29 +00:00
Maxime Coste
67c08e598b IncrementalInserter: preserve selection through hook call 2011-12-21 19:06:51 +00:00
Maxime Coste
f77fc3980b Window: store a stack of selections 2011-12-21 19:06:26 +00:00
Maxime Coste
c11b548662 kakrc: cleanup trailing whitespaces when quiting insert mode 2011-12-21 18:58:41 +00:00
Maxime Coste
70bb4847ee IncrementalInserter: catch exception thrown by the hook 2011-12-21 18:57:07 +00:00
Maxime Coste
6c817c8117 Window: do not manage undo groups when an inserter is active 2011-12-21 18:56:32 +00:00
Maxime Coste
913ee3f096 Use Keys instead of char for keymap 2011-12-21 14:29:28 +00:00
Maxime Coste
ba1fe056f4 Add an exec command, similar to vim normal command 2011-12-20 19:22:05 +00:00
Maxime Coste
7116ed6d61 Window: throw when multiselect results in no selections 2011-12-20 19:27:13 +00:00
Maxime Coste
42a24895de Add Key struct 2011-12-20 19:21:11 +00:00
Maxime Coste
91606850fd Utils: add on_scope_end utility
on_scope_end permits to register a functor to be called at scope
end (either exception thrown or normal scope end). this is usefull
for cleanup code that must be run.

usage:

auto cleaner = on_scope_end([]() { cleanup(); });
2011-12-20 19:18:00 +00:00
Maxime Coste
17cab9c7c4 Filters: add cleanup_whitespace filter
this filter remove trailing whitespaces on the previous line
when inserting an end-of-line.
2011-12-20 14:27:01 +00:00
Maxime Coste
e77f58c010 better rvalue reference forwarding 2011-12-07 18:57:07 +00:00
Maxime Coste
2239fb6e49 Filters: move from buffer to window 2011-12-07 14:29:10 +00:00
Maxime Coste
c40eb2b03a Buffer: replace insert and erase methods with modify
modify directly takes a Modification as parameter
2011-12-07 14:26:40 +00:00
Maxime Coste
2edddfe009 Buffer: rename BufferModification to Modification 2011-12-06 18:58:43 +00:00
Maxime Coste
73cebb9072 kakrc: do not highlight the end-of-line in trailing whitespaces 2011-12-06 18:50:05 +00:00
Maxime Coste
b245d80c4e Window: preserve current selection when empty multi_select 2011-12-05 19:21:16 +00:00
Maxime Coste
4ae2fcffbd Buffer: add comment for clamp 2011-12-05 19:21:11 +00:00
Maxime Coste
711c05b81e Window: fix trailing spaces 2011-12-05 14:29:36 +00:00
Maxime Coste
23eafd4504 Add a repeat last insert command, bound to . 2011-12-05 14:28:45 +00:00
Maxime Coste
d1cc5da8a6 Filters: add expand_tabulations to insert spaces instead of tabs 2011-12-03 20:25:05 +00:00
Maxime Coste
74a315cd0e kakrc: add preserve_indent filter on c++ files and highlight trailing spaces 2011-12-02 19:01:08 +00:00
Maxime Coste
c761420055 fix exec_commands_in_file 2011-12-02 19:00:37 +00:00
Maxime Coste
11d606f79e {Filter,Highlighter}Registry: more infos on factory not found 2011-12-02 19:00:01 +00:00
Maxime Coste
0b4ed2280f Buffer: call BufCreate hook on construction 2011-12-02 18:59:18 +00:00
Maxime Coste
8e39edc567 DynamicBufferIterator: fix end of buffer corner case 2011-12-02 18:57:18 +00:00
Maxime Coste
b1daf8de16 Selectors: fix select_line on the last line 2011-12-02 18:56:18 +00:00
Maxime Coste
94d59cc4dd Buffer: add filter support
filters are functions called prior to applying a modification
to a buffer. They can manipulate the modification to change
the editor behaviour.
2011-12-02 14:28:27 +00:00
Maxime Coste
8e06e168d9 HighlighterRegistry: use idvaluemap to store factories 2011-12-02 14:22:51 +00:00
Maxime Coste
4252e0d610 Window: use an idvaluemap to store highlighters 2011-12-02 14:20:11 +00:00
Maxime Coste
a5a726d291 Add idvaluemap container
it is a vector based map, preserving insertion order and providing
completion on ids it contains.
2011-12-02 14:18:31 +00:00
Maxime Coste
934e62b502 stop clearing selections all the time 2011-11-30 14:18:54 +00:00
Maxime Coste
d8dd782960 Highlighters: style fix 2011-11-30 14:11:53 +00:00
Maxime Coste
0b48525b35 Window: do not stay on an eol when clearing selections 2011-11-29 22:48:00 +00:00
Maxime Coste
0859b20bcf Rename Filter to Highlighter to be more explicit 2011-11-29 22:37:20 +00:00
Maxime Coste
e89516f2a3 IncrementalInserter: refactoring 2011-11-29 21:35:50 +00:00
Maxime Coste
b24dec89a2 Buffer: add iterator_at_line_{begin,end} methods 2011-11-28 19:31:29 +00:00
Maxime Coste
51ee0b61f4 DynamicBufferIterator: use const_cast instead of having a mutable field in Buffer 2011-11-28 18:55:17 +00:00
Maxime Coste
46a01b5a0b Debug: stop writing key codes to debug buffer and cleanups 2011-11-28 18:52:29 +00:00
Maxime Coste
dc642f8afa Buffer: refactor to remove do_{insert,erase} methods 2011-11-27 18:41:25 +00:00
Maxime Coste
08ba791ff4 Add a kakrc file which automatically enables hlcpp on c/c++ files 2011-11-27 13:02:50 +00:00
Maxime Coste
70e0393c4d Add a source command to execute commands from file
a kakrc file in current directory is sourced automatically
at start
2011-11-27 12:59:59 +00:00
Maxime Coste
de19aeb035 File: extract read_file function which returns file content in a string 2011-11-27 12:56:38 +00:00
Maxime Coste
b59a0816b9 Add wq and wq! commands 2011-11-26 19:11:24 +00:00
Maxime Coste
e36153f035 CommandManager: fix complete and style tweak 2011-11-26 19:05:49 +00:00
Maxime Coste
a00961da99 Add hook command 2011-11-26 18:41:55 +00:00
Maxime Coste
dd2896ecc8 Window: call WinCreate hook on creation 2011-11-26 18:39:59 +00:00
Maxime Coste
9c117a821c Filters: fix colorize_regex_range when range is not visible 2011-11-26 18:34:49 +00:00
Maxime Coste
68f3d24199 HooksManager: replace HookContext with Context 2011-11-26 18:34:10 +00:00
Maxime Coste
957446dee4 Add a Context parameter to commands 2011-11-26 18:32:57 +00:00
Maxime Coste
417802cbdf CommandManager: argument splitting supports "multi word"
works with " and '
2011-11-26 17:20:02 +00:00
Maxime Coste
9775958012 Add a HooksManager class 2011-11-25 14:26:29 +00:00
Maxime Coste
9a4d8d5f4d Filters: tweak colorize_cplusplus 2011-11-24 19:13:58 +00:00
Maxime Coste
dcfb5e15f2 SelectionHighlighter: highlight end of lines in selection 2011-11-24 19:13:38 +00:00
Maxime Coste
ea2aeea3a4 Filters: generalize colorize_regex in colorize_regex_range 2011-11-24 19:11:58 +00:00
Maxime Coste
2549a63c0b Selectors: fix corner cases on first/last buffer char 2011-11-24 18:46:35 +00:00
Maxime Coste
30b4fb6513 Buffer: fix handling of last eol 2011-11-24 14:23:41 +00:00
Maxime Coste
7b09b34cab Selectors: fix select_whole_lines 2011-11-22 18:58:05 +00:00
Maxime Coste
d27aaab066 use alt-x instead of , to select whole lines 2011-11-22 14:31:20 +00:00
Maxime Coste
a1200aacad Add alt-j command to join lines 2011-11-22 14:24:50 +00:00
Maxime Coste
95f87a6694 Window: add replace method
permits to replace selection by a string in a single undo step
2011-11-22 14:23:46 +00:00
Maxime Coste
a7309fbe87 IncrementalInserter: fix erase 2011-11-21 22:18:00 +00:00
Maxime Coste
7861ad9ddb Selectors: add split_selection bound to Alt-s 2011-11-21 19:30:44 +00:00
Maxime Coste
b67c36358d Extract RegexSelector methods as plain selectors 2011-11-21 19:08:51 +00:00
Maxime Coste
2677fa7961 Add , to fully selects lines selection is on. 2011-11-21 18:53:22 +00:00
Maxime Coste
a1a57ea137 DisplayBuffer: fix DisplayAtom::iterator_at 2011-11-16 21:03:32 +00:00
Maxime Coste
bef193ae54 RegexSelector: support captures 2011-11-16 20:05:29 +00:00
Maxime Coste
18913cfbff IncrementalInserter: add insert_capture method bound to ^B<num> 2011-11-16 19:24:37 +00:00
Maxime Coste
52b8abfe02 Selections: add captures field
Selections now can have associated captures, for backreferences when
selections are created from a regex search
2011-11-16 19:23:09 +00:00
Maxime Coste
b1e815a66c RegexSelector: support multi selections, bound to s key 2011-11-16 14:06:01 +00:00
Maxime Coste
0203b904e1 Window: add multi_select method
multi_select provides Selection -> SelectionList operations
2011-11-16 14:04:45 +00:00
Maxime Coste
7423677236 Filters: cleanup trailing whitespaces
detected with ':addfilter regex \h+\n default red' !
2011-11-15 14:28:03 +00:00
Maxime Coste
d1868e8f07 ncurses: set ESCDELAY to 25 so that esc key lag is less noticeable 2011-11-15 14:26:28 +00:00
Maxime Coste
a3b5c74512 remove unused code 2011-11-14 14:27:33 +00:00
Maxime Coste
031fa1a25c Filters: colorize_regex supports matches spanning multiple display atoms 2011-11-14 14:23:02 +00:00
Maxime Coste
d2b9cd6e60 DisplayBuffer: split now preserve iterator parameter
that means that the given iterator points to the first part of the
split (instead of the second in previous implementation).
2011-11-14 14:10:11 +00:00
Maxime Coste
0dc8442ca4 Completions: add filterid completion for rmfilter 2011-11-12 14:15:35 +00:00
Maxime Coste
a8b2c4f568 Completions: add basic addfilter completion 2011-11-12 14:08:05 +00:00
Maxime Coste
f5ad32f137 Completion: decentralise, move buffer name completion to BufferManager 2011-11-12 14:06:49 +00:00
Maxime Coste
82baa55eed Completions: change NullCompletion functor to complete_nothing function 2011-11-10 20:57:25 +00:00
Maxime Coste
56231b4239 Filters: make colorize_regex accessible through addfilter 2011-11-10 14:28:38 +00:00
Maxime Coste
f12929abad Filters: refactoring 2011-11-09 23:56:22 +00:00
Maxime Coste
5aeee719dd fix launching on new file 2011-11-09 14:17:46 +00:00
Maxime Coste
55c092eed9 Filters: code cleanup 2011-11-09 14:06:05 +00:00
Maxime Coste
3af1b89034 Window: support adding and removing filters with :addfilter :rmfilter 2011-11-08 14:29:52 +00:00
Maxime Coste
1f3f5ea1ba Filters: register existing filters with the registry 2011-11-08 14:28:01 +00:00
Maxime Coste
e4ff1d8ad8 Add a filter registry class 2011-11-08 14:27:21 +00:00
Maxime Coste
0ddb6df80d IncrementalInserter: move cursor left when finishing 2011-11-04 14:15:35 +00:00
Maxime Coste
46e727d5b6 Filters: tweak colorize_cplusplus 2011-11-04 09:10:28 +00:00
Maxime Coste
cebb7980cb Buffer: tweak default content 2011-11-04 09:10:05 +00:00
Maxime Coste
9cf7cb682c Buffer: fix modified handling 2011-11-03 13:44:02 +00:00
Maxime Coste
4982620c4c IncrementalInserter: support insert at line begin and append at line end 2011-11-02 20:03:41 +00:00
Maxime Coste
856a870d8b fix not existing lines drawing 2011-11-02 14:22:20 +00:00
Maxime Coste
fbe8eed3e4 Selectors: select_line selects next line when cursor is on eol 2011-10-27 18:57:31 +00:00
Maxime Coste
0e18db5a88 lines and columns used for user interaction are 1-indexed 2011-10-27 14:27:39 +00:00
Maxime Coste
55cd4949e0 Selection: more intelligent merging 2011-10-27 14:22:17 +00:00
Maxime Coste
62482b65ec rename buffer_iterator.inl.h to buffer_iterator.inl.hh 2011-10-27 14:13:39 +00:00
Maxime Coste
5bd61a3f38 Filters: correct select_to_previous_WORD 2011-10-27 14:09:57 +00:00
Maxime Coste
c532f031d2 Filters: tweak colorize_cpluscplus 2011-10-26 14:29:04 +00:00
Maxime Coste
b58694939c bind alt-[lLhH] to select_to_eol(_reverse)? 2011-10-26 14:22:48 +00:00
Maxime Coste
5d5e76a3eb change select_line binding from . to x 2011-10-26 14:18:43 +00:00
Maxime Coste
2c8f3229c0 Selectors: add selectors for WORDs
WORDs are the same as vim's ones, i.e. a group of contiguous non blank
characters. They are bound as alt + word selector key.
2011-10-25 18:46:14 +00:00
Maxime Coste
97a279e229 add alt-key binding support
bind alt-[tTfF] to backward version of [tTfF]
2011-10-25 14:28:20 +00:00
Maxime Coste
57b55a5824 DisplayBuffer: deactivate too expensive check 2011-10-24 19:27:36 +00:00
Maxime Coste
d2c6ceb47b DynamicBufferIterator: add and use in Selections
DynamicBufferIterator are a new type of BufferIterators that
automatically update themselves when their buffer is modified.

Selections now uses this type of iterators instead of plain ones
2011-10-24 14:26:21 +00:00
Maxime Coste
bace526fa3 Buffer: not copyable, add destructor 2011-10-24 14:23:13 +00:00
Maxime Coste
12d933d896 Filters: rewrote colorize_regex 2011-10-23 20:26:51 +00:00
Maxime Coste
fffa405bfd DisplayBuffer: overload atom_containing with a version taking an iterator to search start 2011-10-23 20:26:30 +00:00
Maxime Coste
ad6ee464f4 style tweak 2011-10-19 18:54:20 +00:00
Maxime Coste
712577b88e CommandManager: fix completion of empty tokens 2011-10-19 18:50:28 +00:00
Maxime Coste
d7f934b7ca Buffer: iterator_at prevents getting iterators on end of line 2011-10-19 14:25:13 +00:00
Maxime Coste
7e2f7f6715 IncrementalInserter: fix OpenLineBelow 2011-10-18 14:13:19 +00:00
Maxime Coste
32e01947fa DisplayBuffer: store atoms in a std::list instead of a vector 2011-10-18 13:59:32 +00:00
Maxime Coste
6fd7f97fa7 Window: fix status_line cursor position 2011-10-18 13:49:10 +00:00
Maxime Coste
c7876f0ba3 DisplayBuffer: remove some check_invariant, overhead is too noticeable 2011-10-18 00:56:18 +00:00
Maxime Coste
8cab34d57f Buffer: add support for modification listeners 2011-10-18 00:55:45 +00:00
Maxime Coste
d48a2bd325 BufferIterator: move methods implementation to buffer_iterator.inl.h 2011-10-17 22:05:06 +00:00
Maxime Coste
1c6eef08f1 utils: add contains function 2011-10-17 21:05:22 +00:00
Maxime Coste
316e84f119 Filters: add a show line numbers filter 2011-10-17 19:01:36 +00:00
Maxime Coste
2badb9d708 DisplayAtom: add splittable methode 2011-10-17 19:01:04 +00:00
Maxime Coste
79ee27dae7 DisplayBuffer: deinline insert method and add atom_containing method 2011-10-17 19:00:38 +00:00
Maxime Coste
88e31d8cce DisplayBuffer: allow empty atoms, with begin == end 2011-10-17 18:59:35 +00:00
Maxime Coste
53ce1e016a Buffer: move struct Modification out of class, as BufferModification 2011-10-17 14:12:15 +00:00
Maxime Coste
dc74934e59 DisplayBuffer: refactoring, correct support of replacements
DisplayAtoms now know where they are on the screen and have
line_and_column_at and iterator_at methods.
2011-10-15 04:45:49 +00:00
Maxime Coste
187a99aba2 LineAndColumn: add comparison operators 2011-10-15 04:42:28 +00:00
Maxime Coste
26459abf8a WindowCoord: rename to DisplayCoord and move with DisplayBuffer 2011-10-14 14:29:53 +00:00
Maxime Coste
c5be69a9a9 BufferCoord: allow explicit construction from all LineAndColumns 2011-10-14 14:27:43 +00:00
Maxime Coste
2d54a7818e Window: privatize coordinates conversion methods 2011-10-12 18:54:48 +00:00
Maxime Coste
80e7bac622 Selectors: remove unused move_select 2011-10-12 18:54:04 +00:00
Maxime Coste
be043ffe1e Window: move_cursor_to takes a BufferIterator parameter 2011-10-12 18:53:38 +00:00
Maxime Coste
22bd9f90d5 Filters: add an expand_tabulation filter 2011-10-12 18:52:22 +00:00
Maxime Coste
f802a9f3be Debug: add key integral value in the debug buffer on keystroke 2011-10-10 22:47:19 +00:00
Maxime Coste
219709e472 Completions: move code from main.cc to completion.hh 2011-10-10 22:38:58 +00:00
Maxime Coste
fe0e1c79f0 Window: scroll when inserting, appending, erasing if necessary 2011-10-10 14:28:39 +00:00
Maxime Coste
7e84ca9ae9 gl and gh now go to first or last character of the line
append mode is supported through G key
2011-10-10 14:24:17 +00:00
Maxime Coste
003c5d4e3d remove useless line 2011-10-08 13:23:18 +00:00
Maxime Coste
afd1ae5458 Filters: tweak colorize_cplusplus 2011-10-07 14:28:38 +00:00
Maxime Coste
868a2f8107 ncurses: fix color support 2011-10-07 14:28:13 +00:00
Maxime Coste
10106e8c8e DisplayBuffer: do not store content in atom, begin and end are sufficient 2011-10-07 14:19:58 +00:00
Maxime Coste
a19f4f059d Debug: add a write_debug function
write_debug writes in a Scratch buffer named '*debug*', so that debug
messages are accessibles from within kakoune
2011-10-07 14:16:38 +00:00
Maxime Coste
9db4aa9691 Buffer: add a type property 2011-10-07 14:15:55 +00:00
Maxime Coste
12535e1099 Window: get rid of select_mode 2011-10-07 14:03:25 +00:00
Maxime Coste
ca99a51bca clear selections after a change 2011-10-06 21:13:33 +00:00
Maxime Coste
1e224dc586 whitespace fix 2011-10-06 21:13:16 +00:00
Maxime Coste
571e4772b4 IncrementalInserter: support OpenLineBelow and OpenLineAbove mode 2011-10-06 21:12:55 +00:00
Maxime Coste
cf9f8c93ec Filters: tweak colorize_cplusplus 2011-10-06 21:12:16 +00:00
Maxime Coste
f9be716776 quit: do not quit if modified buffer exists, add q! command 2011-10-05 18:43:47 +00:00
Maxime Coste
cf162ae617 draw_window: add a space for eol, so that selected eol are visible 2011-10-05 14:28:20 +00:00
Maxime Coste
ff730380ed Window: empty_selections -> clear_selections
clear_selections also reset select_mode to Normal,
most editing operations now do a clear_selections.
2011-10-05 14:24:52 +00:00
Maxime Coste
4ce349fa02 Buffer: modification tracking 2011-10-05 14:21:24 +00:00
Maxime Coste
f4743e08bd Filters: tweaks colorize_cplusplus 2011-10-04 19:08:34 +00:00
Maxime Coste
c8cf7bbaa9 Window: add a basic status line 2011-10-04 18:49:41 +00:00
Maxime Coste
4f771b084a escape-key force return to normal mode 2011-10-03 18:41:05 +00:00
Maxime Coste
945426f47a File: fix write_buffer_to_file 2011-10-03 18:40:12 +00:00
Maxime Coste
6a0b570e50 Filters: add a colorize_cplusplus filter and use it by default in Window 2011-10-03 14:30:14 +00:00
Maxime Coste
d99bcd7f2e bind T and F as select_to_reverse non-inclusive and inclusive 2011-10-03 14:29:44 +00:00
Maxime Coste
01ac17ed04 Filters: add a colorize_regex filter 2011-09-30 19:16:23 +00:00
Maxime Coste
36c3bb6ae3 ncurses: quick'n'dirty color support 2011-09-30 19:15:14 +00:00
Maxime Coste
e351acd997 Window: fix blink_void 2011-09-29 14:23:46 +00:00
Maxime Coste
834e2d2fe3 DisplayBuffer: check_invariant method to assert atoms consistency 2011-09-29 09:10:27 +00:00
Maxime Coste
e659ea2dab DisplayBuffer: add a split method to split an atom 2011-09-29 08:55:08 +00:00
Maxime Coste
822fc0f822 Window: add a test filter to make 'void' blink 2011-09-29 08:37:27 +00:00
Maxime Coste
ba2800ddac Window: refactor DisplayBuffer generation 2011-09-28 20:54:11 +00:00
Maxime Coste
7746c78ccc BufferIterator: add operator>{,=} 2011-09-28 20:53:29 +00:00
Maxime Coste
a30b7c1e9f Window: fix scrolling when select_mode == Append 2011-09-28 19:21:49 +00:00
Maxime Coste
e619a81375 IncrementalInserter: Append, Insert or Change mode specified at construction 2011-09-28 19:14:39 +00:00
Maxime Coste
43fb64a913 Window: selection behaviour now depends on a window state
more vi-like behaviour, hit the v key to toggle append selection mode,
this means much more keys become available for mapping, as caps are now
longer reserved to append mode.
2011-09-28 14:23:43 +00:00
Maxime Coste
309b722df9 Window: cursors are now implicit, taken from current selections
Window hence guarantees that there is always at least one selection.
2011-09-27 18:45:22 +00:00
Maxime Coste
610acb3c0e Selectors: add a count argument to select_to 2011-09-27 14:27:48 +00:00
Maxime Coste
01018a5eac Handle paste before and paster after with p and P 2011-09-27 14:15:20 +00:00
Maxime Coste
924a85d14f erase, change: yank current selection before erasing 2011-09-26 08:59:32 +00:00
Maxime Coste
6ff06ca985 DisplayBuffer: cleanup 2011-09-25 23:51:12 +00:00
Maxime Coste
639897517a Word selectors: better handling of line breaks 2011-09-25 23:50:13 +00:00
Maxime Coste
dc54e7f09c % key selects whole buffer 2011-09-24 13:45:25 +00:00
Maxime Coste
0cad8ed34b gh and gl to move to first/last character of line 2011-09-24 13:08:04 +00:00
Maxime Coste
d4933daba0 BufferIterator: fix operator= 2011-09-24 13:06:35 +00:00
Maxime Coste
53c9021857 Search: save last search to '/' register and bind n to repeat last search 2011-09-24 12:48:58 +00:00
Maxime Coste
1f0b06a855 Window: undo group cleanup and fix of append method 2011-09-24 12:39:40 +00:00
Maxime Coste
9b865cea39 Basic support for yanking and pasting 2011-09-23 14:31:57 +00:00
Maxime Coste
838ceb5958 Window: add selection_content method
it returns the content of the last selection, or the character under the
cursor if there are no selections.
2011-09-23 14:31:15 +00:00
Maxime Coste
8f70192875 CommandManager: now a singleton 2011-09-23 14:29:42 +00:00
Maxime Coste
c2cbd69c1a main: using namespace std::placeholders 2011-09-23 14:27:34 +00:00
Maxime Coste
26537d7028 Utils: Singleton template and migration of the BufferManager
Singletons are not autocreating, the application needs to create
exactly one instance (I want to avoid implicit initialization order
hell)
2011-09-23 14:26:53 +00:00
Maxime Coste
52ad372adb Selectors: support inclusive mode in select_to (bound to f key) 2011-09-23 14:06:10 +00:00
Maxime Coste
662ba0c904 Selection: do not use [begin, end) semantics but [first, last]
selections are now defined with inclusive iterators, which means that
Selection(cursor, cursor) is a valid selection of the charateter pointed
by cursor.

On the user interface side, that means that the cursor is now part of
the selection, selectors were adapted to this behavior (and word
selectors are now much more intuitive)
2011-09-23 09:17:19 +00:00
Maxime Coste
5ca901644f Completion: add complete_buffername completer 2011-09-22 18:55:45 +00:00
Maxime Coste
429536d0f4 BufferManager: allow iteration on Buffers with begin/end methods 2011-09-22 18:55:23 +00:00
Maxime Coste
c3faeb6c05 Selectors: add select_to which selects until a given character on current line 2011-09-22 14:35:28 +00:00
Maxime Coste
0f4f201b6d Selectors: fix select_matching 2011-09-22 14:18:26 +00:00
Maxime Coste
03c199420e basic g (go) command, gg/gt goes to first line, gb goes to last 2011-09-22 14:02:07 +00:00
Maxime Coste
a8cac32fe0 Selectors: more vi-like words movements 2011-09-22 14:00:31 +00:00
Maxime Coste
5a46ad49ea Window: add move_cursor_to method 2011-09-22 14:00:04 +00:00
Maxime Coste
3012f69c4d Selection: fix canonicalize 2011-09-22 13:59:07 +00:00
Maxime Coste
948443a077 Buffer: add line_count method 2011-09-22 13:58:35 +00:00
Maxime Coste
2efa120612 o key to open a line after the current one 2011-09-22 09:24:16 +00:00
Maxime Coste
cff69b2556 Selectors: add a basic select_matching selector for <([{]])> pairs 2011-09-21 19:09:49 +00:00
Maxime Coste
3af66276f0 Move selectors function to their own file 2011-09-21 14:37:09 +00:00
Maxime Coste
3c06846aa3 RegexSelector: wrap on top if needed 2011-09-20 12:00:06 +00:00
Maxime Coste
13d14d4ff5 Insert: refactoring using IncrementalInserter 2011-09-19 22:00:29 +00:00
Maxime Coste
9da8fbe630 Window: add a IncrementalInserter class for insert mode 2011-09-19 21:56:29 +00:00
Maxime Coste
2f093d78b5 LineAndColumn: fix operator[+-]= 2011-09-19 21:55:58 +00:00
Maxime Coste
8a4a3e447b Window: fix erase 2011-09-18 20:09:25 +00:00
Maxime Coste
85e2a31b31 Window: code cleanup and more intelligent Selection class 2011-09-17 14:57:35 +00:00
Maxime Coste
0513b4de29 Shift-{H,J,K,L} keys move cursor while selecting. 2011-09-17 14:28:23 +00:00
Maxime Coste
34c9b0d30f LineAndColumn: move to it's own header and add operator[+-]=?
LineAndColumn is now a template so that WindowCoords and BufferCoords
cannot be added together.
2011-09-17 14:13:33 +00:00
Maxime Coste
49fce28dec select_to_next_word{,_end}: words are [a-zA-Z0-9] 2011-09-16 09:20:36 +00:00
Maxime Coste
3afbbefd9b Configure filename completer for edit and write commands 2011-09-16 09:20:01 +00:00
Maxime Coste
63191f1900 CommandManager: support per command configurable completion 2011-09-16 09:18:51 +00:00
Maxime Coste
aeea1c610c complete_filename: accept cursor_position as additional parameter 2011-09-16 09:17:55 +00:00
Maxime Coste
635e76eb4c prompt: rework tu support arrows and completion cycling 2011-09-14 19:15:09 +00:00
Maxime Coste
b59ad6a174 Completion: dedicated completion header and basic filename completion 2011-09-14 15:41:56 +00:00
Maxime Coste
4b38cd3cd0 utils: add auto_raii helper function
this helper permits to register a resource and cleanup function to keep
exception safety with C like resource. For exemple, to be sure that a
FILE* will be closed, you can use:

auto file = auto_raii(fopen("filename"), fclose);

file will auto cast to FILE* when needed, and will call fclose when
going out of scope.
2011-09-14 15:36:35 +00:00
Maxime Coste
eecc5a184e CommandManager: basic command name completion support 2011-09-13 21:16:48 +00:00
Maxime Coste
030c5caf0a assert: custom implementation 2011-09-09 19:24:18 +00:00
Maxime Coste
3caf962110 exception: refactoring 2011-09-09 18:40:59 +00:00
Maxime Coste
84682b7590 Add a buffer command to switch between existing buffers 2011-09-08 14:32:36 +00:00
Maxime Coste
76b7c60afb Buffer is now responsible for window creation 2011-09-08 14:30:36 +00:00
Maxime Coste
60e673acba Makefile: add rule for tags 2011-09-08 14:28:42 +00:00
Maxime Coste
d3499ecd9c Window lifetime is now handled by it's buffer.
A window cannot outlive it's buffer, so it makes sense to keep only a
reference on it hand have the buffer manage the window lifetime.
2011-09-08 00:13:19 +00:00
Maxime Coste
535e200587 Add a BufferManager singleton class, handling buffer lifetime
it also provide access to buffers by name
2011-09-08 00:11:48 +00:00
Maxime Coste
511df5b660 utils: add operator== (const std::unique_ptr<T>&, T*) 2011-09-08 00:08:55 +00:00
Maxime Coste
03f1520b43 Refactor commands handling and parsing in a CommandManager class 2011-09-07 18:16:56 +00:00
Maxime Coste
8baf43ece1 binding of undo to 'u' and redo to 'U' 2011-09-06 18:53:12 +00:00
Maxime Coste
f88d1dbe06 Window: basic binding of bufffer undo feature 2011-09-06 18:52:52 +00:00
Maxime Coste
1e87fe17c6 Buffer: Undo/Redo implementation
Currently only a linear undo, i.e. if you undo and then make some new
changes, previous undoed changes are lost. Final undo system should
support an undo tree, with timestamped modifications.
2011-09-06 18:49:32 +00:00
Maxime Coste
f58cbf0b98 utils: Add reversed template helper for container iteration
this permits to use range-based for loops to iterate on reversed
containers. Should work on any container implementing rbegin and rend.
2011-09-06 18:33:35 +00:00
Maxime Coste
3f51feaaef Buffer: accept initial content in constructor 2011-09-06 18:33:18 +00:00
Maxime Coste
6668151c78 LineAndColumn: segregate into WindowCoord and BufferCoord
Having the same type to specify coordinates in window space or buffer
space is error prone, now the compiler will tell if we use one for
another.
2011-09-05 19:06:31 +00:00
Maxime Coste
d5012c9379 window: support scrolling 2011-09-05 18:55:31 +00:00
Maxime Coste
04c7ce8f01 window: cursor position is now stored in window coordinate
It was stored in buffer coordinates. Conversion methods added
2011-09-05 18:54:17 +00:00
Maxime Coste
2224118de2 insert: print '-- INSERT --' in status line 2011-09-02 18:45:57 +00:00
Maxime Coste
61b37a6057 RegexSelector: search the entire buffer instead of the current line 2011-09-02 18:38:10 +00:00
Maxime Coste
39f12a1766 add const BufferIterator::Buffer& buffer() method 2011-09-02 18:35:22 +00:00
Maxime Coste
19123186d7 better exception handling in edit and write_buffer 2011-09-02 18:02:29 +00:00
Maxime Coste
11d82b11b3 create_buffer_from_file: throw file_not_found instead of open_file_error when ENOENT 2011-09-02 18:01:20 +00:00
Maxime Coste
955744e5d0 prompt: correctly handle backspace when empty 2011-09-02 17:07:35 +00:00
Maxime Coste
053b2e233e main: catch all exceptions, close ncurses and rethrow 2011-09-02 17:05:44 +00:00
Maxime Coste
535285d9e6 Initial commit 2011-09-02 16:51:20 +00:00