Commit Graph

10043 Commits

Author SHA1 Message Date
Maxime Coste
d43268fbeb Fix invalid access of display line end
When a line only contains non-range atoms we can end-up accessing
past the end atom.

Add a test that shows the issue when run with valgrind, it is
unfortunately quite hard to trigger a crash because the invalidly
accessed byte usually leads to the correct code path being taken
(when != DisplayAtom::Range) so we have only 1 in 255 chance of
triggerring a crash.

Fixes #4927
2023-06-20 13:09:03 +10:00
Maxime Coste
e58592f00a Fix highlighters being applied to empty display buffers
In some cases such as with folding we can end-up with regions
not having any atoms to highlight which can trigger a crash as
we assume display buffers not to be empty

Fixes #4926
2023-06-19 12:55:55 +10:00
Maxime Coste
7027cccf82 Fix typo in README 2023-06-17 18:14:15 +10:00
Maxime Coste
5901d2e06b Revert "Switch undo storage from a tree to a plain list"
Moving across history moved to <c-j>/<c-k> to keep <a-u>/<a-U>
for selection undo/redo

This reverts commit e0d33f51b3.
2023-06-17 17:31:57 +10:00
Maxime Coste
b2a853cfc2 Add a few missing entries to the changelog 2023-06-17 17:10:05 +10:00
Maxime Coste
18d4c40f08 Fix c-family closing brace indent behaviour on some corner cases 2023-06-15 17:42:19 +10:00
Maxime Coste
5b1ad0bd0c Add a -previous switch to show-matching highlighter
This switch makes show-matching fallback to the character preceeding
the cursor if the character under the cursor is not a matching
character, which should make show-matching more useful in insert mode.
2023-06-14 22:53:39 +10:00
Maxime Coste
4106791adc Fix windowing detection echoing last module error if none matched
Display a more general message in the debug buffer.
2023-06-13 17:08:42 +10:00
Maxime Coste
19cbb703a7 Merge remote-tracking branch 'arrufat/fix-build-gcc13' 2023-06-12 21:53:39 +10:00
Maxime Coste
467021c3c7 Merge remote-tracking branch 'arrufat/remove-unneeded-this-capture' 2023-06-12 21:51:13 +10:00
Maxime Coste
93219af001 Merge remote-tracking branch 'QiBaobin/wezterm' 2023-06-12 21:50:18 +10:00
Maxime Coste
ca4593e5cd Fix one missing face pre-parsing 2023-06-12 17:12:24 +10:00
Maxime Coste
6984340936 Store region pointers instead of names in the RegionsHighlighter cache
Cache get fully invalidated whenever the regions change, so there
should be no risk of referencing a removed region, and this removes
one hash map lookup for every region in the displayed buffer range.
2023-06-12 16:45:19 +10:00
Maxime Coste
af66a95ef8 Trim display lines before the colorize pass
Colorizing long lines can be costly, remove all the invisible atoms
earlier. Also optimize ForwardHighlighterApplier further by trimming
empty lines.
2023-06-12 16:26:22 +10:00
Maxime Coste
5a867ebdd1 Pre-parse face specs in Highlighters
Re-parsing face specs can be expensive as highlighters can
be called many times during a redraw with nested regions.
2023-06-10 09:46:46 +10:00
Adrià Arrufat
66b22a1902 Remove unneeded this capture in lambda
Clang 15 was complaining about this.
2023-06-09 21:47:49 +09:00
Adrià Arrufat
77ade51a81 Fix build using GCC 13.1
The <functional> header was missing and the "hash.hh" was not used.
2023-06-09 21:41:51 +09:00
Bob Qi
365fe58826 fix arg quoting 2023-06-09 17:57:48 +08:00
Bob Qi
b64dce3e95 rc/windowing/wezterm.kak 2023-06-09 15:43:07 +08:00
Maxime Coste
e0728d3434 Speed up regions highlighting on files with big lines
Range atoms should always appear in order, so we can iterate a single
time through the display lines and display atoms while applying
hightlighters to regions
2023-06-09 16:38:14 +10:00
Maxime Coste
5a31d331b9 Merge branch 'patch-1' of http://github.com/DerSaidin/kakoune 2023-06-05 20:13:49 +10:00
Maxime Coste
6bee11c7dd Merge remote-tracking branch 'QiBaobin/kakrc-hl' 2023-06-05 20:13:07 +10:00
Maxime Coste
0338294223 Merge remote-tracking branch 'greenfork/hare-comment-insert' 2023-06-05 20:11:23 +10:00
Dmitry Matveyev
caf6f6ff7e hare.kak: change back the command
Previously was changed in

https://github.com/mawww/kakoune/pull/4785

Probably some race condition that right now works with a big letter P?
2023-06-04 09:49:52 +06:00
Johannes Altmanninger
b7e9d9bae3 rc detection modeline: optimize modeline pre-filtering
modeline-parse leads by matching an expensive regex against the entire buffer,
which can take a long time on huge files.

Perl takes too long on this regex and it seems not even ripgrep
optimizes the \z component

	$ ruby -e '10000.times { puts "a" * 10000 }' > big
	$ time rg --multiline --only-matching '\A(.+\n){1,5}|(.+\n){1,5}\z' big | wc -l
	10
	__________________________
	Executed in  419.81 millis
	   usr time  399.84 millis
	   sys time   20.78 millis

where

	$ time kak big -e q
	__________________________
	Executed in  179.19 millis
	   usr time  133.61 millis
	   sys time   53.50 millis

Let's lose the regex.

Fixes #4911
2023-06-02 22:38:32 +02:00
Bob Qi
acaca4955e add Highlight for complete-command shell-script 2023-06-02 15:31:41 +08:00
Andrew Browne
034f68394d
Update mapping.asciidoc for key swap.
https://github.com/mawww/kakoune/issues/2524
2023-06-01 10:25:12 -07:00
Maxime Coste
7f950bc4a9 git.kak: Use gawk's strftime instead of shelling out to date
`date -d` is not posix, strftime neither, but at least we only rely
on one non-posix tool and avoid forking.

Should help a bit for #4847
2023-05-30 13:01:56 +10:00
Maxime Coste
95a4d70379 Kill current shell on <c-g> during shell execution
Closes #4907
2023-05-29 20:25:56 +10:00
Maxime Coste
cf7c638025 Refactor KeymapManager to enfore setting is_executing on key iteration
Add an iterator based remove to HashMap as that was missing. Make
KeymapManager responsible for throwing on unmap an executing mapping.
2023-05-29 20:11:06 +10:00
Maxime Coste
3069b68245 Merge remote-tracking branch 'krobelus/fix-unmap-uaf' 2023-05-29 20:10:50 +10:00
Johannes Altmanninger
e49c0fb040 unmap: fail if the mapping is currently executing
When unmapping a key sequence that is currently executing, we continue
executing freed memory which can have weird effects.  Let's instead
throw an error if that happens. In future we can support unmap in
this scenario.

Closes #4896
2023-05-25 00:04:23 +02:00
Tim Allen
45c01c2109 Document the new <c-g> key, and <c-c> too while we're at it.
Sometimes we get people asking why <c-c> can't be mapped. It should be
mentioned in the `:help mapping` documentation, along with any other
unmappable keys.
2023-05-21 20:26:30 +10:00
Maxime Coste
cfa658b899 Add <c-g> to cancel current operation
The current implementation only does this during regex operations,
but should be extensible to other operations that might take a long
time by regularly calling EventManager::handle_urgent_events().
2023-05-21 16:20:51 +10:00
Maxime Coste
e140df8f08 Add an idle callback to be called regularly while regex matching
This paves the way towards being able to cancel long regex matching
operations
2023-05-21 16:20:51 +10:00
Maxime Coste
19b4149d47 Fix warnings with gcc-13 2023-05-21 12:40:27 +10:00
Maxime Coste
1a5a31cfbf Merge remote-tracking branch 'arachsys/mouse-modifiers' 2023-05-15 21:25:55 +10:00
Maxime Coste
375a3c87df Merge remote-tracking branch 'jtrv/grep-kak-literal-string-matching' 2023-05-15 21:22:56 +10:00
Chris Webb
2f1e536ac7 Fix debug keys output for shift/ctrl modified mouse events
Although Kakoune responds to modified mouse events, they show up in the
debug buffer corrupted. to_string() tests for equality on the mouse event
modifiers rather than testing just the relevant bits, so the modified
mouse events incorrectly fall through to the normal key handling.

Fix this and restructure to allow mouse events to be modifier-prefixed.

Signed-off-by: Chris Webb <chris@arachsys.com>
2023-05-11 20:21:31 +01:00
JacobTravers
8a5a1e65a0 jtrv Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain.  I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors.  I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
2023-05-10 14:51:31 -07:00
Maxime Coste
a69be6288c Merge remote-tracking branch 'poweredbypie/master' 2023-05-10 20:08:12 +10:00
Maxime Coste
3d989af2de Merge remote-tracking branch 'krobelus/fix-crash-connecting-monitor' 2023-05-10 20:03:22 +10:00
Maxime Coste
459007ae21 Merge remote-tracking branch 'sidkshatriya/remove-ref-ref' 2023-05-10 20:02:51 +10:00
Maxime Coste
4a8b24bb8c Merge remote-tracking branch 'razcore-rad/godot4-gdscript' 2023-05-10 20:01:49 +10:00
Maxime Coste
bdc459e666 Merge remote-tracking branch 'arrufat/improve-python-insert-on-new-line' 2023-05-10 20:01:08 +10:00
Maxime Coste
83753b7f94 Merge remote-tracking branch 'm-kru/troff_pic' 2023-05-10 20:00:36 +10:00
Maxime Coste
84fd3bc7c8 Merge branch 'patch-1' of http://github.com/circumspect/kakoune 2023-05-10 20:00:00 +10:00
Maxime Coste
d39930cd10 Merge remote-tracking branch 'krobelus/fix-_-at_multibyte_chars' 2023-05-10 19:57:46 +10:00
Maxime Coste
3c241a2666 Merge remote-tracking branch 'krobelus/map-selection-undo-to-a-u' 2023-05-10 19:57:07 +10:00
Maxime Coste
e74424d889 Merge remote-tracking branch 'Frojdholm/rc-windowing-kitty-window-id' 2023-05-10 19:54:12 +10:00