Commit Graph

4961 Commits

Author SHA1 Message Date
Maxime Coste
675dbfbe8b Auto generate buffer name when using edit -scratch with no name
This will make it easier to create a temporary scratch buffer to
work in without having troubles with name collisions.

Fixes #849
2019-04-08 22:16:44 +10:00
Maxime Coste
c8839e7904 Add a ClientCreate and ClientClose hook
As discussed in #2830.
Closes #2500.
2019-04-08 21:59:32 +10:00
Maxime Coste
d0df1ffe71 update version notes and changelog 2019-04-07 09:51:27 +10:00
Maxime Coste
41f19f8dc9 Add support for %file{...} expansions
This should make the use case exposed in #2836 implementable.
2019-04-07 09:43:40 +10:00
Maxime Coste
744778be30 Add a -to-file <filename> switch to the echo command
As discussed in #2836
2019-04-07 09:32:17 +10:00
Maxime Coste
835f2239a7 Run WinClose hook when clearing all free windows
Fixes #2830
2019-04-04 22:06:17 +11:00
Maxime Coste
cc788c888e Fix detection of client ungraceful disconnection 2019-04-04 13:10:38 +11:00
Maxime Coste
d91e017803 Buffer writes in blocks of 4Kb when writing buffers to files
Could make kakoune more compatible with tools looking for file
modifications by reducing the amount of writes done.

As discussed in #2812
2019-04-01 22:57:55 +11:00
Maxime Coste
baae0c899b Add -timestamp switch support to the select command
Fixes #2829
2019-04-01 22:11:18 +11:00
Maxime Coste
b8cf457e82 Add Optional::map and Optional::cast methods
Cool kids call that monadic interface if I understood correctly.
2019-04-01 22:09:32 +11:00
Delapouite
0fe8e59abc Add missing flags to debug buffers output 2019-03-27 19:30:41 +01:00
Maxime Coste
688afee41b Only pass ncurses compilation flags to ncurses_ui.cc 2019-03-26 13:04:08 +11:00
Maxime Coste
b531bab1ce Add support for -shell-script-* completion in :prompt
Fixes #2754
2019-03-24 19:28:46 +11:00
Maxime Coste
045efdc49e Extract shell script completion code into structs 2019-03-24 13:01:43 +11:00
Maxime Coste
cf0458e734 Add cursor_display_column expansion
Fixes #2788
2019-03-23 11:32:32 +11:00
Vladimir Bauer
247e8b4a19 find $(sharedir)/rc ... 2019-03-22 22:21:00 +03:00
Vladimir Bauer
b839e45573 undo clean section 2019-03-22 19:23:50 +03:00
Vladimir Bauer
a5897fe1b6 call find in BSD compatible way 2019-03-22 13:28:52 +03:00
Maxime Coste
ad882c3370 Limit WordDB word length to 50 bytes
Should improve both performance and relevancy of the word completions.
2019-03-22 18:03:49 +11:00
Justin Frank
4c26a03a61 Fixed makefile so properly installs new rc structure 2019-03-21 18:49:04 -07:00
Maxime Coste
ef0c183ed7 Do not copy environment strings, just refer to them 2019-03-21 20:43:24 +11:00
Maxime Coste
31d67f51dd Track more memory statistics 2019-03-21 20:35:22 +11:00
Maxime Coste
56611604b2 Make String able to reference external data without copying
Sometimes we really need to have a String instead of a StringView,
but some of those strings might not need to own their data. Make
it possible to explicitely construct a String that does not own
the underlying buffer.

Use it when parsing balanced strings.
2019-03-19 22:00:57 +11:00
Maxime Coste
c2be661785 Fix typo in scratch buffer default content 2019-03-19 21:44:30 +11:00
Maxime Coste
f87e844244 Add a text in scratch buffer to make it explicit it wont be saved
Fixes #2759
2019-03-17 10:41:11 +11:00
Maxime Coste
a8ea599372 Remove another unnecessary ; in palete reset escape sequence
Should fix #2779 for real.
2019-03-16 11:57:31 +11:00
Maxime Coste
525684f4da Make keymap fully constexpr 2019-03-16 11:54:56 +11:00
Maxime Coste
47be98f1fc Remove unnecessary ; from palette reset escape sequence
Fixes #2779
2019-03-13 07:19:20 +11:00
Maxime Coste
21fa4dcb13 Re-introduce -MP in the C++ compilation rule
It turns out it is important to avoid having to clean when a header
is deleted.
2019-03-05 20:56:44 +11:00
Maxime Coste
8a0e89f326 Merge remote-tracking branch 'laelath/compilation-warnings' 2019-03-05 20:54:14 +11:00
Maxime Coste
ffb1813759 Merge remote-tracking branch 'krobelus/write-all-note-modified' 2019-03-05 20:50:15 +11:00
Maxime Coste
4843149b6a Make error description available as "%val{error}" during catch blocks
Fixes #2761
2019-03-05 20:46:23 +11:00
Maxime Coste
f9d421130f Fix use of invalidated iterators in highlight_range
Fixes #2755
2019-03-05 20:31:40 +11:00
Justin Frank
6a3c3a3f82 -MP compile option isn't needed since header files aren't globbed 2019-02-27 22:46:04 -08:00
Justin Frank
8178400f8d Fixed all reorder warnings 2019-02-27 22:45:31 -08:00
Justin Frank
29342836a6 Fixed Selection being defined as a struct and class 2019-02-27 22:45:31 -08:00
Johannes Altmanninger
b849099472 Document that write-all only writes modified buffers 2019-02-25 10:59:45 +01:00
Jason Felice
7cf6eddc30 Add object mode expansions 2019-02-17 20:18:19 -05:00
Maxime Coste
e169a1893b Merge remote-tracking branch 'eraserhd/object-command-submode' 2019-02-17 11:22:02 +11:00
Maxime Coste
1ad3b87302 Collapse jumps based on current index change
The previous method, while likely more correct, could restore jump
lists containing references to already removed buffers.
2019-02-17 11:21:26 +11:00
Maxime Coste
924f30840b Fix uses of std::remove_if
std::remove_if is not std::partition, it makes no guarantees on
the state of the objects past the new end (they usually are in a
moved-from state).
2019-02-17 11:21:26 +11:00
Maxime Coste
8135a44c6c Run WinClose hook before putting the window into trash 2019-02-17 11:21:26 +11:00
Jason Felice
000aa2282c Add object command 2019-02-14 09:32:04 -05:00
Maxime Coste
89cd68d8af Check the return value of the rename call 2019-02-12 21:05:47 +11:00
Maxime Coste
4dae2c875b Introduce a writemethod option to either overwrite or replace files
This permit to choose if files should be written by overwriting their
content (the default), or by writing to a separate temporary file
and rename it to the current file.

As discussed in #2036
2019-02-12 21:01:19 +11:00
Maxime Coste
e8f26cbae7 Refactor write_buffer_to_file to use a flags param
That is clearer than two boolean parameters.
2019-02-12 20:18:34 +11:00
Maxime Coste
94796509a0 Fix bug in 'itersel' handling that could result in unsorted selections 2019-02-11 21:48:09 +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
d9d2140ea2 Fix regex not always selecting the leftmost longest match
(Actually the rightmost longest match when searching backwards)

Fixes #2710
2019-02-04 17:33:29 +11:00
Maxime Coste
4cb402ac1a Remove references to SelectionList from selectors 2019-02-04 12:52:55 +11:00
Maxime Coste
7f9fe32f2d Remove target_eol and small code cleanups 2019-02-04 12:52:48 +11:00
Maxime Coste
7b1af1c32c Merge remote-tracking branch 'JJK96/documentation' 2019-02-03 09:53:09 +11:00
Jan-Jaap Korpershoek
b171824d8b Add missing [<switches>] argument to declare-option 2019-01-25 00:03:20 +01:00
Maxime Coste
b91367f8a3 Replace std::mem_fn with custom lambda in ranges 2019-01-24 23:24:50 +11:00
Maxime Coste
3e89148d74 Fix missing errno include 2019-01-24 23:24:50 +11:00
Maxime Coste
aa4885fd65 Add missing locale include to main.cc 2019-01-24 23:04:31 +11:00
Maxime Coste
c7f4d4dd27 Fix array_view dependency on std::min 2019-01-24 22:55:20 +11:00
Maxime Coste
346c78f5e0 Header and dependency cleanup 2019-01-24 21:22:20 +11:00
Maxime Coste
4b72cfe530 Replace std::tie with structured bindings 2019-01-24 21:21:59 +11:00
Maxime Coste
90dd084993 Only embed gdb script on ELF targets, and add missing gdb symlink 2019-01-23 20:59:32 +11:00
Maxime Coste
ebc9f7703b Embed gdb pretty-printing script directly into Kakoune binary
This will get stripped correctly, and should make debugging easier.
2019-01-23 20:27:16 +11:00
Maxime Coste
36e9e7eaf9 Change pipe diffing to work linewise
This should greatly improve performances as we only need to diff
lines instead of individual characters.

Closes #2678
Fixes #2037
2019-01-23 20:20:54 +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
c07f052de7 Default to release build
Fixes #2701
2019-01-22 19:41:58 +11:00
Maxime Coste
eb8f785e91 Try to bypass clang crash 2019-01-20 22:59:28 +11:00
Maxime Coste
77b1216ace Add a peephole optimization pass to the regex compiler 2019-01-20 22:59:28 +11:00
Maxime Coste
0364a99827 Refactor regex find next start not to be an instruction anymore
The same logic can be hard coded, avoiding one thread and 3
instructions, improving the regex matching speed.
2019-01-20 22:59:28 +11:00
Maxime Coste
fd043435e5 Split compile time regex flags from runtime ones 2019-01-20 22:59:28 +11:00
Maxime Coste
8c2603ab3c Support re-using the same ThreadedRegexVM for multiple iterations
This should reduce the number of allocations as the memory allocated
for the thread stack and the saves can be re-used between runs instead
of being cleared every time.
2019-01-20 22:59:28 +11:00
Maxime Coste
30897fd820 Fix warning on gcc 8 2019-01-20 22:59:28 +11:00
Maxime Coste
7b29192c24 Fix use of removed std::random_shuffle 2019-01-20 22:59:28 +11:00
Maxime Coste
2afc147b2c Refactor parsed regex children iteration to use regular range-for loops 2019-01-20 22:59:28 +11:00
Maxime Coste
566268d7bc Refactor RegexIterator to use a Sentinel 2019-01-20 22:59:28 +11:00
Maxime Coste
3babd0685c Switch to compilation standard to C++17 2019-01-20 22:59:28 +11:00
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
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
Justin Frank
f3f52fc818 show_matching_char highlighter use the matching_pairs options 2018-10-01 23:37:25 -07:00
Frank LENORMAND
2d44712766 src: Implement <a-m> and <a-M>
Closes #2425
2018-09-30 19:56:37 +03:00
Frank LENORMAND
6b7200e4d5 src: Move <a-m> to <a-_> 2018-09-30 19:45:20 +03:00
Frank LENORMAND
3d79107773 src: Drop selections that only contain whitespace on _
Fixes #2387
2018-09-27 14:47:26 +03:00
Olivier Perret
93f913705a Misc fixes 2018-09-24 09:54:21 +02:00
Delapouite
b60613259c Add a way to unmap all keys of a given mode at once 2018-09-23 19:40:38 +02: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
5d0ea2936d Ignore errors in write_stdout
Fixes #2418
2018-09-23 17:16:09 +10:00
Maxime Coste
fa993768da Merge remote-tracking branch 'eraserhd/script-docs' 2018-09-23 17:06:25 +10:00
Maxime Coste
9c1c763a37 Reject hook names that are not alphanumeric _ or - or start with -
Fixes #2414
2018-09-22 22:11:21 +10:00
Maxime Coste
3f4c86b12f Merge remote-tracking branch 'Delapouite/rename-completions' 2018-09-22 22:02:58 +10:00
Jason Felice
6c4593b18a Document that -f starts with whole file selected 2018-09-21 10:01:20 -04:00
Delapouite
d8747bc1e0 Add completion for rename-buffer, rename-client and rename-session 2018-09-20 19:01:47 +02:00
Jan-Jaap Korpershoek
35dca5866c Update documentation of region highlighter to match change in 2e0e206951 2018-09-16 19:38:18 +02:00
Maxime Coste
0c3d9ccd20 Change remove-hooks to take a regular expression
All hooks whose group match this regex will be removed.

Fixes #2380.
2018-09-12 21:26:21 +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
Frank LENORMAND
377e09abd9 src: Check that Once hooks to remove exist
Fixes #2370.
2018-09-09 13:12:47 +03:00
Maxime Coste
14f9f4c468 Fix use after delete in RemoteClient FDWatcher callback
Fixes #2357
2018-09-07 09:09:07 +10:00
Maxime Coste
15bb23865a Join highlighter parameters with a '_' to autogenerate their name 2018-09-07 09:09:07 +10:00
Maxime Coste
d73ec20285 Kakoune v2018.09.04 2018-09-04 08:22:28 +10:00
Maxime Coste
b8dbe6135c Remove leading v in archive names when generating releases 2018-09-04 08:22:28 +10:00
Maxime Coste
37e2558413 Add readline word erase bindings, throw in clipboard for good measure
Add <c-w> and <a-d> (along with <c-W> and <a-D> that work on WORDs),
and <c-y> which pastes the transient clipboard contant (which saves
big erase, such as word erase and line end/begin erase).

Fixes #2355
2018-09-04 07:55:56 +10:00
Maxime Coste
b581a4fbed Merge remote-tracking branch 'Delapouite/sync-exit-status' 2018-09-03 22:33:20 +10:00
Maxime Coste
4b7e77ae00 Change line editing bindings to match readline's
In the end, no better solution materialized so far, and custom
Kakoune line editing bindings are hard to remember. Using well
known readline bindings seems just more convenient.

Closes #800, although it does not contain all the binding proposed
by it (I might accept a few additional ones, such as <c-w>, but not
too much, I still see that as a hack pending a nicer solution).
2018-09-03 22:15:28 +10:00
Delapouite
5e75f748a2 docs: add missing -sync and exit status in autoinfo and doc page 2018-09-03 08:25:08 +02:00
Maxime Coste
a8c792706d Fix setting a prefix list option with an empty list
Fixes #2335
2018-08-30 20:27:10 +10:00
Maxime Coste
df655422d1 Merge remote-tracking branch 'Screwtapello/support-user-map-options' 2018-08-30 20:10:00 +10:00
Maxime Coste
ee39649d3a Merge remote-tracking branch 'Screwtapello/fix-slow-word-wrap' 2018-08-30 20:09:13 +10:00
Maxime Coste
872ecd472c Merge remote-tracking branch 'Delapouite/auto_complete' 2018-08-30 20:07:08 +10:00
Maxime Coste
a0ac3c8c4c Merge remote-tracking branch 'occivink/source-with-args' 2018-08-30 20:04:07 +10:00
Maxime Coste
fcaa4314f7 Merge branch 'patch-1' of https://github.com/John-Colvin/kakoune 2018-08-30 20:03:51 +10:00
Shachaf Ben-Kiki
5238c2d93d Extend source command to support parameters.
Parameters are accessible in %arg{n}, as with define-command.
2018-08-30 10:00:13 +02:00
Maxime Coste
68aba9e353 Use shell specific quoting for env vars
Add a test case to validate roundtrips between Kakoune and the
shell.
2018-08-29 07:53:59 +10:00
John Colvin
94a3b85745 Missing space at eol in write CommandDesc 2018-08-28 11:59:43 +01:00
Tim Allen
82c01c5dd3 Speed up wrapping at word boundaries.
Previously, when wrapping lines at word boundaries, we would iterate forwards
for "wrap-width" characters, then iterate backwards until we found a word-break,
which was horribly slow.

Now we record the last word-boundary we saw as we iterate forwards, getting a
result in one pass.

Fixes #2339.
2018-08-28 17:43:16 +10:00
Delapouite
c2bd4b38a0 Add toggling capabilities for <c-o> in Insert and Prompt mode
Ref #2121
2018-08-27 22:08:38 +02:00
Maxime Coste
9fdf1f1168 Merge remote-tracking branch 'ricochet1k/master' 2018-08-27 08:13:07 +10:00
Maxime Coste
b06ba627b2 Refactor whitespace highlighter into a struct 2018-08-27 08:05:00 +10:00
Maxime Coste
a32d7069c6 Try to complete command switches when an argument starts with '-'
Fixes #1467
2018-08-26 12:29:11 +10:00
Matt Peterson
d0a8426272 Use $USER if getpwuid fails 2018-08-24 10:50:59 -04:00
Frank LENORMAND
1da0af26c9 src: Make sure buffers are saved regardless of the client count
Due to a copy-paste mistake, the `:kill` command in a session with
multiple clients was the equivalent of a force-kill (`:kill!`).

This commit makes sure all buffers are saved before killing the
session, unless the force flag is specified.
2018-08-21 17:27:17 +03:00
Tim Allen
49ef9968c0 Support user-defined "str-to-str-map" options. 2018-08-21 18:24:14 +10:00
Frank LENORMAND
9a111b5ebe src: Improve error messages in RPC requests parsing
Cast errors in RPC requests currently make the client quit with an
error saying "uncaught exception", since `Kakoune::bad_value_cast`
exceptions are not explicitely handled.

This commit tries to catch ill-formatted requests and return a more
human-friendly error message, without quitting the client.
2018-08-18 09:28:30 +03:00
Maxime Coste
293610a432 Add a test case for -once hooks and code style tweaks 2018-08-16 21:09:51 +10:00
Maxime Coste
4387b1ac90 Merge remote-tracking branch 'lenormf/fix-hook-once' 2018-08-16 18:46:26 +10:00
Frank LENORMAND
97abfd403d src: Forbid empty menu entries
Empty entries in menus look weird, and don't serve any purpose. Empty
commands are still allowed.
2018-08-11 10:03:57 +03:00
Maxime Coste
f706b8c9be Add a -version switch to Kakoune
Closes #1035
2018-08-09 11:24:11 +02:00
Frank LENORMAND
e84dcf72c0 src: Allow hooks to be run only once
This commit implements the -once flag on the `:hook` command, which
automatically removes a hook after it was run, to avoid having to
declare a group and remove it in the hook implementation.

Closes #2277
2018-08-06 15:14:20 +03:00
Maxime Coste
472a5732e2 An empty string is not a valid number
Fixes #2284
2018-08-04 11:10:19 +01:00
Maxime Coste
3b77398c5b Add an assert to catch newpad returning a nullptr 2018-07-31 13:15:39 +01:00
Maxime Coste
075d1048ab Avoid invalid access to Optional
If the UI is not ok, the exit status of the client might not be
available. Return -1 in that case.
2018-07-30 10:32:38 +01:00
Maxime Coste
d2509e54f2 Fix compilation with gcc-5
Gcc-5 seems to have a bug in its handling of template variable.

Fixes #2267
2018-07-30 07:15:17 +01:00
Maxime Coste
2c9daf2378 Merge remote-tracking branch 'Delapouite/map-key-completer' 2018-07-28 19:48:24 +10:00
Maxime Coste
eef2ea5136 Lazily iterate over words instead of gathering them in a vector 2018-07-26 23:05:00 +10:00
Maxime Coste
eefe26b48b Fix shared string registry ref count stats 2018-07-26 22:20:19 +10:00
Maxime Coste
7cf3cbde8e Cleanup some trailing whitespaces and double semicolon 2018-07-26 21:56:34 +10:00
Maxime Coste
737807dde2 Replace a few loops with ranges 2018-07-26 21:23:06 +10:00
Maxime Coste
0919679e0d Make TransformView iterator's category match its underlying's
In particular, this make gathering a transformed range to a vector
faster because we can use the random access nature of underlying
iterator to get the size to allocate in the vector upfront.
2018-07-26 20:58:55 +10:00
Maxime Coste
62fa783bfd Fix missing override specifier 2018-07-26 20:16:48 +10:00
Maxime Coste
7905382b74 Obtain a new window for a client before releasing the current one
Creating a window potentially runs hooks, which themselves could
trigger shell evaluation, which could handle urgent input events
such as a resize, while waiting for the shell to finish. When that
happens, the client had a temporarily null window as it had already
released its own window.

Fixes #2225
2018-07-25 21:23:22 +10:00
Maxime Coste
a5f53dccb7 Micro optimize command parsing by avoiding utf8 decoding
Balanced quoted parsing does not need to decode utf8, neither does
unquoted word parsing. This improves startup time a bit, helping
for issue #2152
2018-07-25 20:58:07 +10:00
Maxime Coste
918fe6ddd8 Fix uninitialized context flags 2018-07-25 20:57:47 +10:00
Maxime Coste
0d6e04257b Fix memory leak in regex execution 2018-07-25 20:57:11 +10:00
Maxime Coste
b1187cf91d Quote every option type but integral types
Opt-in quoting was a bad choice, lets default to opt-out with
all integral types non quoted.
2018-07-24 20:26:24 +10:00
Maxime Coste
5f825cf0f5 Merge remote-tracking branch 'lenormf/fix-C-skip-empty-lines' 2018-07-23 21:14:23 +10:00
Maxime Coste
bbb508634e Support setting registers to empty lists
Note that empty registers still act as-if they contained a single
empty string.

Fixes #2228
2018-07-23 08:35:13 +10:00
Maxime Coste
f27700cc53 Restore SIGPIPE handler to default before spawning shell
Fixes #2238
2018-07-23 08:32:17 +10:00
Maxime Coste
6270ce4a80 Merge remote-tracking branch 'lenormf/fix-face-name-format' 2018-07-22 21:13:48 +10:00
Maxime Coste
3c51da4488 Merge remote-tracking branch 'lenormf/fix-development-version' 2018-07-22 15:58:41 +10:00
Maxime Coste
7b9f162e7d Opt-in types for quoting of option lists
This avoid quoting ints in int-lists for example, as they do not
risk containing whitespaces.

Fixes #2223
2018-07-22 15:51:32 +10:00
Frank LENORMAND
a2f9c68a7c src: Change the bullet point symbols in the version notes 2018-07-20 13:55:16 +03:00
Frank LENORMAND
60bd8df3c2 src: Don't print a number for the development version 2018-07-20 13:49:36 +03:00
Frank LENORMAND
2b0c143808 src: Allow face names to contain an underscore
Closes #2229
2018-07-20 09:47:30 +03:00