Commit Graph

4737 Commits

Author SHA1 Message Date
Maxime Coste
cb7401439b Kakoune v2019.01.20 2019-01-20 22:52:01 +11:00
Maxime Coste
ae69759a53 Defer deletion of unsetted option to return to main loop
Fixes #2572
2019-01-20 22:46:40 +11:00
Maxime Coste
7df7f5d38b small code tweak 2019-01-19 10:34:12 +11:00
Maxime Coste
445da8d7bf Use an InvalidPolicy in utf8::dump and utf8::codepoint_size
Do not throw on invalid codepoints by default, ignore them.
Fixes #2686
2019-01-13 18:29:20 +11:00
Maxime Coste
328c497be2 Add support for named captures to the regex impl and regex highlighter
ECMAScript is adding support for it, and it is a pretty isolated
change to do.

Fixes #2293
2019-01-03 22:55:50 +11:00
Maxime Coste
56ee329d79 Add Optional::value_or_compute for lazy computation of default value 2019-01-03 22:49:40 +11:00
Maxime Coste
09e6518545 Remove DurationMs and slight code refactor 2018-12-28 06:27:35 +11:00
Maxime Coste
ef8fdd664f Merge remote-tracking branch 'lenormf/unit-tests-timing' 2018-12-28 06:16:50 +11:00
Maxime Coste
20e64f34bc Use fork instead of vfork on CYGWIN
Fixes #2653
2018-12-27 13:06:31 +11:00
Frank LENORMAND
623c8a76f4 src: Run and display the time taken by unit tests to run in debug mode
Knowing how much time the editor took to run unit tests gives users
a notion of how fast it's performing on a given system.
2018-12-23 09:26:12 +03:00
Frank LENORMAND
b1f5639d8c src: Add support for right click events
The current implementation treats left mouse button clicks as a
generic "mouse press" modifier, this commit extends the list of
modifiers by adding a "right mouse click" one.

The proper way to implement this would be to ship the coordinates
of mouse key press events in each `Key` object, and pass whichever
button was clicked as a codepoint value (instead of coordinates
currently), but this would require more work.

This commit allows:

* right clicks to set the cursor of the main selection
* control-right clicks to merge all the selections, and then set
  its cursor

Fixes #843
2018-12-20 14:32:18 +03:00
Maxime Coste
1a280e91c7 Add support for 'sanitizers=...' make option
Use make sanitizers=undefined,address to enable undefined and address
sanitizers.

Closes #2596
2018-12-19 19:31:04 +11:00
Maxime Coste
ef3419edbf Do not pass thread to failed/consumed, capture it implicitely 2018-12-19 19:16:14 +11:00
Maxime Coste
0b9f782691 Take iterators by const-ref in ThreadedRegexVM::exec 2018-12-19 19:14:42 +11:00
Maxime Coste
d2f2c3d0c7 Generate a coredump on quit due to SIGSEGV 2018-12-13 21:29:33 +11:00
Maxime Coste
0e1e0fc57b Improve deindent behaviour with mixed indent 2018-12-13 17:35:16 +11:00
Maxime Coste
f7ab129e53 Remove support for 8-bit CSI as it breaks utf8 input
Fixes #2630
2018-12-12 19:10:28 +11:00
Maxime Coste
b929b94bfc Merge remote-tracking branch 'lenormf/fix-makefile-test-rule' 2018-12-11 22:11:55 +11:00
Maxime Coste
c6f98f8483 Fix compilation error 2018-12-09 22:05:32 +11:00
Maxime Coste
10163488c1 Merge branch 'patch-1' of http://github.com/gnull/kakoune 2018-12-09 21:51:15 +11:00
Maxime Coste
64f1c31401 Refactor parsing of keys and introduce a builtin key parser mode
By setting the ncurses_builtin_key_parser ui_option to true, we
can disable ncurses parsing of key strokes to get less portable
parsing but support for more complex modifiers.
2018-12-09 21:35:22 +11:00
Maxime Coste
1670a7514a NCursesUI: Handle CSI in 8-bit mode as well 2018-12-09 11:20:03 +11:00
Maxime Coste
e90e77e5fc Merge remote-tracking branch 'jeapostrophe/master' 2018-12-09 10:33:44 +11:00
Maxime Coste
1875ff51a0 Gather the list of hooks to run before running the parent
This will prevent hooks added by the parent hook manager to be
gathered, as was decided during the discussion for #2603
2018-12-09 10:07:40 +11:00
Ivan Oleynikov
48249ea818
Very minor grammar fix
Probably, the extra «s» at the end of «exist» was added accidentally. A verb after «does not» in Present Simple definitely shouldn't have this extra «s».
2018-12-08 18:59:13 +03:00
Jay McCarthy
dde81019a2 Fix dumb typo 2018-12-07 16:33:35 -05:00
Jay McCarthy
f36a2870b8 Simplify re: lenormf 2018-12-07 16:33:35 -05:00
Jay McCarthy
4cac29d98c Update re lenormf's comments 2018-12-07 16:33:35 -05:00
Jay McCarthy
af5d2d9523 Parse xterm-keys for motion directly
Ideally, something better should be done (re #2554) but this is a decent
intermediate step for some useful keys.

Note: NCurses supports parsing these keys when shifted (KEY_SR,
_SLEFT, S_RIGHT, etc), but it does not do the same thing for the other
modifiers.
2018-12-07 16:33:35 -05:00
Jason Felice
a4f830f143 Use _exit() after vfork()
Closes #2620

The docs for Mac OS X's vfork() requires it, and _exit() conforms to
POSIX.1-2008.

http://man7.org/linux/man-pages/man2/_exit.2.html
2018-12-07 09:36:06 -05:00
Frank LENORMAND
7fea08e736 src: The test build target depends on kak
Not having the `test` target (in the Makefile) depend on the `kak` one
prevents users from running commands that make use of parallelism, e.g.:

$ make -j all test

The above command sometimes results in the test suite running before
the binary has been compiled and symlinked, resulting in failures.
2018-12-06 14:34:29 +03:00
Maxime Coste
b897a18aa6 Use a dummy function for SIGPIPE instead of SIG_IGN
SIG_IGN is inherited after 'execve' and requires us to reset
that signal handler, which does not work well with vfork on
OSX. Using an empty function does the trick and will be auto
reset to default on exec.
2018-12-06 20:33:13 +11:00
Frank LENORMAND
f0e07cc73c src: Prevent :prompt -on-change from crashing the editor
Fixes #1217
2018-12-01 08:41:29 +03:00
Maxime Coste
16908bf091 Fix hooks triggering on unset-option even if parent has same value 2018-11-28 21:45:40 +11:00
Maxime Coste
d1274836cd Support KAKOUNE_POSIX_SHELL environment variable to choose the shell path
The shell will always be run with 'sh' as argv[0] to make shells such
as busybox sh supported.

Closes #2547
2018-11-27 22:21:20 +11:00
Maxime Coste
5250593129 ShellManager: Use vfork instead of fork
When large buffers have been opened, copying Kakoune's memory
page descriptors can get pretty slow, making fork more expensive
than necessary.

vfork avoids that problem. While not strictly conforming, it seems
the few calls we do before execve (open, close, dup2 and
set_signal_handler) would not cause any problems on platforms we
care about.
2018-11-27 21:49:57 +11:00
Maxime Coste
e0b9327a9f Merge remote-tracking branch 'lenormf/fix-trim-selections' 2018-11-27 18:25:14 +11:00
Maxime Coste
8244087d45 Merge remote-tracking branch 'Delapouite/face-helper' 2018-11-27 18:18:18 +11:00
Maxime Coste
1553d91d27 Make '_' the default extra_word_chars, and remove built-in support
Fixes #2599
2018-11-27 18:16:21 +11:00
Maxime Coste
6c54c4740d Read initial remote message in Urgent EventMode
Fixes #2497
2018-11-26 12:48:48 +11:00
Maxime Coste
31d3cef093 Merge remote-tracking branch 'lenormf/rename-auto_complete' 2018-11-25 23:01:02 +11:00
Olivier Perret
052eccd964 Add missing newline to 'regions' highlighter description 2018-11-23 10:13:48 +01:00
Maxime Coste
29d4a582d8 Merge remote-tracking branch 'Delapouite/typos' 2018-11-19 20:50:59 +11:00
Maxime Coste
9a68a2d3af Change BufReadFifo hook param to contain the inserted range
the buffer name was not a very interesting information, whereas
the buffer range allows a hook to run only on the appended text
instead of all the buffer.
2018-11-14 17:52:57 +11:00
Maxime Coste
021ba55b38 Small code tweak in DualThreadStack::swap_next 2018-11-14 17:50:17 +11:00
Maxime Coste
54d35472c0 Fix spurious redraw
m_last_setup was not storing the actual position that was used to
redraw the window, but the previous one, leading to an additional
spurious redraw immediatly after (triggered by window position not
believed to be the one at last redraw).

Fixes #2562
2018-11-14 17:49:44 +11:00
Maxime Coste
b9ca3ee6dc Fix column highlighter adding display atoms past the window width 2018-11-14 17:47:11 +11:00
Delapouite
4c68abab11 doc: fix misc typos for source and region highlighter 2018-11-10 12:12:03 +01:00
Delapouite
22166a69c2 Add set-face/unset-face CommandHelpers 2018-11-09 08:29:16 +01:00
Olivier Perret
b96ab67479 Expose selection(s) length with a value 2018-11-08 20:14:33 +11:00
Maxime Coste
8c2c3d27ad Fix memory leak in DualThreadStack
Fixes #2556
2018-11-07 12:28:41 +11:00
Maxime Coste
95622bc6e8 Merge remote-tracking branch 'Delapouite/debug-regex' 2018-11-06 20:17:41 +11:00
Maxime Coste
2eeb9d8deb Merge remote-tracking branch 'ul/replace-e-face-with-F-in-rc' 2018-11-06 20:16:38 +11:00
Maxime Coste
7f83c41256 align ThreadedRegexVM::Thread to permit fused copy optimization
Aligning makes gcc able to copy a Thread object with a single
32bit mov instruction instead of two 16bits one.
2018-11-06 20:13:09 +11:00
Maxime Coste
05a9eb62f4 Never grow the DualThreadStack in push_next
As we do at most one push_next per step_thread, and we pop_current
before step_thread, we can avoid a branch there at the expense of
sometimes growing unecessarily (once).
2018-11-06 07:32:47 +11:00
Maxime Coste
7fbde0d44e Various micro performance tweaks in ThreadedRegexVM 2018-11-05 21:54:29 +11:00
Maxime Coste
7959c7f731 Refactor ThreadedRegexVM::exec_program to avoid branching
Moving logic into step_thread instead of returning an enum to
select what to run avoids the switch logic and improves run time.
2018-11-05 19:46:53 +11:00
Maxime Coste
7463a0d449 Remove use of utf8::iterator in regex execution
This avoids having two copies of the subject string bounds, one
in the ExecConfig and one in the utf8 iterator.
2018-11-05 08:17:50 +11:00
Maxime Coste
b4571bd172 Dump start description as well when writing a regex dump 2018-11-04 12:01:29 +11:00
Maxime Coste
4ac7df3842 Remove most regex impl special casing for backwards matching 2018-11-03 13:52:40 +11:00
Maxime Coste
ee74c2c2df Use custom code instead of reverse_iterator in Regex VM 2018-11-02 08:23:39 +11:00
Maxime Coste
6fce8050ee Use BufferCoord sentinel type for regex matching on BufferIterators
BufferIterators are large-ish, and need to check the buffer pointer
on comparison. Checking against a coord is just a 64 bit comparison.
2018-11-01 21:51:10 +11:00
Maxime Coste
8a751e1b57 Remove caching from utf8_iterator 2018-11-01 21:05:09 +11:00
Maxime Coste
4cd7583bbc Improve regex vm to next start performance by avoiding iterator copies 2018-11-01 08:22:43 +11:00
Maxime Coste
4cfb46ff2e Support different type for iterators and sentinel in utf8 functions 2018-11-01 08:22:43 +11:00
Delapouite
a61c6a9bb5 Truncate incomplete debug command docstring 2018-10-30 19:46:05 +01:00
Maxime Coste
9fec1b3faf Buffer: Remove m_line_count field from BufferIterator
It seems unlikely this would give performance gain, as buffer
lines are always accessed when we read that field, leading to
all the necessary data already being in memory. Removing it
reduces the size of a BufferIterator, which are already pretty
hefty objects.
2018-10-30 23:18:41 +11:00
Maxime Coste
6271d0d9ff Merge remote-tracking branch 'eraserhd/refactor-surround' 2018-10-29 19:27:18 +11:00
Delapouite
44ce4bc069 Remove extra spaces for switches list in info 2018-10-28 13:34:19 +01:00
Ruslan Prokopchuk
b65a6493aa replace usage of the deprecated 'e' face attribute with the new 'F' one
and update set-face docstring
2018-10-28 08:52:14 +11:00
Jason Felice
feea0064d8 Simplify surround selection
This has the same effect with fewer conditions, and I think it also
specifies the intent more closely this way.
2018-10-27 13:49:45 -04:00
Maxime Coste
3b40ab82f4 Kakoune v2018.10.27 2018-10-27 09:26:50 +11:00
Justin Frank
0d49c925e3 Keep doc/kak.1 when running make-install 2018-10-23 18:15:01 -07:00
Maxime Coste
365407c37a Merge remote-tracking branch 'Delapouite/previous-char' 2018-10-24 08:13:45 +11:00
Delapouite
ec0926c312 Change next_key title for <a-f>, <a-t>, <a-F> and <a-T> 2018-10-23 19:09:01 +02:00
Maxime Coste
207291219c Merge remote-tracking branch 'maximbaz/fix-makefile-manpage' 2018-10-23 20:20:32 +11:00
Maxime Coste
7c00165c23 Merge remote-tracking branch 'laelath/vertical-menu-option' 2018-10-23 20:18:56 +11:00
Maxim Baz
9f6518a031
Fix Makefile for manpage 2018-10-23 02:34:05 +02:00
Maxime Coste
e3668121f2 Merge remote-tracking branch 'lenormf/no-a2x' 2018-10-23 08:19:56 +11:00
Maxime Coste
dfc11d1c43 Refactor Hook management to have a well defined list of hooks
Hooks are now an enum class instead of passing strings around.
2018-10-23 08:15:53 +11:00
Frank LENORMAND
60b24c6a32 doc: Convert the man page to the TROFF format
Fixes #2504
2018-10-21 14:04:25 +03:00
Maxime Coste
72bdd7900f Move LineRangeSet to line_modification.hh 2018-10-21 12:10:21 +11:00
Maxime Coste
a383ce3045 Fix LineRangeSet::udpate not updating some traling ranges correctly
Fixes #2499
2018-10-21 11:49:30 +11:00
Justin Frank
c5a1225638 removed option and horizontal layout 2018-10-15 14:07:39 -07:00
Justin Frank
a1e3fa02e6 added option for vertical menu layout in the ncurses ui 2018-10-15 14:07:39 -07:00
Maxime Coste
da13b5f814 Fix handling of capture matching in region highlighter
Also extend the highlight/regions test to validate that.
Thanks to lenormf for reviewing my change and finding this bug.
2018-10-15 21:21:12 +11:00
Maxime Coste
71e27c73af Cleanup RegexHighlighter code and drop cache when it becomes too big
The RegexHighlighter range cache can get pretty big in nested
regions use cases, and maintaining it can become pretty costly,
so if it hits a certain size, just drop it.

Should improve performances in #2454
2018-10-14 09:48:39 +11:00
Maxime Coste
194a5db5d6 maintain a list of valid ranges for region highlighting
This should greatly reduce memory usage by only caching matches
for ranges that needs to be highlighted, in the case where multiple
regions are nested, this means only the topmost region needs to parse
and cache the whole buffer, other regions highlighter will only ensure
the lines for the ranges they are called up are cached.

Fixes #2454
2018-10-14 09:48:39 +11:00
Maxime Coste
dd0e4310a7 Slight code refactoring in RegionsHighlighter 2018-10-14 09:48:39 +11:00
Maxime Coste
5922299083 Merge remote-tracking branch 'Delapouite/complete_alias' 2018-10-14 09:46:35 +11:00
Maxime Coste
d652ec9ce1 Cleanup regex lookarounds implementation and reject incompatible regex
Fixes #2487
2018-10-10 22:47:59 +11:00
Delapouite
3a36490ef1 Add alias completer to unalias command 2018-10-08 22:07:13 +02:00
Maxime Coste
9024d41d64 Fix integer overflow leading to bad memory access in regex execution
Fixes #2481
Fixes #2480
2018-10-08 12:43:12 +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
Maxime Coste
eba40028b9 Update startup messsage and changelog.asciidoc 2018-10-06 10:55:26 +10:00
Maxime Coste
5bdcfab018 Merge remote-tracking branch 'laelath/shell-command-completion' 2018-10-06 10:47:23 +10:00
Maxime Coste
0d20e57e29 Small style tweak 2018-10-06 10:44:56 +10:00
Maxime Coste
98da5dd13a Merge remote-tracking branch 'eraserhd/notify_fatal_error-undefined-behavior' 2018-10-06 10:23:10 +10:00
Maxime Coste
e8ac3395f5 Reduce memory usage of cached matches for RegionsHighlighter
This adds a limitation that capture matching on regions only works
if the regions start/end/recurse match is less than 65635 byte long.
With this limitation we can reduce the RegexMatch struct size to 16
bytes instead of 32.

This is still not good enough,but should slightly improve high memory
usage as reported in #2454
2018-10-06 10:16:20 +10:00
Jason Felice
c78cd84ea4 Fix undefined behavior in notify_fatal_error 2018-10-05 10:10:14 +01:00