Commit Graph

5290 Commits

Author SHA1 Message Date
Ben Judd
161ca6d4d1 hash unit tests. 2021-04-17 13:19:35 -07:00
Taupiqueur
aa6ec5987c Fix edit -readonly command not setting readonly option 2021-04-14 02:36:25 +02:00
Tw
41833d7b7d fix line completion with prefix
There's a bug in current line completion, fix it.

Signed-off-by: Tw <tw19881113@gmail.com>
2021-04-11 11:54:48 +08:00
nojhan
daa63ba879 [feat] add ui_options: padding_char & padding_fill
In some cases, it may be difficult to easily spot the area out of the buffer
(bad color scheme, small font, superimposed windows).

This patch adds two ncurses ui_options to bypass this problem:
- `ncurses_padding_char`, to configure the padding character,
- `ncurses_padding_fill`, to indicate whether to fill the padding line
  (or to display a single character).

The default config is the legacy one (a single "~").
2021-04-05 20:21:48 +02:00
nojhan
ba344be51f fix show-whitespace: add missing NNBSP character
- Add the Narrow No-Break SPace (0x202F, NNBSP) to the list of handled
  spaces in the show-whitespace highlighter.
- Do not add an aditional option, just handle it like NBSP, with the same highlight character.
2021-03-31 15:28:23 +02:00
Maxime Coste
4be6df9d02 Parse more data at each fifo buffer read 2021-03-31 17:19:20 +11:00
Maxime Coste
da9a196fa0 Profile individual command runtime
Different approach than the one suggested by eraserhd

Closes $4095
2021-03-31 17:17:22 +11:00
Maxime Coste
d1e19727ff Tweak completion quoting behaviour once again
Quote by wrapping in quotes if we are replacing the whole token,
using backspaces if the completion only adds to it.

This ensure that the inserted completion will be correctly parsed
once validated.

Fixes #4121
2021-03-31 17:15:31 +11:00
Tim Allen
3aaf32f48f src/ncurses_ui: Teach Kakoune about all the numeric keypad keys.
Kakoune now knows about all the keypad keys listed in:

https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-PC-Style-Function-Keys
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-VT220-Style-Function-Keys

The VT220-style encodings are used to for modified numeric keys when NumLock is
off. For example, consider the 8/Up key:

| Modifiers       | Sequence    | Notes             |
|-----------------|-------------|-------------------|
| Unmodified      | CSI A       | Ordinary up arrow |
| Shift           | SS3 2 x     | Shift-8           |
| NumLock         | 8           | Ordinary 8        |
| Shift + NumLock | CSI 1 ; 2 A | Shift-Up          |

Note that even though the terminal distinguishes between keypad and regular keys,
Kakoune maps keypad keys onto regular keys - keypad Enter is still <ret>, it
just supports more modifiers than the regular Enter key.
2021-03-26 15:43:42 +11:00
Tim Allen
f7c1702965 src/ncurses_ui: move the parse_mask() helper outside parse_csi().
It's useful for parsing modifier masks in all kinds of sequences, not just CSI
sequences. Also, since the modifier mask always has "1" as "no modifiers",
do the subtraction inside parse_mask() instead of when calling it.
2021-03-26 15:17:41 +11:00
hss
49f5917125 Rename separator-cursor to cursor-separator 2021-03-22 19:38:33 -04:00
hss
3e539c963e Don't use optionals for storing active separator string 2021-03-21 19:52:19 -04:00
hss
07e2b03c11 Only use separator-cursor for the first line number in a wrapped line 2021-03-20 21:53:31 -04:00
hss
73ecd3356f Compare column_length of line-number separators 2021-03-20 21:33:53 -04:00
hss
8df2bb8bd5 Use optionals more wisely in line-numbers 2021-03-20 02:48:33 -04:00
hss
f16783b0a8 line-number: Add option to use a different separator on the current line 2021-03-19 23:23:01 -04:00
Maxime Coste
545db22ae4 Fix typo in file.cc 2021-03-12 09:10:19 +11:00
Maxime Coste
8e463e63ea Do not use replace write method when writing to a non-regular file
Fixes #4098
2021-03-11 20:48:44 +11:00
Maxime Coste
d5282735f2 Always redraw after getting some user input 2021-03-11 09:08:35 +11:00
Maxime Coste
4a59018dcd Do not select on non-urgent fd when handling only urgent events
This avoids 100% CPU usage when we have pending fifo input while running
a shell process, as we will not end-up busy looping in pselect but not
reading the available data due to being only processing urgent events.
2021-03-11 09:02:02 +11:00
Maxime Coste
0b234f7f67 Merge remote-tracking branch 'eraserhd/fifo-performance-fixes' 2021-03-11 07:49:20 +11:00
Jason Felice
d3824f3211 Use inplace_merge() for ranges 2021-03-09 10:13:31 -05:00
Jason Felice
c9be6730f6 Binary search for first range to change 2021-03-08 16:55:43 -05:00
Maxime Coste
f6c8ebc4d0 Refactor pipe reader/writer 2021-03-04 20:59:15 +11:00
Maxime Coste
da80a8cf6a Raise ThreadedVM initial thread capacity to 16
Threads are 4 bytes, an initial capacity of 4 led to allocating 16
bytes, raising that to 64 bytes seems quite reasonable.
2021-03-03 20:51:24 +11:00
Maxime Coste
f4a639e078 Re-use the Regex VM when completing filenames to reduce allocations
By re-using the VM we avoid re-allocating the threads and saves
buffers over and over again. We can just re-use the ones from the
previous matching.
2021-03-03 20:33:02 +11:00
Maxime Coste
eb292f1f00 Re-tweak command name completion behaviour
It turns out the fix for #4061 was breaking auto-selection with
space of command names.
2021-03-02 20:20:58 +11:00
Jacob Collins
9dfab2f1fb Follow ECMA specification for regex whitespace
Changes the behaviour of the \s and \h character classes to include
all WhiteSpace and LineTerminator characters defined in the ECMA
specification.
 - <https://262.ecma-international.org/11.0/#sec-white-space>
 - <https://262.ecma-international.org/11.0/#sec-line-terminators>
 - <https://262.ecma-international.org/11.0/#sec-characterclassescape>

Fixes #4034
2021-02-25 11:03:18 -05:00
Maxime Coste
7c321e121d Tweak requoting behaviour
Only requote when completion is replacing the whole token

Do not requote command names as they should not require it, tag
them as quoted.

Fixes #4061
2021-02-25 21:04:06 +11:00
Maxime Coste
978dfe4bdf Fix splitting display line in front of a replaced range
When a replaced buffer range atom was starting exactly at the
location we wanted to split onto the code would split *after*
that atom instead of before.

Fixes #4052
2021-02-16 12:35:25 +11:00
Maxime Coste
fa3aa3c1a3 Add + key to duplicate selections and <a-+> to merge overlapping ones
This is an experiment and might get reverted if overlapping selections
prove too cumbersome.

Fixes #4041
2021-02-15 09:01:14 +11:00
Maxime Coste
e6905552cf Fix CSI u support for escape key 2021-02-11 20:23:08 +11:00
Maxime Coste
26cf5cd1dc Fix resizing strings to -1 length
Fixes #4042
2021-02-01 20:16:30 +11:00
Maxime Coste
7751c7e188 Check XDG_RUNTIME_DIR owner before creating session directory
This avoids an issue when using `su` and running Kakoune which creates
a session directory owned by root and prevents the user from creating
more sessions.
2021-01-26 09:28:24 +11:00
Maxime Coste
74fc52b3de Write to stderr if execve fails
This should be rare but should not happen silently, this way it will
show in the parent process debug buffer.
2021-01-22 17:22:15 +11:00
Maxime Coste
04a64e6e29 Fix performance issue in show-matching highlighter on big buffers
Stop searching for the matching character when getting out of view
instead of going until the buffer edge.
2021-01-22 17:21:59 +11:00
Maxime Coste
0fd5a9d995 Slight code cleanup in generate_env 2021-01-22 17:21:59 +11:00
Tim Allen
a7ed1f03fb Distinguish <c-h> and Backspace on terminals where that is possible.
Different terminals send different codes to indicate backspace, usually one of
\x08 or \x7f, so Kakoune blindly treated both as backspace. However, a given
terminal is only likely to use one of those, and mnemonic control codes like
<c-h> are a precious resource so we should endeavour to keep backspace and
<c-h> separate when we can. Luckily, termios tells us what code our terminal is
currently using, and Kakoune already reads the information at startup, so we can
just use that information.

Thanks to @krobelus for figuring out the C++ syntax required.

Fixes #3863.
2021-01-15 18:49:53 +11:00
Maxime Coste
df7b33bc7b Merge branch 'master' of http://github.com/Woolworths/kakoune 2021-01-04 09:50:45 +11:00
Maxime Coste
49d1d4666d Merge remote-tracking branch 'cole-h/trim-only-one-newline' 2021-01-04 09:45:53 +11:00
Cole Helbling
7cde146807
command_manager: only remove last eol in %sh{} expansions
This makes it possible to keep significant EOL in shell expansions (e.g.
for use with clipboard helpers).
2021-01-02 19:53:40 -08:00
Maxime Coste
f1e45579a6 Merge remote-tracking branch 'jimt/master' 2021-01-03 11:15:11 +11:00
Maxime Coste
a0c23ccb72 Add missing limits includes
Fixes #4003
2021-01-03 10:58:09 +11:00
Jim Tittsler
a7fb4c042a Fix message typo 2021-01-01 15:15:27 +09:00
Maxime Coste
958a943121 Avoid non-POSIX ln -r switch
Fixes #3985
2020-12-25 12:07:13 +11:00
Cole Helbling
266e388c6b
commands: add "registers" subcommand to :debug
This prints all non-empty registers and their value(s) to the `*debug*`
buffer.
2020-12-23 14:22:44 -08:00
Jean Abed
650a7143be remove unused variable changes_tracker 2020-12-22 21:31:11 +11:00
Maxime Coste
e50b5fe137 Add Timer::disable() to be more explicit than set_next_date(TimePoint::max()) 2020-12-20 11:32:15 +11:00
Maxime Coste
74c337df5d Add a libexec/ directory and use it to find the kak command
Add that libexec directory to the PATH instead of the current kak
binary directory to avoid impacting other commands.

The libexec directory currently only contains a symlink back to
the Kakoune binary.
2020-12-09 09:13:45 +11:00
Maxime Coste
489404befa Merge remote-tracking branch 'occivink/no-sel-remaining-alt-space' 2020-12-05 08:47:04 +11:00
Olivier Perret
f2fb5a3214 Throw no_selections_remaining when using <a-space>
This makes it possible to use the mechanism introduced by 91386a53
2020-12-03 21:42:14 +01:00
Maxime Coste
95606d2336 Avoid potential use after free of the mode name
This can be an issue with NextKey that now does not have a static
mode name.
2020-12-01 21:56:55 +11:00
Maxime Coste
586f79c30d Ensure InputModes are kept alive during their idle logic
Various paths can run arbitrary commands (callbacks, hooks) which
could lead to the InputMode being popped off the mode stack, but
contrarily to the on_key method, we had no guarantees to be kept
alive.

Add a keep_alive RefPtr to this to ensure the mode survives till
the end.

Fixes #3915
2020-12-01 20:00:38 +11:00
Maxime Coste
a8d43ce6ce Merge remote-tracking branch 'AndrewVos/ignore-indent-on-line-completion' 2020-11-22 16:52:37 +11:00
Andrew Vos
f3f3f80624
Ignore indent when completing lines
When doing line completion, we previously used to not complete the line
if it had different indent to the potential completion.

This commit changes the behaviour to ignore indentation when completing lines.
2020-11-20 20:00:46 +00:00
Maxime Coste
161aa918df Restore auto-select on return, add a flag to disable that for commands
Fixes #3849 Again
2020-11-18 19:56:05 +11:00
Maxime Coste
14dbe63b4f Revert "Auto-insert prompt menu completions on <ret> if any text was entered"
Unfortunately this breaks some pretty useful use cases, such as inserting a
command ending with a new-line (as it now leads to an addtional command being
auto-completed on validation)

This reverts commit aab0be529f.
2020-11-17 07:03:14 +11:00
Maxime Coste
b09a0f5779 Merge remote-tracking branch '6112/msys2-wcwidth' into master 2020-11-11 07:36:44 +11:00
Maxime Coste
3ae2a5c2f6 Fix performance issue with word completion
When pasting many words with <a-p> we can end-up with a huge
concatenated word and many selections, the previous code ended
up iterating from each selection cursor to that word start and
end to find the word under the cursor.

This could lead to performance issue as each selection would
trigger iteration on that huge word. This is unnecessary as
word completion has a word length limit, so we now take it into
account to avoid iterating to far from the cursor position.
2020-11-07 10:42:51 +11:00
Maxime Coste
b1745ee8d3 Fix performance issue when pasting many selection
The previous code was advancing from the general insertion point
for all selection, instead of iterating only once from insertion
point until the end of inserted text.
2020-11-07 10:14:18 +11:00
Maxime Coste
94ac3084e1 Handle reading from stdin returning 0
0 means stdin was closed, this is quite unexpected as we would usually
get a SIGHUP, but it looks like in some rare case this happens and
it leads to an infinite loop trying to handle stdin events (as it
will always be readable from now on).

Fixes #3557
2020-11-02 22:54:54 +11:00
Maxime Coste
aab0be529f Auto-insert prompt menu completions on <ret> if any text was entered
Previously we would only auto-insert if the current token had some
text, but this breaks auto-selection of the first match.

Fixes #3849
2020-11-01 10:32:44 +11:00
Tim Allen
c039879c82 src/ncurses_ui.cc: Teach Kakoune about ctrl-symbol keys.
Previously, Kakoune only handled ctrl-codes less than 27, representing them as
lower-case ASCII codes. For regular keys like <c-a>, that worked fine. However,
NUL became the unorthodox <c-`> and other ctrl-symbols (<c-\>, <c-]>, <c-_>)
weren't supported at all.

Now NUL is rendered as the more comfortable <c-space>, and the other ctrl-symbol
codes are properly decoded.

Fixes #2553.
2020-10-31 01:20:49 +11:00
Maxime Coste
90043e7df0 Replace write -atomic with write -method <method>
`-atomic` becomes `-method replace` and `-method overwrite` is now
supported explicitely instead of only available through the
writemethod option.

Fixes #3827
2020-10-27 20:20:18 +11:00
Maxime Coste
9a5cf2fc9f Support explicit register for :, |, ! and $ commands
Giving an explicit register uses its content for the default value
to use if the user does not enter anything. This enables:

`set-register a %{commands}; execute-keys '"a:<ret>'`
`set-register a %{shell script}; execute-keys '"a|<ret>'`
...

This provides a nice way to avoid the need to escape keys to use
those normal mode commands.

Fixes #3825
2020-10-20 21:56:51 +11:00
Maxime Coste
354cfd3b8f Disable auto-insertion of menu completion when no text was entered
This avoids a frustrating behaviour where Kakoune autoinserts the first
command name when hitting <space> after a ; in a command line. It also
fixes the empty prompt case that was auto-completed instead of executing
the default command.
2020-10-20 21:43:34 +11:00
Maxime Coste
4d22b405d6 Notify prompt completion changes in startup message 2020-10-20 21:05:26 +11:00
Nicolas Ouellet-payeur
4a59db1bd1 Fix wcwidth() compile error with MSYS2
We try to detect when compiling under Cygwin, so we can set the
_XOPEN_SOURCE define which lets us use wcwidth(). We look for the
string "CYGWIN" in the uname, which looks like:

    CYGWIN_NT-10.0

MSYS2 is also based on Cygwin, so all of the above should still work.
However, we detect Cygwin by looking for the string "CYGWIN" in the
uname. In MSYS2, the uname looks like:

    MSYS_NT-10.0-18362

This patch looks for the string "_NT" instead of the string "CYGWIN"
in the uname, since it's common to both environments. This fixes a
compilation error on MSYS2.
2020-10-19 09:36:25 -04:00
Maxime Coste
65587d1eee Auto-insert best completion on space for menu completions
The menu flag signifies that only the completions are valid arguments,
hence it makes sense to auto insert the best one on space.

Because full match is always considered the best match in completion
ranking, this should always have a reasonable behaviour.

This makes it harder to enter a hidden command, but completion can
always be disabled via <c-o> or by quoting in those rare cases.
2020-10-19 21:43:03 +11:00
Maxime Coste
2cd323b314 Allow quiting last client with unsaved buffer in daemon mode
Because the server will out-live that client's disconnection it
is still ok to have modified buffers, the server will complain
on `kill`.

Fixes #3801
2020-10-19 20:39:25 +11:00
Maxime Coste
97e88b6087 Remove the rename-client's nc alias
Closes #3789
2020-10-19 20:30:33 +11:00
Maxime Coste
def37a6ff4 Merge remote-tracking branch 'm-kru/vhdl' into master 2020-10-19 20:06:25 +11:00
Maxime Coste
f549190a98 Add support for explicit completion in prompt mode 2020-10-19 19:36:58 +11:00
Maxime Coste
f6c67f7831 Code cleanup in insert completer 2020-10-12 12:41:52 +11:00
Maxime Coste
246a32797a Fix region regexes incorrectly matching ^$ at end of line
Because no flags were set for regex matching, the regex engine was
assuming that the subject string past-the-end matched a end-of-line.
As the subject string already ended with a \n character, the regex
engine processing of the "past-the-end" position would match '^$'
as ^ matched past the existing \n and $ matched the assumed
end-of-line.

Fixes #3799
2020-10-12 12:41:21 +11:00
Maxime Coste
6a9b34e5c8 Merge branch 'add-illumos' of http://github.com/luka-devnull/kakoune into master 2020-09-30 19:38:52 +10:00
Maxime Coste
5d17e1132f Ensure that the capture group actually matched in select_matches
We were creating selections from default constructed iterators,
which happened to have 0,0 coords and led to out-of-order selection
lists.

Fixes #3757
2020-09-22 21:14:40 +10:00
luka null
1296922d66 Add illumos/Solaris support 2020-09-18 05:22:25 -05:00
Maxime Coste
ec3d7c3104 Add support for removing from options
`set -remove ...` will remove from the current option value, substracting
from int, removing elements from vectors and maps.
2020-09-09 21:00:30 +10:00
Maxime Coste
e0d2602e6a Kakoune 2020.09.01 2020-09-01 20:37:20 +10:00
Maxime Coste
1fd1a0052d Trigger InsertCompletionHide hook when switching to explicit completion
Previously we would just bypass that hook making it impossible to
act on the inserted text when triggering an explicit completion after
inserting text from the previous completer.
2020-08-30 10:35:15 +10:00
Maxime Coste
f56c1107e0 Fix face attributes to string conversion with F shorthand
Previously a `F` attribute would end up being converted to Ffga which
is confusing as F *means* fga.
2020-08-30 10:12:21 +10:00
Maxime Coste
1020438462 Clear inserted_ranges after updating insert completions candidates
They were getting out-of-sync with the stored timestamp, leading
to invalid ranges being computed and crashes.

Fixes #3666
Fixes #3571
2020-08-18 20:35:48 +10:00
Maxime Coste
40aa687601 Do not fork in daemon mode
Leave that to the shell or external service management tools

Fixes #3618
2020-08-17 19:56:00 +10:00
Maxime Coste
669048f458 Rename DefinedHighlighters to SharedHighlighters
Matches the user facing name and seems more correct.
2020-08-08 11:19:02 +10:00
Maxime Coste
5aa657b150 Merge remote-tracking branch 'eraserhd/runtime-var' 2020-08-06 20:15:38 +10:00
Jason Felice
a52822d965 Override runtime by setting $KAKOUNE_RUNTIME 2020-08-04 11:48:34 -04:00
Maxime Coste
2c437cfa02 Kakoune 2020.08.04 startup info 2020-08-04 19:40:43 +10:00
Johannes Altmanninger
266fe6f659 Support count argument for [s and ]s
Part of #795
2020-08-02 11:30:14 +02:00
Johannes Altmanninger
98a1afcab0 Support count argument for [p and ]p
Part of #795
2020-08-02 11:30:14 +02:00
Maxime Coste
39ad6a5bda Do not flush input buffer in UI creation
Fixes #3635
2020-08-02 16:19:13 +10:00
Maxime Coste
e3f3297334 Fix alpha of merged faces 2020-07-31 15:45:52 +10:00
Maxime Coste
c2516f02f6 Do not trigger RegisterModified hooks on register about to be restored
This greatly reduces the amount of hooks triggered.
2020-07-21 20:27:42 +10:00
Maxime Coste
47ba36c66e Add a RegisterModified hook
This one has been a long time coming, I am still concerned this could
impact performance a lot. This hook does *not* trigger for capture
registers (0-9) or any other dynamic registers (that are not writable).

Fixes #859
2020-07-19 12:56:55 +10:00
Maxime Coste
5df8073c3c Code style tweaks 2020-07-19 12:54:41 +10:00
Maxime Coste
60dda1a597 Handle SIGTERM as a graceful exit, similar to the :kill! command
Do not backup modified files, go through graceful destruction of
singletons.

Fixes #3528
2020-07-07 20:41:40 +10:00
Maxime Coste
8abf18209e Fix selections getting unsorted on scroll
Fixes #3478
2020-07-05 10:13:57 +10:00
Maxime Coste
f2cc7bc891 Add User hook support 2020-07-04 13:48:27 +10:00
Igor Böhm
d79b005323 Fix 'error: non-constant-expression cannot be narrowed...'
ncurses_ui.cc:759:59: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'Key::MouseButton' in initializer list [-Wc++11-narrowing]
                return mouse_button(mod, Key::MouseButton{code}, coord, c == 'm');
                                                          ^~~~
2020-06-28 23:32:12 +02:00
Maxime Coste
d3374e7e5f Refactor mouse press/release handling to support 3 buttons
Change button to be an additional parameter instead of having separate
events for left/right buttons.

Fixes #3471
2020-06-28 19:48:55 +10:00
Maxime Coste
fc3e5ea419 Refactor how InsetCompletionHide hook parameter is computed
Keep track of inserted ranges instead of trying to re-derive them.

Fixes #3556
2020-06-27 13:33:50 +10:00
Maxime Coste
f5127f8b22 Merge remote-tracking branch 'lenormf/key-percent' 2020-06-25 20:58:26 +10:00
Maxime Coste
d4487d3bfc A module is not loaded after failing during load
distinguish the loading from loaded state, detect recursive loading.
2020-06-16 19:08:10 +10:00
Maxime Coste
f75d49e9ef Do not include non-primitive option value in *SetOption hook filter
Only include the value for int/str/bool options, for the rest just
write '<option name>=...'.

This should reduce the cost of some patterns such as repeatedly adding
a value inside a list option.

It seems very unlikely that the actual value would be matched by
a hook regex string for non primitive types.
2020-06-09 21:38:47 +10:00
Maxime Coste
66f15cf4ad Fix select wiping captures
It turns out `v = std::move(v)` with v a std::vector is not a no-op,
it clears the vector.
2020-06-07 14:12:54 +10:00
Frank LENORMAND
24c5169400 src: Introduce a <percent> named key
Similarly to the <semicolon> key, make it easier to write
`:execute-keys` commands by replacing <percent> with `%`.

Highlighters can keep escaping the sign when regular expressions are
not quoted, but built-in scripts that use `%` as an editing primitive
have been modified to use the named key, for clarity.
2020-06-03 15:42:38 +03:00
Maxime Coste
0fba373d1d Replace some tag dispatch with if constexpr 2020-06-01 20:46:48 +10:00
Maxime Coste
ec4980df34 Merge commit 'krobelus/05-highlight-replace-ranges-crash^' 2020-05-30 09:18:35 +10:00
Maxime Coste
08e0b663f7 Fix unintended interpretation of ranges length syntax
Ranges specified with a +<length> were inconsistent, with +0 meaning
an empty range, while +1 meant a two character long range (first character
+ the following one). Change that to mean a single character.

Fixes #3479
2020-05-29 12:25:57 +10:00
Maxime Coste
63371da8aa Avoid to_remove vector in select helper function
Remove the need to allocate anything when removing selections.
2020-05-29 12:00:02 +10:00
Maxime Coste
94f33bb638 Add a range based remove_if overload 2020-05-29 11:59:03 +10:00
Johannes Altmanninger
13a6aa2fbd refactor: remove extra semicolons 2020-05-28 20:04:32 +02:00
Maxime Coste
109abbeed4 Fix invalid regions with begin > end being generated
Fixes #3495
2020-05-28 20:58:46 +10:00
Maxime Coste
aad20f6576 Merge remote-tracking branch 'krobelus/paragraph-begin-oob' 2020-05-19 19:17:03 +10:00
Maxime Coste
af175d2e7e Output debug memory stats in a nice table 2020-05-19 17:16:37 +10:00
Johannes Altmanninger
fc63eef695 Fix crash when selecting previous paragraph at buffer begin
Fixes #3489

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

```
a paragraph

C	after <a-[>p, the first two lines will be selected
```
2020-05-17 14:15:48 +02:00
Johannes Altmanninger
08509cb408 Refactor: use is_eol() as elsewhere in this function 2020-05-17 14:11:45 +02:00
Maxime Coste
5fd548d5cf Fix use of unportable MSG_CMSG_CLOEXEC 2020-05-17 21:28:40 +10:00
Maxime Coste
151eb3299d Fix CSI u parsing of some special keys 2020-05-12 08:50:27 +10:00
Maxime Coste
60154300f9 Support piping data to client stdin
Pass the client stdin fd to the server and open a fifo buffer
from it.

Fixes #3394
2020-05-10 19:30:13 +10:00
Maxime Coste
2104af0771 Fix select_sentence going past the end of the buffer
Fixes #3472
2020-05-10 15:13:15 +10:00
Maxime Coste
f4efde7e08 Merge remote-tracking branch 'krobelus/kak-c-initial-buffer-pos' 2020-05-03 13:20:44 +10:00
Maxime Coste
2fca4e5643 Fix traling whitespaces 2020-05-02 13:02:10 +10:00
Maxime Coste
ccecd5bd8e Add support for alpha channel in colors
This makes it easier to define faces that lighten/darken whatever
they apply on.
2020-05-02 12:57:36 +10:00
Johannes Altmanninger
c010f14a7c Fix +line:col initial buffer position when connecting to session
A command line argument like +line[:column] can be used to specify a
target line and column for the first file.

This did not work when connecting to a session, because the client
opens its file parameter with `-e "edit file1; edit file2"` which is
executed after the initial buffer position is set. Work around this by
passing the position to the first file and avoid moving the cursor
in unrelated files.

Reproduce:

	kak -s foo
	kak -c foo +4:11 README.asciidoc
2020-05-01 10:05:37 +02:00
Maxime Coste
ceff2286af Fix clang compilation 2020-04-27 17:41:09 +10:00
Maxime Coste
35e8e12b12 Merge branch 'netbsd-1' of https://github.com/krytarowski/kakoune 2020-04-27 17:40:33 +10:00
Maxime Coste
954373d3cf Support multi-line replace-ranges
This likely has lots of rough edges, but should be an initial proof
of concept to support folding.
2020-04-27 17:39:21 +10:00
Maxime Coste
cb119251bc Do not replace partially selected ranges in replace-ranges highlighter
Partially selected ranges should not be replaced to make it possible
to see what is actually selected.
2020-04-27 17:39:21 +10:00
Maxime Coste
0fdfbdfd15 Fix highlighting empty ranges at end of line and begin of line 2020-04-27 14:31:26 +10:00
Maxime Coste
fde4c60dd9 Factor option based highlighters 2020-04-27 14:31:26 +10:00
Kamil Rytarowski
22931bdc1f Fix get_kak_binary_path() for NetBSD
Pass correct mib[] to sysctl(3).
2020-04-23 03:24:24 +02:00
Maxime Coste
a33b938652 Fix issue with select object and empty matches 2020-04-21 13:21:35 +10:00
Maxime Coste
562ee6143a Parse ascii newline/tab/escape as special keys instead of control keys
Fixes #3439
2020-04-13 12:44:15 +10:00
Maxime Coste
8000cd092f Fix internal command naming 2020-04-13 12:24:45 +10:00
Maxime Coste
91e3a58a3a Merge remote-tracking branch 'lenormf/fix-3410' 2020-04-13 11:09:08 +10:00
Maxime Coste
0fb479f0c2 Merge branch 'netbsd' of http://github.com/niacat/kakoune 2020-04-09 07:42:53 +10:00
Maxime Coste
f7a2ecfacb Support empty ranges in replace-ranges highlighter 2020-04-06 11:23:47 +10:00
Maxime Coste
c585107ab5 Add -override support to add-highlighter
This allow replacing a highlighter in place, not loosing its current
position in its parent.

Fixes #3436
2020-03-30 21:04:01 +11:00
Maxime Coste
b42885ef71 Fix empty strings not being zero terminated 2020-03-29 20:28:56 +11:00
Maxime Coste
8f30e37507 Untie focus reporting and mouse handling 2020-03-27 07:54:21 +11:00
nia
7d4a83a449 || -> or for consistency 2020-03-22 11:00:27 +00:00
nia
28982aae92 Fix build on NetBSD 2020-03-22 10:49:06 +00:00
Maxime Coste
3c265acd6c Remove posB from information given by the diff algorithm
posB is always the sum of previous add len and previous keep len,
so very easy to keep track of.
2020-03-20 20:27:50 +11:00
Maxime Coste
401ef84a4b Remove uses of reverse_iterator in diff implementation 2020-03-20 20:24:42 +11:00
Frank LENORMAND
07d702e419 src: Fix a compilation bug with g++-8
The Ubuntu Disco distribution comes with `g++` v8 installed by default,
which is not able to deduce the return type of a particular call to
`transform()`.

This commit explicitly declares the return type to mitigate that
problem, and allow the file to compile.

Fixes #3410
2020-03-17 09:00:29 +03:00
Maxime Coste
1b28a19058 Merge remote-tracking branch 'Anfid/scroll-test' 2020-03-15 12:32:54 +11:00
Maxime Coste
09375edf54 Merge remote-tracking branch 'occivink/arrange-buffers' 2020-03-15 12:18:04 +11:00
Maxime Coste
7545fa58ae Fix invalid access to deleted line when updating insert completion
The computation of the completion end position was taking place too
early, before we checked if the buffer did get modified.

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

Fixes #3398
2020-03-14 12:58:22 +11:00