Commit Graph

141 Commits

Author SHA1 Message Date
Maxime Coste
14f7d2637c Fix test and re-add triple_string support in python highlighting
Triple strings are now distinct from docstrings, triple strings
only preceeded by blanks on the line are considered docstrings.

Avoid highlighting of the closing marker using a lookahead, this
is not fully correct as it will break on a double quote triple
docstring containing a single quote triple string but that seems
improbable enough; if we encounter this in the wild we can split
the two docstring formats into separate regions.
2020-11-23 08:45:59 +11:00
Maxime Coste
246a32797a Fix region regexes incorrectly matching ^$ at end of line
Because no flags were set for regex matching, the regex engine was
assuming that the subject string past-the-end matched a end-of-line.
As the subject string already ended with a \n character, the regex
engine processing of the "past-the-end" position would match '^$'
as ^ matched past the existing \n and $ matched the assumed
end-of-line.

Fixes #3799
2020-10-12 12:41:21 +11:00
Maxime Coste
0ef858da64 Merge remote-tracking branch 'lenormf/fix-3735' into master 2020-09-22 21:17:12 +10:00
Maxime Coste
5d17e1132f Ensure that the capture group actually matched in select_matches
We were creating selections from default constructed iterators,
which happened to have 0,0 coords and led to out-of-order selection
lists.

Fixes #3757
2020-09-22 21:14:40 +10:00
Frank LENORMAND
d02cb43a88 test: Implement a regression test for #3735 2020-09-18 09:01:32 +03:00
Frank LENORMAND
643bf2bb59 test: Implement a regression test for #3733 2020-09-16 11:00:15 +03:00
Maxime Coste
8abf18209e Fix selections getting unsorted on scroll
Fixes #3478
2020-07-05 10:13:57 +10:00
Maxime Coste
66f15cf4ad Fix select wiping captures
It turns out `v = std::move(v)` with v a std::vector is not a no-op,
it clears the vector.
2020-06-07 14:12:54 +10:00
Maxime Coste
109abbeed4 Fix invalid regions with begin > end being generated
Fixes #3495
2020-05-28 20:58:46 +10:00
Johannes Altmanninger
fc63eef695 Fix crash when selecting previous paragraph at buffer begin
Fixes #3489

When there are multiple empty lines between a paragraph and the cursor
(C in the example below), <a-[>p skips over one of them. Prevent the
check for the extra newline from going out of bounds.

```
a paragraph

C	after <a-[>p, the first two lines will be selected
```
2020-05-17 14:15:48 +02:00
Maxime Coste
2104af0771 Fix select_sentence going past the end of the buffer
Fixes #3472
2020-05-10 15:13:15 +10:00
Maxime Coste
a33b938652 Fix issue with select object and empty matches 2020-04-21 13:21:35 +10:00
Maxime Coste
562ee6143a Parse ascii newline/tab/escape as special keys instead of control keys
Fixes #3439
2020-04-13 12:44:15 +10:00
Maxime Coste
7545fa58ae Fix invalid access to deleted line when updating insert completion
The computation of the completion end position was taking place too
early, before we checked if the buffer did get modified.

Fixes #3349
2020-03-14 13:49:52 +11:00
Maxime Coste
31caae20eb Allow reading from fifo in readonly buffers
readonly is supposed to prevent the user from modifying the buffer
and it can be useful to generate a readonly fifo buffer.

Fixes #3398
2020-03-14 12:58:22 +11:00
Maxime Coste
21dc5284b2 Fix use of non-posix \x printf escape 2020-03-13 09:33:19 +11:00
Maxime Coste
149da2064d Handle invalid utf8 in command line a bit better
Reduce the amount of decoding by working directly on
bytes.

Fixes #3388
2020-03-13 08:02:58 +11:00
Maxime Coste
0a66eb9c47 Expand env vars as list of strings
This makes it possible to do :select `%val{selections_decs}` and to
correctly combine $kak_quoted with those.
2020-03-02 20:53:28 +11:00
Maxime Coste
f808539dea Update inserted range when generating InsertCompletionHide hook param
The buffer might have been mutated in the mean time.

Fixes #3270
2020-01-08 20:33:26 +11:00
Maxime Coste
b37638dda4 Split RegexHighlighters matches per requested buffer ranges
When a region calls the regex highlighter, it is incorrect to share
the regex cache as it means we can get matches that span multiple
regions.

Fixes #3041
2020-01-05 18:58:32 +11:00
Maxime Coste
a17a0345cf Fix replacing at begining of buffer
Fixes #3275
2019-12-31 12:49:24 +11:00
Maxime Coste
b68490ef11 Cleanup replaced range selection logic
Do not access Buffer::m_changes to find the inserted range, return
it directly from Buffer::insert and Buffer::replace. This fixes a
wrong behaviour where replacing at eof would lose the selected end
of line (as the implementation does not actually replace that end
of line)
2019-12-18 11:36:17 +11:00
Maxime Coste
7b3ab23780 Add a regression test for #3219, which does not seem to fail 2019-11-24 18:11:29 +11:00
Maxime Coste
22d9ffa63a Fix crash when deleting buffers in a BufClose hook 2019-11-22 20:29:55 +11:00
Jason Felice
e712138ebd Fix test suite freeze
The issue is that the `test/regression/2056-assert-on-small-window`
sent JSON UI input without waiting for for the JSON UI to be
initialized.

Closes #3196
2019-11-12 09:39:37 -05:00
Jason Felice
e888f4341c test: Allow expect-style UI tests, testing any var 2019-10-13 14:57:24 -04:00
Maxime Coste
f1047181cb Fallback to wrapping in between 'word' when 'WORD' fails
First try to break at a whitespace, if that fails (likely because
that last WORD is too long for the wrapping width), then try to
wrap at a 'word' boundary (on a non alphanumeric character).

Fixes #3048
2019-08-12 18:40:56 +10:00
Maxime Coste
1c6aa9baed Fix bug in WrapHighlighter::do_compute_display_setup
Additional lines were not pulled correctly when a line was removed
due to its wrapping hiding the cursor.

Fixes #2999
2019-08-05 20:16:59 +10:00
Maxime Coste
e42c81c8eb Ensure current context switches away from buffer on delete-buffer
Fixes #3025
2019-07-22 20:26:39 +10:00
Maxime Coste
be3d0f8b33 Filter non-extra_word_chars completion candidates using Codepoints
Fixes #3010
2019-07-09 19:36:57 +10:00
Maxime Coste
1ebea85e6f Do not merge selections on backspace in insert mode
Fixes #2861
2019-05-29 23:12:04 +10:00
Maxime Coste
1c8f1cbc2f Fix wrapping of words with 'wrap col - indent < word len < wrap col'
Add a test case for those, and refactor bits of the wrap highlighter.

This explains part of the needed complexity in #2820.
2019-04-24 11:40:57 +01:00
Alex Leferry 2
c0dccdd90d Add categories in rc/
Closes #2783
2019-03-21 01:06:16 +01:00
Maxime Coste
f9d421130f Fix use of invalidated iterators in highlight_range
Fixes #2755
2019-03-05 20:31:40 +11:00
Maxime Coste
a61b6d7649 Add a test case for WinDisplay segfault
Fixes #2737
2019-02-17 11:21:26 +11:00
Maxime Coste
5c0175d90a Remove peephole regex optimization pass
The current implementation is wrong as it crosses basic blocks
boundaries. Doing basic block decomposition of regex is probably
a tad too complex for this single optimization.

Fixes #2711
2019-02-04 22:10:19 +11:00
Maxime Coste
370d10ccc7 Always select inserted text after piping
Relying on general selection update code is error prone due to
diffing.

Fixes #2394
2019-01-23 20:14:08 +11:00
Maxime Coste
0e1e0fc57b Improve deindent behaviour with mixed indent 2018-12-13 17:35:16 +11:00
Maxime Coste
b9ca3ee6dc Fix column highlighter adding display atoms past the window width 2018-11-14 17:47:11 +11:00
Maxime Coste
a383ce3045 Fix LineRangeSet::udpate not updating some traling ranges correctly
Fixes #2499
2018-10-21 11:49:30 +11:00
Maxime Coste
ed84a2d60c Buffer begin and end are not end-of-words
Buffer begin never has a word character before, and end is always
preceeded by an end-of-line.

Fixes #2420
2018-10-08 12:40:52 +11:00
Justin Frank
ab6bc41358 Added shell command completion support to define-command and prompt
This commit also introduces a regression in that I decided that the best way to
avoid overly long and confusing names was to rename the current shell-*
switches to script-*, and have the shell command completion be
shell-completion.

renamed script-{completion,candidates} to shell-script-*

Updated docs with new switch names

Added -shell-completion switch to x11-repl and kitty-repl
2018-10-03 09:46:31 -07:00
Olivier Perret
93f913705a Misc fixes 2018-09-24 09:54:21 +02:00
Maxime Coste
cb8b882878 Fix broken test after change in cursor faces 2018-09-24 08:15:12 +10:00
Maxime Coste
1631a7d8d9 Replace the Exclusive face attribute with Final
Final is more granular, it consists of FinalFg (f), FinalBg (g)
and FinalAttr (a) which control if a face's fg, bg, or attributes
fully overwrite the previous face (instead of merging) and if
following faces apply on top of this face or not.

Fixes #2388 if the Whitespace face has the FinalFg flag.
2018-09-23 23:27:14 +10:00
Maxime Coste
8536adc5ac Merge remote-tracking branch 'eraserhd/2367-surround-with-tight-nesting' 2018-09-12 20:57:59 +10:00
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