Commit Graph

92 Commits

Author SHA1 Message Date
Maxime Coste
79ec8d0010 Rename highlighters that used an underscore to use a dash
For example `show_matching` is now `show-matching`.
2018-07-08 19:14:15 +10:00
Maxime Coste
63d4c8c311 Change a on end of line behaviour to be consistent
`a` will just jump on next line, `a` on last end of line opens a new
line beneath it.

Fixes #1164
2018-07-05 08:00:14 +10:00
Maxime Coste
2e0e206951 Make recurse regex opt-in with a -recurse switch instead of opt-out 2018-07-05 07:54:28 +10:00
Maxime Coste
f61bcef469 Fix tests and required scripts to get back to green make test 2018-07-05 07:54:28 +10:00
Maxime Coste
124a5d4905 Tolerate restoring invalid coordinates from register
Clamp those selection after updating them to the current timestamp

Fixes #2078
2018-07-05 07:54:28 +10:00
Maxime Coste
9387abed81 tests: Update selections files to match the new selection list syntax 2018-07-05 07:54:28 +10:00
Maxime Coste
667777521b Refactor the way main selection is determined after rotating contents
Fixes #2133
2018-06-21 08:07:17 +10:00
Maxime Coste
6dca67c674 Fix two <s-tab> requiered to access last completion in prompt
A single <s-tab> should be enough.
2018-06-19 07:40:52 +10:00
Maxime Coste
9b89652b0b Fix potential assert on itersel selection restoration
We cannot guarantee after an itersel that selections are going to
still be in ascending order, but we were calling a SelectionList
constructor that was assuming this was the case.
2018-05-24 08:08:51 +10:00
Maxime Coste
878d2a4bdb Add regression test for crash on BufSetOption hook 2018-05-21 20:36:25 +10:00
Maxime Coste
c9a8658671 Fix assert with window small enough so that no part of buffer is displayed
Fixes #2056
2018-05-19 14:15:16 +10:00
Maxime Coste
851494a374 test/run: Rename "display" expected ui output file as "ui-out" 2018-05-19 14:15:16 +10:00
Maxime Coste
148d6c205b Fix wrong behaviour in select surrounding
Fixes #2030
2018-05-07 22:17:57 +10:00
Maxime Coste
e4f90e5ed2 Fix tests after changes to json_ui output 2018-04-29 23:06:24 +10:00
Delapouite
746b9acb96 Change client default name: "unnamed0" → "client0" 2018-04-23 11:42:11 +02:00
Maxime Coste
3d3a37a80c Fix 'O' not putting the cursor on the correct line 2018-03-27 07:28:25 +11:00
Maxime Coste
59e9108812 indent selector: When line is empty, find indent from surrounding lines
Look for the first non empty line preceeding the current line, or
if not found, the first non empty line following it.

Fixes #1904
2018-03-25 10:25:56 +11:00
Maxime Coste
ac91a79b12 Fix implementation of real_path to handle non-existing directories in /
Fixes #1937
2018-03-18 23:23:00 +11:00
Maxime Coste
7ba4ef897b Fix crash on expanding command line strings 2018-03-18 04:58:15 +11:00
Maxime Coste
e66073bc94 Detect infinit recursion in reference highlighting
Reference highlighters allow for potential mutual recursion between
highlighters. This is usually fine, but if the recursion happens on
the same buffer range, it means we will recurse infinitely.

Fixes #1920
2018-03-11 11:44:10 +11:00
Maxime Coste
31a5649c65 Add a regression test for issue #1902 2018-03-05 05:48:20 +11:00
Maxime Coste
65258934d3 lua.kak: Rework 'end' auto insertion logic
Fixes #1525
2018-03-04 10:36:32 +11:00
Maxime Coste
2fd42fe5fc Insert: Do not move end of line on open line (o/O)
Change the logic of open line commands so that if a selection lies
on the end of line character of the line from which we open a new
line, that selection does not move.

If we have two clients, A and B, with B's cursor on the eol character
of line L, and A hits `o` while on line L, B's cursor should stay
on the same (logical) line. Previous behaviour would make B's cursor
jump on the newly inserted line.
2018-03-04 10:32:21 +11:00
Maxime Coste
67424aae1e Remove avoidance of end of lines
Various places in Kakoune code used to modify selections so that
cursors would not lie on an end of line. Remove those to increase
Kakoune's consistency and simplicity.

Now that end of lines are highlighted separately, they should not
be handled specially in most commands.
2018-02-25 00:05:05 +11:00
Maxime Coste
6a6e71dc0f Highlight cursors differently when they lie on an end of line
When on an end of line, certain behaviours can be surprising, for
example delete will join the following line (which makes sense, and
is consistent, but hard to predict if we do not know the cursor is
on and end of line).

As Kakoune is moving more and more towards treating end of lines
as any other character, making it clear when the cursor lies on
them seems like a good way to reduce surprise.
2018-02-24 21:32:01 +11:00
Maxime Coste
e2c1d44a7f Fix parsing of percent tokens with unicode separators 2018-02-06 20:29:08 +11:00
Maxime Coste
05f57ace07 CommandManager: parse command lines as utf8 instead of ascii
Fixes #1829
2018-02-04 09:21:15 +11:00
Maxime Coste
cafecda230 Window: avoid positionning window on a negative column
Fixes #1741
2017-12-15 08:17:35 +11:00
Maxime Coste
380ff553b5 Wrap: try to rework and simplify the algorithms further
Fixes #1731
2017-11-28 19:04:21 +08:00
Maxime Coste
0942cd5084 InputHandler: handle of last insert keys happening in nested modes
Move recording of keys to the input handler itself instead of the
Insert mode so that eventual nested modes (potentially introduced
by <a-;> will get their keys recorded as well).

Fixes #1680
2017-11-08 14:39:52 +08: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
Maxime Coste
d49555fc75 Move highlighters into Scopes
That means we can now have highlighters active at global, buffer, and
window scope. The add-highlighter and remove-highlighter syntax changed
to take the parent path (scope/group/...) as a mandatory argument,
superseeding the previous -group switch.
2017-10-28 13:43:04 +08:00
Maxime Coste
0da5cabbfe Distinguish between modes being disabled temporarily and definitely
That way, insert mode knows when it can restore selections/avoid eol
instead of (wrongly) doing it in the destructor that ends up running
unpredictibly (as the mode is kept alive during its on_key call, even
though it can happen that it is not the active mode anymore at the end
of that call).

Fixes #1580
2017-09-28 11:11:29 +08:00
Maxime Coste
e53cb356a7 Fix regression test #1435 after a change in the insert modeline format 2017-09-28 10:44:54 +08:00
Maxime Coste
fc64369f9d Purge history on buffer reload when NoUndo flag is on
We were preserving the history in that case, so on fifo buffers
(that set the NoUndo flag until the fifo is closed), we still had
the history from the "previous life" of the buffer, leading crashes
when trying to apply it.

Fixes #1518
2017-08-04 11:39:28 +07:00
Maxime Coste
8650c99f13 Fix assertion when replacing with empty strings
Replacing with empty strings is essentially a deletion, which means
it can end up push some selections out of the buffer (imagine 3 a
2 empty line buffer, and deleting the second one). We are fixing
the selections in SelectionList::erase, but we were not doing that
in SelectionList::insert.

Fixes #1504
2017-07-14 13:08:29 +09:00
Maxime Coste
53f5b3d709 Fix an assert in compute modified ranges when merging single char ranges
Due to the way Selection::min/max worked, we were creating backward
selections, with cursor < anchor, which was triggering an assert when
trying to move cursor back one char when it was already on the first
char of the buffer.
2017-07-14 12:42:43 +09:00
Maxime Coste
641acc5943 Do not allow repeating last insert when we are not in normal mode
<a-;>. is not accepted anymore. Note that <a-;> are not repeatable
currently anyway (That could be fixed, athough not trivial).
Fixes #1469
2017-06-27 09:57:10 +01:00
Maxime Coste
ce8078ad73 Ensure cursor stays visible with wrapped line bigger than window
Fixes #1459
2017-06-27 09:29:25 +01:00
Maxime Coste
475e8849a1 Fix replacing last eol with a single eol 2017-06-26 16:16:46 +01:00
Tomasz Kramkowski
bd65719698 Correctly handle tabs when show_whitespaces is added
Tabs now align to tab stops instead of always spanning 8 spaces when
show_whitespaces is added as a highlighter.

This fixes issue #1453.

A regression test is also provided.
2017-06-17 11:46:39 +01:00
Maxime Coste
01a1e92b79 Fix crash recently introduced when deleting at buffer start in insert mode 2017-06-15 17:35:48 +01:00
Maxime Coste
724b4198b0 Change window display to not use invalid buffer coordinates
Fixes #1435
2017-06-15 16:48:16 +01:00
Maxime Coste
40f845d77e Respect scroll offset even when wrapping lines
Fixes #1433 although in a slightly different way than requested:
We ensure that scrolloff *displayed* lines are visible below the
cursor, not scrolloff *buffer* lines.
2017-06-15 12:29:34 +01:00
Maxime Coste
7bcfbd055c Fix corner case in compute_modified_ranges 2017-06-11 12:25:12 +01:00
Maxime Coste
b4647a16dd Remove backup file from git 2017-06-09 21:30:40 +01:00
Maxime Coste
7b9d8d39b1 Simplify column highlighter and make it more robust
Fixes #1382
2017-06-09 15:24:07 +01:00
Maxime Coste
f014eb7052 Fix command parsing bug when commenting after a command
When a comment was present directly on the same line after a command,
we did not correctly see the command as terminated and would join
continue parsing the next line.
2017-05-25 08:30:49 +01:00
Maxime Coste
e722868c60 Fix generation of empty erase changes
Fixes #1308
2017-04-20 17:31:27 +01:00
Maxime Coste
dbcddafbfd Change utf8::to_next/to_previous so that they are more symetrical
The previous implementation could yield different positions when
iterating forward and backward, leading to confusion in boost regex.

This makes an existing problem a bit more visible: iterating with
to_next and with read_codepoint wont behave the same way, as
read_codepoint will put the iterator onto the byte following the
utf8 codepoint, whereas to_next will put it on the next utf8
character start byte, which might be different if the buffer content
is not valid utf8.

Fixes #1195
2017-04-20 16:18:49 +01:00