Commit Graph

145 Commits

Author SHA1 Message Date
Maxime Coste
d3be78cca2 Only commit undo groups when buffer was modified
This fixes an interaction with kak-lsp that would trigger undo group
commit when setting a buffer option value.
2018-09-12 20:02:57 +10:00
Jason Felice
83244af106 Don't skip opening brace twice when finding closing
Fixes #2367
Fixes #2129
2018-09-09 10:15:41 -04:00
Maxime Coste
d23ac09fc1 Add support for <a-;> in prompt mode
Fixes #2096
Closes #2060
2018-07-15 11:17:16 +10:00
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
Maxime Coste
bee2180da7 Do not try to split non range atoms in column highlighter
That means we wont have a very nice interaction between show_whitespaces
and column highlighters, but thats the simplest fix for now, if we want
a better behaviour we need to introduce a way to know that a replaced
range is splittable (meaning it means to have the same amount of columns
as the range it replaces)

Fixes #1275
2017-04-19 21:15:36 +01:00
Maxime Coste
7482d117cc Fix tests after addition of the set_cursor UI method 2017-04-12 10:48:52 +01:00
Maxime Coste
2cc1333f6b Add regression test for #1105
Fixes #1105
2017-03-15 11:47:10 +00:00
Dan Rosén
5a403a9611 Increase modelinefmt configuration power 2017-03-11 21:43:51 +01:00
Maxime Coste
1728c67fef Fix indent selection respect for original selection cursor position
Fixes #1233
2017-03-03 22:03:20 +00:00
Frank LENORMAND
58cad9aecf test: Fix UTF8 compliant locale detection 2017-02-23 18:46:56 +03:00
Maxime Coste
5eef2b9105 Correctly handle mutation of the watcher list while iterating on them
Fixes #1227
2017-02-20 13:50:30 +00:00
Maxime Coste
4916ea1766 Fix capture group handling
Fixes #1129
2017-01-13 00:17:31 +00:00
Maxime Coste
b157a481e1 Add 1118 regression test case 2017-01-11 22:13:05 +00:00
Maxime Coste
be48cffa22 Fix 1074 test case with recent indent change 2017-01-11 14:00:17 +00:00
Maxime Coste
343df600cb Merge remote-tracking branch 'alexherbo2/command-names' 2017-01-10 13:44:11 +00:00
Maxime Coste
0fad62d6b1 Add regression test case for #1111 2017-01-06 19:55:50 +00:00
Alex Leferry 2
671b50bb52 update command names 2017-01-04 13:04:27 +01:00
Maxime Coste
c3e1bab9d6 Fix comment autoinsert for c-family as well.
Fixes #1074
2017-01-02 12:05:49 +00:00
Maxime Coste
17660fe5bb Add a regression test for #1051 2017-01-01 18:30:48 +00:00
Maxime Coste
cd89531bd9 Better handling of linewise inserting when we have multiple selections per line
Fixes #1053
2017-01-01 18:08:43 +00:00
Maxime Coste
2bdd361948 Escape the backslash chars as well when joining strings
Fixes #1014
2016-12-17 05:48:42 +00:00
Maxime Coste
01417471b9 Change the test session name to avoid hitting the unix socket path length limit
On travis-ci, it seems the combination of a set TMPDIR and long sessions names
makes the test framework hit the path lenght limit.
2016-12-16 19:49:39 +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
da6d7f4530 Always consider end of selection is not and eol for keep
Fixes #921
2016-11-28 21:07:24 +00:00
Maxime Coste
90de54af2f Rework c-family /* */ comments auto insertion of prefix star
Fixes #918
2016-11-14 21:11:20 +00:00
Maxime Coste
68d04af1a9 Remove sourcing of formatter.kak from the 872 regression test 2016-10-17 18:29:58 +01:00
Maxime Coste
cf5bcdf1bb Merge remote-tracking branch 'lenormf/fix-formatcmd' 2016-10-17 18:28:57 +01:00
Maxime Coste
1431dcff46 Fix bug in c-family indentation logic after visibility labels
Fixes #872
2016-10-16 19:27:53 +01:00
Frank LENORMAND
617a5b72e2 Remove a script loaded in a test that's not required anymore 2016-10-15 13:36:19 +03:00
Maxime Coste
5af29b0254 Fix python comment copy logic in python.kak
And introduce the first unit test that sources bundled support
scripts.

Fixes #860
2016-10-13 20:13:05 +01:00
Maxime Coste
9078039326 Fix select_to_previous_word with spaces at buffer start
Fixes #844
2016-10-05 23:42:36 +01:00
Maxime Coste
35559b65dd Support codepoints of variable width
Add a ColumnCount type and use it in place of CharCount whenever
more appropriate, take column size of codepoints into account for
vertical movements and docstring wrapping.

Fixes #811
2016-10-01 13:45:00 +01:00
Maxime Coste
fafde8655b Fix select_to_reverse to correctly handle the first character of the buffer
Fixes #809
2016-09-19 09:20:55 +01:00
Maxime Coste
4fc20b8d7d Rework client quitting and handling of remote errors
Client quitting no longer immediately unwinds, client is just pushed
for deletion until we get back to the main loop, similarly to what
happens for buffer and window deletion.
2016-09-04 17:56:07 +01:00
Maxime Coste
4d13e6fb88 Do not crash whenever S matches the whole selection and hence does not select anything
Fixes #787
2016-09-04 11:17:34 +01:00
Maxime Coste
623fcd88ea Do not avoid end of lines after selecting modified ranges in undo
Fixes #751
2016-07-27 23:53:16 +01:00
Maxime Coste
13ed87410f Rework compute_modified_ranges
Fixes #743
2016-07-26 23:31:23 +01:00
Maxime Coste
52d3b60aaa Clamp selection generated in selection_list_from_string
Fixes #733
2016-07-13 19:25:32 +01:00
Maxime Coste
e288d84408 Add a regression test for #704
Fixes #704
2016-07-11 19:46:50 +01:00
Maxime Coste
532ae5a1a6 Do not go backward to when selecting to end of line from the end of line
Fixes #699
2016-06-22 19:56:40 +01:00
Maxime Coste
dd41a46c4c Correctly set c++ locale on startup
Fixes #595
2016-05-10 22:06:02 +01:00
Maxime Coste
abac6a9436 Use boost::wregex implementation and manually utf8 decode into it
That way we get proper unicode support in regular expressions as long
as the current locale treats wchar_t as unicode codepoints.

Fixes #638
Fixes #595
Fixes #162
2016-05-10 09:38:21 +01:00
Maxime Coste
b0060ed79e Fix modified range computation when erasing multiple times past current buffer end
Fixes #654
2016-04-13 21:21:00 +01:00
Maxime Coste
5332378419 Fix spaces_to_tabs implementation accessing past end
Fixes #643
2016-03-30 19:27:36 +01:00
Maxime Coste
de1433d30a Avoid the spurious newline insertion when replacing at end of buffer
Add a Buffer::replace method to handle the replacements properly
Fixes #633
2016-03-16 13:48:11 +00:00
Maxime Coste
f16bb36f41 Add a regression test for #612 2016-03-03 13:57:46 +00:00