Commit Graph

246 Commits

Author SHA1 Message Date
Maxime Coste
e1fc2677e3 Add a MenuDoc style for info box, that will place it next to the menu 2014-11-08 18:01:55 +00:00
Maxime Coste
c04dfc7bb7 move more parameters from const String& to StringView 2014-11-01 19:31:13 +00:00
Maxime Coste
fc4142178f Port more code to StringView instead of const String& 2014-10-20 19:18:38 +01:00
Maxime Coste
fa85f0fc32 Refactor regex uses, do not reference boost except in regex.hh 2014-10-13 13:14:23 +01:00
Maxime Coste
4c4d3cdd38 Add support for mapping keys in goto/view commands 2014-09-23 13:45:18 +01:00
Maxime Coste
827a77539a Add some color to mode specific mode line info 2014-09-10 19:06:53 +01:00
Maxime Coste
50e1e5fadd Add support for 'c-o' in prompt and insert to hide the completion menu
Fixes #229
2014-08-19 23:32:19 +01:00
Maxime Coste
fbbe741c07 Add support for <c-w> <c-b> and <c-e> for word moves in the line editor
This might go away later if we find a better way of handling line
edition, but seems like a good compromise for now.

Fixes #168
2014-08-14 00:31:39 +01:00
Maxime Coste
43f44bbab3 Fix buffer modification check
It used to grab the next key, because the normal mode reactivation
when executing the on_next_key would trigger a timestamp check again.
2014-08-07 21:51:36 +01:00
Maxime Coste
8ed16bb2e9 In non interactive interactive mode, disable user key mappings
exec and eval now accepts a -with-maps to use them. But by default
they are disabled, so that all the indent scripts work even if you
remap basic keys.

Fixes #217
2014-07-27 20:18:09 +01:00
Maxime Coste
8d6e8bc06f Display a [no-hooks] tag in the mode line when hooks are disabled 2014-07-25 23:47:47 +01:00
Maxime Coste
731277a425 Disable hooks on a per context basis, and propagate that to Insert mode
using \ before entering insert mode will disable hooks during the whole
insert session rather than only the entering phase. That gives a nice
way of pasting text into kakoune.
2014-07-24 19:18:39 +01:00
Maxime Coste
bc48d9260d Fix Menu use of j/k keys when editing filter 2014-07-22 18:39:04 +01:00
Maxime Coste
f4e3df817f Clear status line on normal mode command 2014-07-17 19:37:30 +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
b6979e2d2c Add docstring for normal mode commands and display them if autoinfo >= 2 2014-07-10 19:22:14 +01:00
Maxime Coste
b89b7c754f Add \ in normal mode to disable user hooks on next normal command
Fixes #112
2014-06-21 22:06:02 +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
e78fd2d235 Do not merge overlapping selection when entering append mode
Fixes #163
2014-06-16 01:05:38 +01:00
Maxime Coste
5245f0073c Refactor InputMode::Insert::prepare 2014-06-09 23:23:49 +01:00
Maxime Coste
f54f8818c6 Merge branch 'master' into remove-buffer-change-listener 2014-06-09 19:29:40 +01:00
Maxime Coste
cf2609de1c Tweak prompt completion behaviour
Always select the common prefix if we just updated the list of
completions. The previous behaviour was to ignore it if we had
it already typed. Do that only if it was already displayed.
2014-06-09 13:47:37 +01:00
Maxime Coste
49ab0c101a Use forward iteration on selections, and take advantage of it when updating
SelectionList::update now is optimized for the common case where changes
are sorted, the algorithm is O(m*n) with m the number of sorted ranges
in the changes. In the common case, m should be very small.
2014-05-29 05:48:40 +01:00
Maxime Coste
51eae8026b Use SelectionList::insert in InputModes::Insert 2014-05-25 22:59:29 +01:00
Maxime Coste
0a060b62a2 Merge branch 'master' into remove-buffer-change-listener 2014-05-25 20:01:55 +01:00
Maxime Coste
bf50a1c191 In normal mode, backspace can be used to edit count
Fix #125
2014-05-25 19:14:44 +01:00
Maxime Coste
811f1c2d76 Rename Key::Erase to Key::Delete and add 'del' keyname
Fixes #145
Fixes #146
2014-05-25 17:41:28 +01:00
Maxime Coste
4e280977a2 Iterate in reversed order on selections when modifing buffer
This way, update only needs to be called once everything is done
as we always modify after the next selection to be used.
2014-05-14 20:56:49 +01:00
Maxime Coste
bf98b38afd Use a plain SelectionList for Context, remove DynamicSelectionList 2014-05-14 19:49:04 +01:00
Maxime Coste
ea3e92aa5e SelectionList know its buffer and timestamp 2014-05-13 20:09:06 +01:00
Maxime Coste
8546788b43 Refactor LineAndColumn coordinates
BufferCoord -> ByteCoord
DisplayCoord -> CharCoord

Moved their definition along with LineAndColumn into coord.hh
2014-05-07 19:53:45 +01:00
Maxime Coste
f683946681 Extract insert completion code to insert_completer.{cc,hh} 2014-04-28 21:54:00 +01:00
Maxime Coste
512bfa0c65 Fix support for tabulation in insert completion candidates 2014-04-28 19:49:23 +01:00
Maxime Coste
b370f91025 Add -init switch to :prompt to set the initial text
Fixes #97
2014-04-27 12:37:41 +01:00
Maxime Coste
389308dfd8 Preserve current word in word completion if found elsewhere
If occurence count in the buffer if greater that one, do not
remove it from the matches.
2014-04-22 19:32:12 +01:00
Maxime Coste
1d7a481e81 word completion ignore the word on which the cursor is present 2014-04-17 19:33:49 +01:00
Maxime Coste
2b997719c3 Rename BufferCompleter to InputCompleter 2014-04-16 19:08:44 +01:00
Maxime Coste
7097fcf640 Allow unset completer function in Prompt input mode 2014-04-13 14:15:05 +01:00
Maxime Coste
e94a82ac98 More OSX fixes 2014-04-02 22:52:00 +01:00
Maxime Coste
cd908bf6a3 minor cleanup 2014-03-30 10:45:53 +01:00
Evert Van Petegem
369728cd7f Push aborted commands to history 2014-03-24 22:11:19 +01:00
Maxime Coste
0db39ccfd0 Automatic insert filename completion kicks in only if prefix contains slash 2014-03-19 08:05:28 +00:00
Maxime Coste
36b016226c Insert mode completion execute completers in order, and supports multiple option
The 'completions' option is gone, just add option=completion_option_name
in the completers list.
2014-03-15 03:17:17 +00:00
Maxime Coste
938f66badd Check for buffer external change when entering insert mode 2014-02-12 00:03:00 +00:00
Maxime Coste
d2a1c5ce46 Prompt handles scrolling in the line being edited 2014-02-12 00:03:00 +00:00
Maxime Coste
2159fc9563 Rename selections first,last to more explicit anchor,cursor 2014-01-28 19:06:52 +00:00
Maxime Coste
997aadd33f Word completion use a WordDB stored as a buffer value. 2014-01-16 22:07:42 +00:00
Maxime Coste
feaf197cae Add support for the erase key in prompt and insert mode
Fixes #18
2014-01-04 18:18:59 +00:00
Maxime Coste
608098cdde InputHandler: selection first item when entering menu mode 2014-01-02 19:19:41 +00:00
Maxime Coste
a0d4a44dd5 Fix prefix completion in prompt 2013-12-23 20:43:29 +00:00
Maxime Coste
c0973075fa Get rid of Editor for good
ClientManager now stores only the free windows, clients take
ownership of its own.
2013-12-20 20:14:57 +00:00
Maxime Coste
7267b8281f Move insert and erase to normal.cc, and move edition management to context 2013-12-15 20:23:02 +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
9b6639eb27 Remove Editor::move_selections 2013-12-15 14:14:52 +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
894ee0297e Move main selection index to SelectionList 2013-12-14 14:38:17 +00:00
Maxime Coste
50325e62b0 fix prompt completion handling misbehaving with history 2013-11-28 18:48:09 +00:00
Maxime Coste
f57f065d76 Fix prompt completion 2013-11-18 21:47:16 +00:00
Maxime Coste
56c0d2de95 Fix insert completion 2013-11-18 21:45:42 +00:00
Maxime Coste
8c25d62056 extract InputHandler to input_handler.{cc,hh} 2013-11-14 21:12:59 +00: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
916a0cb52e Allow :exec mode changes to remains when keys are finished
Pass keys one by one to the input handler so that BatchUI is not needed
We can now use :exec to pre-fill the command line without validating
the command.
2013-09-11 18:58:23 +01:00
Maxime Coste
70cd671ef6 support absolute filenames in insert mode filename completion 2013-08-29 13:50:55 +01:00
Maxime Coste
535a454349 Line completion: sort and uniquify lines 2013-08-06 11:35:38 +02:00
Maxime Coste
9148b1ae92 Add line completion 2013-08-05 10:23:13 +02:00
Maxime Coste
c05f9f31dd add support for explicit insert mode completion using C-x prefix 2013-08-04 19:34:08 +02:00
Maxime Coste
0f4cecfa3e BufferCompleter refactoring, add support for explicit filename completion with c-f 2013-08-04 18:59:31 +02:00
Maxime Coste
3fe0b8e719 Move insert mode completion functions into BufferCompleter 2013-08-04 17:42:09 +02:00
Maxime Coste
6b66a3dfe5 Add support for filename insert mode completion 2013-08-02 17:58:37 +01:00
Maxime Coste
a4138201b0 Key: always pass by value 2013-07-26 01:50:36 +02:00
Maxime Coste
eedd37c09a memoryview: always pass by value 2013-07-26 01:50:36 +02:00
Maxime Coste
3862b5cbb8 LineAndColumns: always pass by value 2013-07-26 01:50:09 +02:00
Maxime Coste
38c7197770 go back to : as set/list separator in options 2013-07-24 22:41:41 +02:00
Maxime Coste
c7e52a650d DisplayLine no longer map to a single buffer line, but to a buffer range 2013-07-24 01:33:12 +02:00
Maxime Coste
ea9414fa21 Fix input completion on multiple selection 2013-06-12 00:43:11 +02:00
Maxime Coste
2a74b0e9e2 Buffer: insert and erase go back to taking iterators, and return iterators 2013-06-06 19:44:08 +02:00
Maxime Coste
6b667bc803 remove BufferIterator conversion to/from BufferCoord 2013-06-06 19:44:07 +02:00
Maxime Coste
9fb4d42408 remove BufferIterator::is_{begin,end} 2013-06-04 18:53:56 +02:00
Maxime Coste
4ef1bfa4db Use coord instead of iterators for selections 2013-06-04 14:21:07 +02:00
Maxime Coste
8ddeb141c8 Fix insert completion at beginning of buffer 2013-05-30 18:52:03 +02:00
Maxime Coste
5b0087b545 InputHandler: pass buffer and BufferCoord to completers 2013-05-30 13:59:38 +02:00
Maxime Coste
ae947b456d remove BufferIterator::offset 2013-05-30 13:59:38 +02:00
Maxime Coste
462da52218 InputHandler: less iterators, more coords 2013-05-30 13:59:38 +02:00
Maxime Coste
ad178e383b insert mode completion for all selection that matches the main one prefix 2013-05-21 19:21:55 +02:00
Maxime Coste
258637222f Word completion can optionally look for candidates in all buffers
completers option accept word=buffer or word=all values
2013-05-20 14:10:53 +02:00
Maxime Coste
f3ad51444d move line_with_cursor as LineEditor::build_display_line 2013-05-17 14:29:15 +02:00
Maxime Coste
c3d53d588d revive str_to_int so that the good exception type is thrown on error 2013-05-17 14:09:42 +02:00
Maxime Coste
26f0fd4cc6 Use more std::* for string handling 2013-05-13 18:43:38 +02:00
Maxime Coste
c1615b5c15 add unordered_set option support, use it for completers 2013-05-06 13:52:20 +02:00
Maxime Coste
42d7fcacd8 add a completers option for specifying which completer to use for BufferCompleter 2013-05-03 18:44:27 +02:00
Maxime Coste
39f9ca33c8 BufferCompleter: avoid modifying the buffer when not needed 2013-05-03 18:44:27 +02:00
Maxime Coste
7c4e79ef98 BufferCompleter: change behaviour to handle non prefix completions
Try to have a nice behaviour when the completions do not share
a prefix with the [completion begin, cursor pos] string.

For example an address book completion may provide candidates
for frrrwww that are 'Maxime Coste <frrrwww@gmail.com>', not
having frrrwww as a prefix.
2013-04-23 19:08:50 +02:00
Maxime Coste
5653af15ed move normal mode implementation to normal.{cc,hh} 2013-04-12 14:28:13 +02:00
Maxime Coste
441f9a69ef InputHandler: auto leave insert mode when editor changed 2013-04-10 14:30:32 +02:00
Maxime Coste
5adee4a6a7 rename assert to kak_assert to avoid collisions 2013-04-09 20:04:11 +02:00
Maxime Coste
34b8604f90 move context implementation to context.cc 2013-04-09 19:39:03 +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
6ffdfd7735 Add get_color helper function 2013-04-04 18:47:34 +02:00
Maxime Coste
b58f614f40 Pass a fg and bg color when displaying a menu 2013-04-04 14:04:38 +02:00
Maxime Coste
161fab13f7 complete_opt: accept an optional length in completion desciptor 2013-04-02 19:57:39 +02:00
Maxime Coste
01968cb96e String: inherit from std::string rather than using it as a backend 2013-03-29 19:35:48 +01:00
Maxime Coste
96b017f76e Minor BufferCompleter refactoring 2013-03-29 19:35:47 +01:00
Maxime Coste
dfa5318765 fix some style problems detected by cppcheck 2013-03-25 18:44:52 +01:00
Maxime Coste
3f467ba451 BufferCompleter: preserve completions when inserting
try to narrow matches with entered prefix
2013-03-20 19:11:58 +01:00
Maxime Coste
9c78f02903 BufferCompleter: fix backward looping in completion candidates 2013-03-19 14:15:42 +01:00
Maxime Coste
a981d41cde Editor: replace selections().back() with main_selection() 2013-03-15 18:22:08 +01:00
Maxime Coste
09e30c40e3 BufferCompleter: watch 'completions' option, and update completions when it changes 2013-03-12 19:23:41 +01:00
Maxime Coste
ddc894ccfe Add an experimental configurable input completion fonction
The completions option (a std::vector<String>) is used for
completions candidates, if it's first element matches the current
cursor position and buffer timestamp.
2013-03-11 14:20:28 +01:00
Maxime Coste
8cc9a44d47 minor cleanups in complete_word 2013-03-11 14:20:28 +01:00
Maxime Coste
eab2cc240a InputHandler: complete_word knows best when not to complete 2013-03-09 13:23:47 +01:00
Maxime Coste
89ba8535e2 InputHandler: extract word completion algorithm 2013-03-08 18:43:14 +01:00
Maxime Coste
09cf5acb23 Add support for boolean options 2013-03-05 19:03:42 +01:00
Maxime Coste
fac222a427 Strongly typed options support
* non builtins options require declaration using the decl command

* At the moment, only int and string options are supported, however
the goal of this change is to provide a consistent way to support
more complex options, namely lists and booleans
2013-03-05 18:49:26 +01:00
Maxime Coste
9306a89deb Fix macro recording on the same register, replace instead of appending. 2013-02-21 13:34:34 +01:00
Maxime Coste
c451dd07c6 InputHandler: do not put empty lines in history 2013-02-19 19:04:36 +01:00
Maxime Coste
a453ddaf37 Add support for Home/End key in prompts 2013-02-19 13:50:27 +01:00
Maxime Coste
b43fdc7eb6 Add macro recording/replay support 2013-02-18 18:58:07 +01:00
Maxime Coste
9936ace0db input_handler: ask dimensions to ui instead of window 2013-02-18 14:13:52 +01:00
Maxime Coste
fc2dd599a3 Move last insert state from context to input handler 2013-02-18 14:07:30 +01:00
Maxime Coste
c9b113fd5f InputHandler: add some new hooks 2013-01-30 19:04:03 +01:00
Maxime Coste
2235944e60 Add NormalIdle hook support 2013-01-29 13:58:19 +01:00
Maxime Coste
38a67e72bc Do not pass a context to InputHandler methods 2013-01-29 13:49:01 +01:00
Maxime Coste
94bbf47cd4 InputHandler have it's own context 2013-01-28 13:48:34 +01:00
Maxime Coste
9c2bbe218b replace char: fix unicode handling 2013-01-17 19:49:48 +01:00
Maxime Coste
d1f15123e4 InputHandler: minor code cleanup 2013-01-17 14:22:24 +01:00
Maxime Coste
c45838cc57 Move Insertion Hooks handing to the input handler 2013-01-17 13:58:57 +01:00
Maxime Coste
93cad94330 InputHandler: Insert mode calls 'InsertIdle' hook when idle 2013-01-15 14:15:12 +01:00
Maxime Coste
a1998dac7a InputHandler: use a timer for word completion instead of calling it at each insertion 2013-01-14 19:17:37 +01:00
Maxime Coste
d208067589 InputHandler: call callback on abort and on selected element change as well 2012-12-14 19:38:11 +01:00
Maxime Coste
92c4a9abce Prompt: when completion has only one candidate, next tab starts a new completion 2012-12-13 18:49:29 +01:00
Maxime Coste
afc8ad77e8 InputHandler: tweak prefix completion behaviour 2012-12-07 19:20:26 +01:00
Maxime Coste
b81ea0bc92 PromptHandler now call callback when edited and aborted.
Used for a new feature: incremental search
2012-12-06 13:33:26 +01:00
Maxime Coste
33482b0979 Add configurable prompt completion behaviour
If option 'complete_prefix' is non 0, then completion first
use completion candidates common prefix, then circle through
candidates.
2012-11-29 19:56:34 +01:00
Maxime Coste
7dc634444d Fix InputMode::Prompt blocking behaviour when inserting register 2012-11-29 19:03:17 +01:00
Maxime Coste
4c1b48e314 InputHandler: InputModes no longer die directly on mode change, they survive until end of on_key 2012-11-27 18:52:43 +01:00
Maxime Coste
557128b641 IncrementalInsert::move_cursors: use overloaded for LineCount/CharCount editor implementation 2012-11-26 19:38:07 +01:00
Maxime Coste
0887e1364e InputHandler: Handle C-c as Escape 2012-11-08 14:05:00 +01:00
Maxime Coste
3daac4883e Move client drawing responsiblity to the ClientManager 2012-11-05 19:58:04 +01:00
Maxime Coste
945f54daea fix crashes when cycling through menu with an active filter 2012-10-29 19:17:37 +01:00
Maxime Coste
cc876f7107 validate key in InputHandler before sending to mode, and minor refactor 2012-10-29 18:59:41 +01:00
Maxime Coste
d9729cc29e Handle all available input before redrawing 2012-10-28 09:26:54 +01:00
Maxime Coste
abf514f305 avoid utf8 errors with invalid keys, like ncurse KEY_RESIZE 2012-10-18 19:56:57 +02:00
Maxime Coste
4aa3a36102 rename Client to InputHandler 2012-10-17 13:14:03 +02:00