Commit Graph

475 Commits

Author SHA1 Message Date
Delapouite
6b447a0ecb Add declare-user-mode / enter-user-mode commands 2018-02-12 14:19:58 +01:00
Maxime Coste
e46a5697e5 Add a limit to the size of selection with which we will try to diff on pipe
Limit to 100K of data for now, as we diff at the byte level.
2018-02-09 21:47:18 +11:00
Maxime Coste
81eb2ee428 Do not strip whitespaces with '*'
Stripping whitespaces there is a failed experiment as it breaks the
ability to use multi-selections consistently: Using '*' followed by some
`N` to add following matches, we end up with mismatched selections
due to whitespace stripping the original selection still contains
whitespaces where all the new ones do not. Once we get to this state,
most selection commands will give different results for the initial
selection and the other ones, breaking predictible multiselection use,
one of the cornerstones of Kakoune editing model.
2018-01-31 09:31:18 +11:00
Maxime Coste
9c25e955df Use '/' register as the default register for <a-k> and <a-K>
Fixes #1808
2018-01-26 14:15:18 +11:00
Maxime Coste
220be30f02 Support multiline selections in C/<a-C>
Fixes #1725
2018-01-24 10:33:22 +11:00
Maxime Coste
55621fb4cc Do not save last command/pipe/regex in register when history is disabled 2018-01-19 09:48:57 +11:00
Maxime Coste
e74b581b0a Save/restore main selection from/to strings
Always consider that the first selection in the list is the main
one, save selections that way.

This approach was suggested by PR #1786 but the implementation here
is different, and is used more generally whenever we save selections
to strings.

This is also the prefered way to work only on the main selection:
save selections with Z, reduce to main with <space>, restore with z.

Closes #1786
Fixes #1750
2018-01-12 07:51:19 +11:00
Maxime Coste
6333ae207f Correctly set the NotBeginOfSubject/NotEndOfSubject flags for regex matching
Fixes #1778
2017-12-29 09:55:53 +11:00
Delapouite
b81c6b5840 Use existing window reference in view mode 2017-12-17 14:42:09 +01:00
Maxime Coste
99636c6230 Remove Vector returning split functions, use range adaptor
Do not allocate temporary vectors to store splitted data, use the
'split' range adaptor along with transform(unescape) to provide the
same feature with less allocations.
2017-12-06 17:18:44 +08:00
Maxime Coste
73a239d3be Text-Objects: Use regex to select surroundings
Fixes #925
2017-12-03 17:15:24 +08:00
Maxime Coste
413f880e9e Regex: Support forward and backward matching code in the same CompiledRegex
No need to have two separate regexes to handle forward and backward
matching, just passing RegexCompileFlags::Backward will add support
for backward matching to the regex. For backward only regex, pass
RegexCompileFlags::NoForward as well to disable generation of
forward matching code.
2017-12-01 19:57:02 +08:00
fsub
66ca53466f Remove unused lambda captures
This eliminates some warnings emitted by clang++.
2017-11-22 18:43:54 +01:00
Maxime Coste
706c1672d5 Normal: add <a-S> to select first and last char of selection
Fixes #550
2017-11-13 17:36:04 +08:00
Delapouite
a071e5b226 Add count support to jumps (<c-o> and <c-i>). Add jumps tests 2017-11-13 08:38:43 +01:00
Maxime Coste
04993de687 Fix pipe logic in the case where the selections were accessed in the cmdline
When using an env var that needed the selections in the pipe command line,
say $kak_selection, the selection update code would run, modifying the
selections to adapt to eventual changes. But the rest of the pipe logic
was assuming the selections would not change, leading to bugs.
2017-11-08 00:02:49 +08:00
Frank LENORMAND
8900690288 src: Don't save whitespace-led commands in the : register 2017-11-04 09:18:26 +03:00
Maxime Coste
1c95074657 Make use of custom regex backward searching support for reverse search 2017-11-01 14:05:14 +08:00
Maxime Coste
065bbc8f59 Regex: switch to custom impl, use boost for checking 2017-11-01 14:05:14 +08:00
Maxime Coste
6272847ace Prompt: display the fallback text everytime the prompt is empty 2017-10-31 12:54:21 +11:00
Maxime Coste
6d78b06405 Do not auto apply the fallback regex when in regex prompts
Fixes #1653
2017-10-30 18:58:47 +11:00
Maxime Coste
9a449a3344 Display the fallback value in prompts
Fixes #1654
2017-10-28 10:07:28 +08:00
Maxime Coste
d6cb10d693 Disable constexpr keymap as it breaks compilation with gcc 5 2017-10-20 19:12:21 +08:00
Maxime Coste
7c06667bdf Make the normal mode keymap a compile time hash map
This hash map is now fully constexpr, and ends up stored in the read
only data segment instead of being recomputed at each startup.
2017-10-20 12:21:22 +08:00
Maxime Coste
ddff35e5ab Move keymap as an implementation detail of the normal mode keys
Only expose a free function that tries to get the NormalCmd from a
key.
2017-10-20 12:21:22 +08:00
Delapouite
0e62518d89 Docs: add missing normal keys <c-[bfud]> 2017-10-04 12:47:56 +02:00
Maxime Coste
100be4b836 Merge remote-tracking branch 'Delapouite/runtime-error' 2017-09-28 10:39:44 +08:00
Delapouite
7224fe3840 Convert status info into proper runtime_errors 2017-09-27 17:53:52 +02:00
Delapouite
6b339b7a97 Add status info when navigating through jumplist (<c-o>, <c-i>) 2017-09-27 17:26:39 +02:00
Maxime Coste
626ccc09cc Merge remote-tracking branch 'Delapouite/next-history-id' 2017-09-23 13:18:58 +09:00
Maxime Coste
3a5bb051a8 Small code style tweak 2017-09-23 13:18:00 +09:00
Maxime Coste
002e77534f Merge remote-tracking branch 'occivink/quit-on-esc' 2017-09-23 13:13:51 +09:00
Delapouite
0b310b64ad Add count support for indent / deindent 2017-09-21 12:26:22 +02:00
Olivier Perret
a20ecf6b00 Use <esc> to exit on-key modes 2017-09-21 11:53:10 +02:00
Delapouite
b46c9ac630 Add max_history_id in status printed with <a-u> and <a-U> 2017-09-20 07:32:45 +02:00
Maxime Coste
a3644f49a3 Merge remote-tracking branch 'Delapouite/custom-text-object' 2017-09-18 10:05:51 +09:00
Delapouite
e52003049c Add count support for scroll keys (PageUp, PageDown, C-bfud) 2017-09-17 19:55:06 +02:00
Maxime Coste
ab6a999431 Rename containers.hh to ranges.hh (and Container to Range) 2017-08-29 15:23:03 +07:00
Maxime Coste
1709886873 avoid literal eol in status lines, replace them with another symbol 2017-08-29 10:01:43 +07:00
Maxime Coste
82d23bc400 Remove now trivial Selection::merge_with method 2017-08-18 08:52:40 +07:00
Maxime Coste
d3f438810e Fix main selection handling in keep pipe ($)
$kak_reg_hash will properly contain the current selection index when
executing the shell command, fixing its use.

Fixes #1503
2017-07-19 17:42:41 +02:00
Maxime Coste
580eae0388 | now applies the diff of the modification instead of plain replace
Fixes #312
Fixes #1501
2017-07-14 16:16:40 +09:00
Maxime Coste
26cc8b3ee0 Fix undo handling in <a-o>/<a-O> 2017-07-13 08:24:55 +09:00
Maxime Coste
74076ef9b7 Alternative, and hopefully safer implementation of <a-o>/<a-O>
Fixes #1495
2017-07-11 22:35:42 +09:00
Maxime Coste
81b5de6fd8 Add <a-c> and <a-d> for changing/deleting without yanking
As asked for in #1175
2017-07-11 22:25:15 +09:00
Maxime Coste
b575067317 Add <a-o> and <a-O> to add lines below/above selections
Fixes #1480
2017-07-11 09:03:45 +09:00
Delapouite
f917402f89 Docs: add missing <a-R> key and fix info message 2017-07-09 12:00:28 +02:00
Delapouite
b3f2a7e46e Refine info titles to distinguish f/t (select) and F/T (extend) 2017-07-05 20:23:02 +02:00
Maxime Coste
e95fab0e7a Code style tweak 2017-06-29 07:36:07 +01:00
Maxime Coste
14958a7c94 Validating an empty command in prompt reruns the last command
This is more consistent with other prompts like regexes or shells,
and has proven useful from time to time.
2017-06-29 07:33:16 +01:00
Maxime Coste
9bbab690ba Merge remote-tracking branch 'danr/Expose-last-entered-command-in-register' 2017-06-29 07:29:32 +01:00
Maxime Coste
dc378aed72 Pass a context instead of just the buffer to selector functions 2017-06-26 14:56:50 +01:00
Maxime Coste
42d7b66b92 Support hitting escape to cancel a selection combine operation
Fixes #1443
2017-06-16 10:23:03 +01:00
Delapouite
229848dece Change custom text object desc trigger from ':' to 'c' - Fix #1362 2017-06-14 19:41:30 +02:00
Maxime Coste
609b0bbbac Merge remote-tracking branch 'Delapouite/rotate-forward' 2017-06-08 07:14:20 +01:00
Delapouite
86cc66577b Clarify rotation direction between <'> and <a-'> in info help 2017-06-07 08:53:33 +02:00
Maxime Coste
fd00e1f9ae Merge remote-tracking branch 'Delapouite/underscore' 2017-06-07 07:48:57 +01:00
Delapouite
2f84051efb Add underscore char as a valid punctuation for text-object pairs 2017-06-06 12:04:53 +02:00
Delapouite
b4af4994fb Remember previous NormalParams::count in view-lock mode 2017-06-06 09:52:02 +02:00
Maxime Coste
c1e4b4ff79 Strip surrounding whitespaces in *
Fixes #1406
2017-06-03 18:16:40 +01:00
Maxime Coste
c440bbde81 Merge remote-tracking branch 'Delapouite/shift-modes' 2017-06-03 14:45:48 +01:00
Maxime Coste
0e88a9695a Add support for more selection combining operations
Change append to 'a', add select longest/shortest, union and
intersection.
2017-06-03 13:45:59 +01:00
Delapouite
e8707298c1 Refine info titles to distinguish G and V modes 2017-05-31 19:57:56 +02:00
Maxime Coste
e97f23f2be Use more precise wording for object selection info box 2017-05-27 09:29:51 +01:00
Dan Rosén
b1735ae76e Expose last entered command in register : 2017-05-25 21:48:41 +02:00
Maxime Coste
7ee3039a79 Do not avoid eol in insert mode vertical movement 2017-05-22 17:04:01 +01:00
Maxime Coste
b440d9f537 Change <a-z>/<a-Z> to combine selections instead of appending 2017-05-20 10:31:49 +01:00
Maxime Coste
973487abcd Small reorganization in the normal keymap 2017-05-18 06:05:45 +01:00
Maxime Coste
5ee21ec932 Respect tabstop in Buffer::offset_coord 2017-05-07 16:26:14 +01:00
Maxime Coste
93408e4b76 Do not use any display information to determine where the cursor moves 2017-05-07 16:26:14 +01:00
Maxime Coste
80f1056851 Support appending selections to empty register
Fixes #1332
2017-04-25 17:25:44 +01:00
Maxime Coste
8b1078e510 Use a HashMap to store the normal mode keymap 2017-03-16 23:40:38 +00:00
Maxime Coste
e44f95820e Fixes some clang-tidy warning and add a few missing meta.hh include 2017-03-16 23:34:02 +00:00
Maxime Coste
db9b863222 Migrate WithBitOps template specialization to with_bit_ops function
This way we dont depend on knowing the base template to enable bit ops
on an enum type.
2017-03-15 18:00:58 +00:00
Maxime Coste
f8a625bc2f Merge remote-tracking branch 'occivink/master' 2017-03-03 21:13:16 +00:00
Maxime Coste
ddc5e958e6 Return an optional selection in most selectors, fail rather than keep current
Instead of returning the current selection when a selector fails, return
an empty Optional<Selection>. That means object selections will now
remove the selections that dont match the object.
2017-03-03 20:17:11 +00:00
Maxime Coste
6759511b9e Ensure main selection index is correct directly in SelectionList::remove 2017-03-03 20:17:11 +00:00
Maxime Coste
8a1e5d12ac Make <a-space> throw on invalid index or last selection 2017-03-03 20:17:11 +00:00
Maxime Coste
e3cfde6d07 Add docstring support for mappings, and use them in autoinfo
Fixes #105
Fixes #1100
Closes #1165
2017-03-03 20:16:36 +00:00
Olivier Perret
033b259e5b <space>, <a-space>: throw on invalid preconditions 2017-03-03 13:50:00 +01:00
Maxime Coste
d470bd2cc9 Make numeric registers setable
Fixes #1214
2017-02-14 00:02:01 +00:00
Maxime Coste
bc0dfa9e8f Use <a-'> for backward rotate selection and move rotate content to <a-"> 2017-02-01 22:53:42 +00:00
Maxime Coste
65bbc19d6f Change n behaviour to only select next match for main selection
Select next match for all selections is still available as /<ret>
Fixes #1173
2017-02-01 20:00:05 +00:00
Maxime Coste
bbbb513990 Fix crash when clearing a regex prompt with multiple selections
Fixes #1124
2017-01-24 19:18:29 +00:00
Maxime Coste
7ba24c043a Add gi to go to first non-blank character on line
Fixes #407
2017-01-22 23:53:08 +00:00
Maxime Coste
7316afd17b Use ints instead of unsigned for capture count 2017-01-16 18:49:27 +00:00
Maxime Coste
c24a636cb9 Fix regex search/select not restoring initial selections on abort
And incrementally set the search register for select/split as well
2017-01-16 13:57:14 +00:00
Maxime Coste
8c55acb076 Detect empty selection lists when restoring selections from registers
Fixes #1123
2017-01-11 13:43:41 +00:00
Maxime Coste
dcd8f6ef01 Apply clang-tidy modernize to the codebase 2017-01-08 22:39:01 +00:00
Maxime Coste
4295736c97 Fix handling of main selection when copying selection to next/previous lines
Fixes #1095
2017-01-03 18:41:45 +00:00
Maxime Coste
ac1192f58a Ensure <esc> cancels in replace with char
After recent changes that associated <esc> with the 0x1b codepoint
r<esc> would replace each char with 0x1b instead of canceling the
replace command.
2017-01-02 04:03:02 +00:00
Maxime Coste
3c1f606a22 Move some template code out of selectors.hh into selectors.cc 2017-01-01 19:30:02 +00:00
Maxime Coste
cdb2c766a5 Refactor SelectionList::insert a bit 2017-01-01 17:31:47 +00:00
Maxime Coste
968e573d80 Slight code refactor for paste handling 2017-01-01 12:58:04 +00:00
Maxime Coste
25451ac112 Set the register incrementally as well during incremental search
Fixes #1054
2016-12-23 20:46:50 +00:00
Maxime Coste
d17bed9b80 Display the command prompt in error face when the command is not found
Fixes #1021
2016-12-23 16:23:31 +00:00
Maxime Coste
9ad1c19f69 Validate user text object desc more thorougly
Fixes #992
Fixes #993
Fixes #994
2016-12-15 09:29:38 +00:00
Maxime Coste
2fd1414b05 Clean up includes of user_interface.hh 2016-11-29 19:53:11 +00:00
Maxime Coste
da6d7f4530 Always consider end of selection is not and eol for keep
Fixes #921
2016-11-28 21:07:24 +00:00
Maxime Coste
b3ba769220 Propagate the hooks disabled state through prompt, menu, and command execution
Maintain it as well during buffer creation even if the hooks are not executed
in client context.

Fixes #818
2016-11-14 19:39:35 +00:00