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
Frank LENORMAND
0b8899d1d4
src: Rename auto_complete
to autocomplete
...
Removing the underscore seems to make the option name more
in line with the others (even though some do use a separator,
e.g. `disabled_hooks`).
2018-07-19 18:57:33 +03:00
Maxime Coste
7195100609
Re-introduce kill_session::exit_status, @lenormf was right
...
As discussed in #2186 , in the end we need the exit status for the
case where the local client exited first (the server forked to
background) then another client trigger the kill command.
2018-07-19 19:27:56 +10:00
Maxime Coste
56a5dc66ff
Merge remote-tracking branch 'lenormf/kill-clients-exit-code'
2018-07-19 18:42:22 +10:00
Maxime Coste
40a91b1120
Add a -debug '...' switch to Kakoune startup that sets the debug option
...
This gives an easy way to profile startup by running with -debug profile.
2018-07-19 18:36:49 +10:00
Maxime Coste
7ed5d53fe6
Fix RegexCompileFlags::Backwards having the same value as Optimize
...
That means every Optimized regex had the Backwards version
compiled as well, which doubled the time it took to compile them
and doubled the memory usage of regex.
This should improve #2152
2018-07-19 18:34:40 +10:00
Frank LENORMAND
5543a4d58c
src: Propagate to clients the kill
exit code
...
Fixes #2177
2018-07-19 10:54:49 +03:00
Maxime Coste
56912dd22c
Merge remote-tracking branch 'icetan/buffer-reload-hook'
2018-07-19 08:29:22 +10:00
Maxime Coste
b1d5fda960
Reduce confusion in add-highlighter docstring
...
Closes #2222
2018-07-19 08:26:25 +10:00
Maxime Coste
c58457a3c0
Fix manual insert completion menu not getting automatically hidden
...
Fixes #2208
2018-07-15 11:46:02 +10: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
bde726d034
Change autoshowcompl to auto_complete with insert|prompt possible values
2018-07-15 11:10:32 +10:00
Maxime Coste
2f815511da
Merge remote-tracking branch 'Screwtapello/fix-info-docstring'
2018-07-14 23:17:10 +10:00
Maxim Baz
3ca424d10f
Fix description of ui_options
2018-07-13 22:46:24 +02:00
Tim Allen
591a9ab093
The info command only takes one content string, not one-or-more.
2018-07-10 17:51:57 +10:00
Christopher Fredén
ae6c214f52
Add BufReload hook which is triggered on buffer reload
2018-07-09 14:20:52 +02: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
1b5f665664
Refactor WrapHighlighter::next_split_pos to avoid non-linear complexity
...
Previous Implementation was constantly computing byte/column count
from the begining of the line, leading to a non-linear complexity
with respect to the length of a line.
Fixes #2146
2018-07-08 18:51:11 +10:00
Maxime Coste
51ec1194f1
Use a memory mapped file for sourcing
2018-07-08 17:25:12 +10:00
Maxime Coste
cde0c51cd6
Tweak comment to make it less ambiguous
2018-07-08 16:58:19 +10:00
Maxime Coste
b6933a2bdb
Fix infinite loop on SIGHUP with the NCursesUI
...
Fixes #2126
2018-07-08 15:54:01 +10:00
Maxime Coste
f89ea657ef
Fix asserts with -sync flag handling and slight code cleanup
2018-07-05 08:30:57 +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
55a5ec3bbd
Tweak how highlighter names are auto-generated
2018-07-05 07:54:28 +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
f9fda70de6
Fix add-highlighter docstring
2018-07-05 07:54:28 +10:00
Maxime Coste
63d7984b89
Fix bug in recursive region highlighting
2018-07-05 07:54:28 +10:00
Maxime Coste
6993b0f347
Fix region highlighters validation that the delegate type exists
2018-07-05 07:54:28 +10:00
Maxime Coste
96c9718144
Parse unknown switches as positional for region highlighters
2018-07-05 07:54:28 +10:00
Maxime Coste
073b630e7a
Prevent adding region/default-region highlighters to non-regions parents
2018-07-05 07:54:28 +10:00
Maxime Coste
711150f4ac
Allow removing region from regions highlighter
2018-07-05 07:54:28 +10:00
Maxime Coste
1574748d4e
Invalidate cache when RegionsHighlighter subregions are modified
2018-07-05 07:54:28 +10:00
Maxime Coste
64d0fd91ae
Auto-generate highlighter name if only path is given
2018-07-05 07:54:28 +10:00
Maxime Coste
b0ccf97b44
Refactor RegionsHighlighters to define each region as a separate command
2018-07-05 07:54:28 +10:00
Maxime Coste
c9cdae4364
Add HashMap::items to access item list
2018-07-05 07:54:28 +10:00
Maxime Coste
d6b0297ac8
Fix ParameterParser::position_from with arbitrary indices
2018-07-05 07:54:28 +10:00
Maxime Coste
b4b335155e
Refactor add-highlighter to make naming explicit
...
The highlighter name must be given as part of the path of the
highlighter, as the last element.
Fixes #1712
2018-07-05 07:54:28 +10:00
Maxime Coste
18dfecfa9d
Introduce a "double_up" function for doubling up escaping
2018-07-05 07:54:28 +10:00
Maxime Coste
6a31d0ebc7
Fix auto escaping of command argument completion
2018-07-05 07:54:28 +10:00
Maxime Coste
7abf04babd
Improve highlighting of Kakrc string regions
...
Unfortunately Strings that start with a quoted quote (like '''str')
are still incorrectly highlighted, a deeper refactoring of the regions
highlighter will be necessary.
2018-07-05 07:54:28 +10:00
Maxime Coste
eab98c88bd
Refactor handling of startup info to make it configurable
...
A new `status_info_version` option allows user to disable info
message regarding changes that happened at that version or
earlier.
2018-07-05 07:54:28 +10:00
Maxime Coste
74e4925de0
Expand %reg{} inside double quotes only to the main selection value
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
ed123a2cc9
Reference the big breaking refactoring in the startup message
2018-07-05 07:54:28 +10:00
Maxime Coste
27163106c7
Make register expansions expand to the full register content
...
Now that we have a nice standard way to express lists of strings,
registers can be fully exposed. An new $kak_main_reg_... env var
was added to provide the previous behaviour which is relied on by
doc.kak.
2018-07-05 07:54:28 +10:00
Maxime Coste
d6c6ed9bbf
Store each selection as a separate element in a register
...
It makes more sense to use the list nature of the register to store
the selections instead of storing them as a single string separated
by spaces.
2018-07-05 07:54:28 +10:00
Maxime Coste
8aba0b3cb4
Change set-register command to take a list of values
...
Registers are lists of strings, so this make it possible to set
the whole list instead of forcing registers to a single element
when going through the set-register command.
2018-07-05 07:54:28 +10:00
Maxime Coste
183f32803b
Fix selection save/restore from registers post selection list syntax change
2018-07-05 07:54:28 +10:00
Maxime Coste
087a940fbe
Add 'skip(size_t)' range utility to skip a number of elements
2018-07-05 07:54:28 +10:00
Maxime Coste
76093f252c
Change env vars that are lists to use the general list syntax
2018-07-05 07:54:28 +10:00
Maxime Coste
8b2e5ea862
Make selection lists use the option list syntax
2018-07-05 07:54:28 +10:00
Maxime Coste
b548dd3a6f
Change option lists to be specified as separate arguments on commands line
...
Option lists and maps are specified using separate arguments, avoiding
the need for additional escaping of their separator and reusing the
existing command line spliting logic instead.
As discussed on #2087 , this should make it much easier to work with
list options, and make the general option system feel cleaner.
2018-07-05 07:54:28 +10:00
Maxime Coste
5eeec8bd4d
Make expansion of strings support quoting of % by doubling up
2018-07-05 07:54:28 +10:00
Maxime Coste
c829595d01
Refactor command line parsing
...
Command line parsing now works as follow:
* Quoted strings ('...', "..." and %~...~ with '~' non nestable)
use 'doubling-up' for escaping their delimiter, if the delimiter
appears twice in a row, it is considered as part of the string and
represent one delimiter character. So 'abc''def' == "abc'def". No
other escaping takes place in those strings.
* Balanced strings (%{...}) do not support any kind of escaping, but
finds the matching closing delimiter by taking nesting into account.
So %{abc{def}} == "abc{def}".
* Non quoted words support escaping of `;` and whitespaces with `\`,
`%`, `'` and '"` can be escaped with `\` at the start of the word,
they do not need escaping (and will not be escaped) else where in
a word where they are treated literally. Any other use of '\' is a
literal '\'. So \%abc%\;\ def == "%abc%; def"
As discussed in #2046 this should make our command line syntax more
robust, provide a simple programmatic way to escape a string content
(s/<delim>/<delim><delim>/g), be well defined instead of ad-hoc
undocumented behaviour, and interact nicely with other common
escaping by avoiding escaping hell (:grep <regex> can in most case
be written with the regex unquoted).
2018-07-05 07:54:28 +10:00
Maxime Coste
24d8a58b0d
Add -with-hooks to execute-keys and make -no-hooks evaluate-commands specific
2018-07-05 07:54:28 +10:00
Maxime Coste
9082564ab7
Make -with-maps only available for execute-keys command
...
It does not make a lot of sense to have this switch for
evaluate-commands.
2018-07-05 07:54:28 +10:00
Maxime Coste
5902c7b790
Do not save any registers by default in evaluate-commands
2018-07-05 07:54:28 +10:00
Maxime Coste
ec16969609
Do not reparse %sh{...} strings
...
Automatic reparsing of %sh{...}, while convenient in many cases,
can be surprising as well, and can lead to security problems:
'echo %sh{ printf "foo\necho bar" }' runs 'echo foo', then 'echo bar'.
we make this danger explicit, and we fix the 'nop %sh{...}' pattern.
To reparse %sh{...} strings, they can be passed to evaluate-commands,
which has been fixed to work in every cases where %sh{...} reparsing
was used..
2018-07-05 07:54:28 +10:00
Maxime Coste
3b9818c10b
Merge remote-tracking branch 'lenormf/edit-readonly-flag'
2018-07-04 19:47:05 +10:00
Maxime Coste
86616c207d
Merge remote-tracking branch 'lenormf/synchronized-write'
2018-07-04 19:46:40 +10:00
Frank LENORMAND
5309b7b5e5
src: Add a -sync
flag to the write commands
2018-07-04 09:49:53 +03:00
Frank LENORMAND
dd17b20bbf
src: Allow the edit
command to create readonly buffers
2018-07-03 14:34:48 +03:00
dahlbaek
2a509ba73f
Mark unused variables with the [[gnu::unused]] attribute
2018-07-02 19:33:52 +02:00
Frank LENORMAND
266ce73de7
src: Make C
skip empty lines
...
This commits changes the way `C` behaves when the next line is empty:
instead of stopping the selection, it will now jump to the next line
that can hold a selection as big as the current one.
The primitive's count parameter holds the maximum amount of selections
that should be added to the current one.
Closes #2061
2018-06-30 14:39:15 +03:00
Frank LENORMAND
1cb51cacb7
src: Fix cycle hogging when using C
at EOF
2018-06-30 11:53:28 +03:00
Maxime Coste
43b72770ec
Fix wrong logic for moving filedescriptors leading to closed stdin
...
With this fix, tests can now use /dev/null as stdin.
Fixes #2165
2018-06-28 22:56:50 +10:00
Olivier Perret
67655de947
Use a dedicated vm op for dot when match-newline is false
2018-06-24 12:41:50 +02:00
Olivier Perret
b5ee1db1c4
Use bit-flags for storing regex regex options
2018-06-24 12:41:50 +02:00
Olivier Perret
8edef8b3f1
Add support for regex flag to toggle dot-matches-newline
2018-06-24 12:41:50 +02:00
Maxime Coste
667777521b
Refactor the way main selection is determined after rotating contents
...
Fixes #2133
2018-06-21 08:07:17 +10:00
dahlbaek
52a3e9a84d
Pass in OpenBSD binary path using preprocessor option
...
Alternative to hard coding binary path for OpenBSD
2018-06-20 14:20:55 +02:00
Patrick Marchand
dc3e4823a5
Remove extraneous include for openbsd
...
Forgot to remove this before pushing.
2018-06-20 14:20:55 +02:00
Patrick Marchand
2789857f32
Adds openbsd support
...
Seems to work on openbsd 6.3-current but needs more testing. Had to
hardcode the binary path as openbsd considers getting the executable
path at runtime a security flaw.
2018-06-20 14:20:55 +02:00
Maxime Coste
3d4ee7d201
Tweak search style menu completion display
2018-06-20 20:20:11 +10:00
Maxime Coste
b82d31016b
Do not draw menu if it would hide prompt content
2018-06-20 08:12:53 +10:00
Maxime Coste
226db75aeb
Change Search completion to display on top of the modeline
2018-06-19 21:02:24 +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
Delapouite
0bfdaf7d3e
Improve unmap command key-completer
2018-06-15 15:16:08 +02:00
Maxime Coste
665d3fa196
Fix edit -fifo without -scroll when the buffer is already opened
...
Scrolling was taking place in that case even though it was not
desired.
2018-06-13 07:11:03 +10:00
Maxime Coste
ee19497d37
Fix crash when adapting window position post buffer modifications
2018-06-13 05:00:35 +10:00
Maxime Coste
0bdde991ea
Remove unneeded Window::m_range post refactoring
2018-06-12 06:48:48 +10:00
Maxime Coste
0d3a1b5955
Try to keep window position fixed when buffer gets modified
...
Adapt window position to the changes that happened in the buffer
since last redraw.
Fixes #1989
2018-06-11 15:10:30 +10:00
Maxime Coste
df90ba5984
Extract update_ranges_ifn as a general utility function
2018-06-11 15:10:30 +10:00
Maxime Coste
539832bf29
Add position offset to Window to limit moves with search menu style
...
Window can be resized with an "offset_pos" flag, which means that
the resize took place on the top left corner of the window, leading
to a change in current window position. This is treated as temporary
and the position change is stored in a m_position_offset field.
That allows the ncurses UI to offset the position when it displays
a Search menu, so that the window does not constantly scroll when
the search menu open/closes. The window will only scroll if it needs
to in order to keep the main selectin visible.
2018-06-11 15:10:30 +10:00
Maxime Coste
60cf71bc24
Pass DisplaySetup through the HighlightContext
2018-06-11 15:10:30 +10:00
Maxime Coste
97af2ffc84
Merge remote-tracking branch 'alyssais/patch-2'
2018-06-03 12:19:09 +10:00
Maxime Coste
310e5e3bcd
NCursesUI: Use only 3 line menu for MenuStyle::Search
2018-06-03 12:17:38 +10:00
Maxime Coste
2bdbf7e379
Add MenuStyle::Search that prevents the menu from hiding buffer text
...
Fixes #2042
2018-06-03 12:17:38 +10:00
Maxime Coste
56e5322b45
EventManager: Never block if a forced file descriptor is present
2018-06-03 12:17:38 +10:00
Maxime Coste
c63502c7c6
Code cleanup and slight refactor in NCursesUI menu code
2018-06-03 12:17:38 +10:00
Alyssa Ross
7685a657ca
Fix grammar in highlight error message
2018-06-01 13:02:38 +02:00
Delapouite
b60ed6ca53
docs: fix missing ]
in wrap hl -marker switch docstring
...
Also add the related changelog entry
2018-05-30 18:11:19 +02:00
Alyssa Ross
2deb2c0294
Fix typos in add-highlighter range help
2018-05-28 13:19:12 +02:00
Maxime Coste
f06badcfd3
Fix clang compilation
2018-05-28 08:26:19 +10:00
Maxime Coste
b5693c6253
Refactor option_from_string to return directly the option value
2018-05-27 13:00:50 +10:00
Maxime Coste
2617f5e022
Add unit test for option parsing
2018-05-27 13:00:48 +10:00
Maxime Coste
f1c1de834a
Add a -marker <marker_text> switch support to the wrap highlighter
...
This makes wrapped lines very explicit.
Fixes #2065
2018-05-26 22:22:00 +10:00
Maxime Coste
68fb3ba88f
Rework fail
command not to display command call stack
...
`fail` triggers "expected" errors, and hence should just display
the provided message.
2018-05-26 21:31:17 +10:00
Maxime Coste
54b62cbef7
Do not expose C++ typeid().name to user facing errors on wrong option type
...
Fixes #2079
2018-05-26 10:01:26 +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
4ef5c80724
Fix Kakoune client busy looping on SIGHUP
...
Pure clients never quitted when they got SIGHUP after recent changes
to add is_ok to UserInterface. run_client now tracks the UI state as
well and quits if the UI gets killed.
2018-05-23 08:16:35 +10:00
Maxime Coste
56e2174cf6
Do not reuse m_buffer_trash to store dying buffers in ~BufferManager
...
Doing that clears m_buffer_trash, deleting buffers contained there,
but we are not ready to have Buffer destructors running yet as we
did not clear the ClientManager, meaning we might have free windows
pointing to buffers in the buffer trash.
2018-05-21 20:30:24 +10:00
Maxime Coste
d4e36958f8
Gather options in a vector when running Buffer::on_option_changed
...
on_option_changed might trigger hooks that will mutate the option
managers, invalidating the iterators we use.
2018-05-21 20:07:25 +10:00
Maxime Coste
919b7ce645
Fix also the implementation of to_string(size_t) change
2018-05-21 20:01:19 +10:00
Maxime Coste
edc53de8cc
Small code cleanup
2018-05-21 07:55:07 +10:00
Maxime Coste
b7dabf11f2
Fix incompatible to_string function declaration when size_t is unsigned int
2018-05-21 07:53:21 +10:00
Maxime Coste
ec0f8fe574
Extend try
command to support multiple catches.
...
If a catch command fails, and another catch is availabe following
it, that following catch gets executed.
2018-05-19 14:15:16 +10:00
Maxime Coste
243cfbc4ae
Fix behaviour of extending to next match when wrapping
...
If the search wraps to get to next match, drop that selection when
extending.
2018-05-19 14:15:16 +10:00
Maxime Coste
14d12fac04
Rename -allow-override switch to -override
...
Closes #2057
2018-05-19 14:15:16 +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
79b60f69a9
Small code cleanups
2018-05-17 22:55:53 +10:00
Maxime Coste
b22c8ad8c7
Fix potential missed redraws
2018-05-17 22:50:11 +10:00
Maxime Coste
b0577d07f6
Merge remote-tracking branch 'Screwtapello/newlines-after-json-errors'
2018-05-17 07:47:34 +10:00
Maxime Coste
9bd3231d9b
Avoid needless constant allocation in StaticRegister::set
2018-05-17 07:41:32 +10:00
Maxime Coste
4cc9c9997e
compute_line_modifications: avoid potentially long iteration
2018-05-17 07:41:32 +10:00
Maxime Coste
fcce76ba57
Handle all pending events before redrawing
...
If new events happen while handling events, take care of those
new events as well before redrawing.
2018-05-17 07:41:32 +10:00
Tim Allen
0af53fb0dc
Print a newline after errors in the JSON UI.
...
This makes them just a little easier to read.
2018-05-16 23:26:05 +10:00
Maxime Coste
75eb293f98
Rename Context::Flags::Transient to Context::Flags::Draft
...
Draft is well establish and all draft context are transient.
2018-05-14 08:23:00 +10:00
Maxime Coste
b204e773d4
Do not push jumps implicitely in transient contexts
...
This should improve performance in draft contexts.
2018-05-14 08:23:00 +10:00
Maxime Coste
288cf6de73
Fix performance problem when generating many values for # register
...
Fixes #2008
2018-05-09 23:02:53 +10:00
Maxime Coste
327d8ad759
Mark Client, Window, Buffer and OptionManager as final
...
Avoids warning about non virtual destructor calls on them,
as they have a vtable due to OptionManagerWatcher.
2018-05-09 23:01:40 +10:00
Maxime Coste
e8c648b7b7
Store the timestamp at which a display buffer was generated
...
Coordinates inside a display buffer are only valid for a certain
buffer content, they cannot be used once the buffer has been
modified.
Fixes #2034
2018-05-08 21:56:44 +10:00
Maxime Coste
148d6c205b
Fix wrong behaviour in select surrounding
...
Fixes #2030
2018-05-07 22:17:57 +10:00
Maxime Coste
7a841dcca7
Remove out of date noexcept(false) on MessageWriter destructor
...
This made sense when the writer was trying to send the message
in its destructor, but this is not the case anymore.
2018-05-05 07:59:13 +10:00
Maxime Coste
da1d78a3c2
Do not let exception propagate out of register restoring lambda
...
It is called during a std::vector destruction, which is noexcept,
leading to terminate being called.
2018-05-05 07:57:37 +10:00
Maxime Coste
7325ad216c
Add support for explicit menu selection from the UI
...
the JsonUI now supports a "menu_select(int)" RPC call that should
trigger explicit selection of the provided item index.
As discussed for issue #2019 .
2018-05-03 22:28:20 +10:00