Commit Graph

237 Commits

Author SHA1 Message Date
Maxime Coste
1af82e2e24 Tweak regex constructor calls 2015-07-25 11:15:03 +01:00
Maxime Coste
883a14e853 Do not allow exiting insert mode while running InsertEnd hook.
Fixes #311
2015-07-08 13:53:19 +01:00
xificurC
fbb216d2ed commands starting with horizontal whitespace don't go into the history 2015-06-30 16:06:49 +02:00
Maxime Coste
3fb783f7f9 Add <a-;> in insert mode to execute a single normal mode command 2015-06-12 13:56:11 +01:00
Maxime Coste
f39b450e94 on_enabled might change mode, so assert Normal mode before 2015-06-04 13:56:08 +01:00
Maxime Coste
f0886ad323 Get rid of the mode trash, delete mode directly when leaving on_key 2015-06-03 20:03:06 +01:00
Maxime Coste
964b0e9a6e InputHandler now uses a stack for active modes
instead of having a single mode enabled, modes can be pushed/poped,
with the top of the stack being the active mode.
2015-06-02 20:56:57 +01:00
Maxime Coste
8f6fc6a0f3 Port even more code to use format function 2015-06-01 21:15:59 +01:00
Maxime Coste
bbefde9379 Move Colors enum class as NamedColor enum inside Color struct 2015-04-25 10:47:39 +01:00
Maxime Coste
1dfa2d7fe4 Avoid unneeded update of selections when we are going to overwrite them 2015-04-19 15:12:16 +01:00
Maxime Coste
bf02838816 Remove is_blank, which is identical to is_horizontal_blank 2015-04-15 00:34:00 +01:00
Maxime Coste
195b813b73 Add support for Home/End keys in normal and insert mode
Fixes #260
2015-03-27 13:33:14 +00:00
Maxime Coste
323b0359c7 Add support for mouse wheel 2015-03-22 12:17:01 +00:00
Maxime Coste
5eaf472fc0 Experimental support for mouse 2015-03-22 11:41:20 +00:00
Maxime Coste
def33de9bc Check modifiers before inserting codepoints in the line editor 2015-03-22 11:41:19 +00:00
Maxime Coste
3921b234e7 Store fake keystrokes when selecting an insert completion candidate
Instead of storing the real 'select next completion' keystroke,
generate fake backspace/delete/char keystrokes so that replay
of the insert will insert the exact same text.

Fixes #135
2015-03-15 18:44:11 +00:00
Maxime Coste
adcb72e987 Minor code cleanup 2015-03-14 11:11:01 +00:00
Maxime Coste
1a7d50b347 Minor cleanup 2015-03-12 20:40:00 +00:00
Maxime Coste
3c1a325b6f Refactor String, use a common StringOps interface, hide std::string 2015-03-10 19:50:22 +00:00
Maxime Coste
1cec8df45e ArrayView content is not const anymore
As in upcoming std c++ array_view, ArrayView<T> points to mutable
data, use ArrayView<const T> or alias ConstArrayView<T> for const
data.
2015-03-09 13:54:09 +00:00
Maxime Coste
0bbaef6e48 Use a sorted array for keymap rather than an unordered map
with ~100 entry, a binary search finds in < 7 step, unordered map
is overkill.
2015-03-08 11:40:50 +00:00
Maxime Coste
c0e4268e17 Reactivate direct file change check on entering normal mode 2015-03-04 20:46:26 +00:00
Maxime Coste
8c843f5bea Add <a-h>, <a-l>, <a-x> and <a-d> bindings to line editor
<a-h> : move cursor left
<a-l> : move cursor right
<a-x> : delete char before cursor
<a-d> : delete char under cursor
2015-02-13 19:13:44 +00:00
Maxime Coste
224f73d72a Cleanup and refactor externally modified buffer reloading
* Correctly hide the reload dialog in every client.
* Correctly handle buffer being deleted.
2015-02-12 19:18:03 +00:00
Maxime Coste
ffff4711c5 Add history memory domain 2015-01-28 22:33:29 +00:00
Maxime Coste
da562e03a0 replace all std::vector with Vector 2015-01-12 13:58:41 +00:00
Maxime Coste
295a97f2a6 Rename memoryview to ArrayView 2015-01-06 13:43:37 +00:00
Maxime Coste
e911c86306 Remove useless code 2014-12-22 20:08:30 +00:00
Maxime Coste
116ea7364a Restore some special behaviours, I missed them in interactive mode. 2014-12-19 13:58:33 +00:00
Maxime Coste
1c8ee78d1a Do not register timers for transient input handlers 2014-12-18 23:12:58 +00:00
Maxime Coste
ebecd60eb8 Rework hashing, use a more extensible framework similar to n3876 proposal
std::hash specialization is a pain to work with, stop using that, and
just specialize a 'size_t hash_value(const T&)' free function.
2014-12-16 18:57:19 +00:00
Maxime Coste
2c4ed3a78c Do not avoid eol on escape 2014-12-11 19:36:20 +00:00
Maxime Coste
d57be83522 Disable history writing when running hooks 2014-12-05 14:01:07 +00:00
Maxime Coste
1c5975835e Consolidate constext disablable feature in a 'Disableable' helper 2014-12-05 13:47:09 +00:00
Maxime Coste
77e2e8a31e Support selecting yank/paste register with " 2014-11-28 13:58:36 +00:00
Maxime Coste
35b89d5b87 Display selection count in insert mode line 2014-11-24 13:26:42 +00:00
Maxime Coste
88def85d77 Do not merge overlapping selections in InputMode::Replace
Fixes #237
2014-11-22 21:20:29 +00:00
Maxime Coste
f56b6ed75b Do not record keys that were not user generated 2014-11-21 19:00:34 +00:00
Maxime Coste
3f733569ed Fix case where a context ends up locked in no-hooks mode 2014-11-12 20:31:12 +00:00
Maxime Coste
f6e9018bf0 Reduce idle timeout to 50 milliseconds 2014-11-11 23:32:52 +00:00
Maxime Coste
88aa707b9c For {Menu,Info}Style::Prompt, choose the anchor directly in ncurses code 2014-11-08 19:08:23 +00:00
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