Commit Graph

5212 Commits

Author SHA1 Message Date
Maxime Coste
95b0627e54 Fix focus_in/focus_out keys not having user friendly names 2021-05-28 20:32:12 +10:00
Maxime Coste
049b9a28d1 Fix File Buffer flag not being correctly applied 2021-05-28 20:31:28 +10:00
Maxime Coste
fb9dbfed2a Canonicalize <s-ascii> into uppercase in csi key parsing code
Fixes #4159
2021-05-28 20:15:56 +10:00
Maxime Coste
e4a23a64fa Support opening files bigger than 2 GiB
The real technical limit is with lines bigger than 2 GiB and buffers
with more than 2 Gi lines, refactor buffer loading to make it possible
to load those files.

Fix an overflow with the hash_data function at the same time
2021-05-28 17:03:41 +10:00
Maxime Coste
0cecea6593 Fix completion past explicitely closed tokens
This fixes an issue where completion would still be provided after
the closing character of a token, which could then get frustrating
combined with auto-insertion of completions.

For example, inserting `%{<newline>}` for a command-completed token
(such as the commands for a hook) would still trigger completion right
after the `}` and that completion would get auto-inserted **replacing**
that closing `}`.
2021-05-18 20:50:56 +10:00
Maxime Coste
47c0d20388 Request xterm 'modifyOtherKeys' mode to opt-in CSI u key reporting
Various terminal emulators now support this `CSI > 4 ; 1 m` sequence
to enable CSI u style reporting, opt into it on startup.

Closes #4103
2021-05-02 17:06:43 +10:00
Maxime Coste
db9ef82398 Rework session directory logic
Do not use a shared kakoune/ directory for all users to avoid the
complexity of having to set the sticky bit on that dir, resolve the
session directoy only once by using a static variable and an
immediately evaluated lambda.

This fixes an annoyance whenver using `su` and having Kakoune refuse
to start due to XDG_RUNTIME_DIR still being set.
2021-05-01 15:29:50 +10:00
Maxime Coste
2288be3257 Merge remote-tracking branch 'markus-oberhumer/ux-improve-prompt' 2021-05-01 14:37:54 +10:00
Markus F.X.J. Oberhumer
e57fe4fb90 Improve prompt handling
As a long time vi user I find it highly irritating that
you cannot backspace out of the command prompt.
2021-04-30 19:42:08 +02:00
Tim Allen
f78adeda49 src: Fix mouse modifier support in the ncurses UI.
For historical reasons, mouse events represent keyboard modifiers as a bitfield,
but keyboard events represent modifiers as a bitfield-plus-one. For example, a
mouse event with an Alt modifier will use the value 4, but a keyboard event will
use the value 5.

Previously, I refactored the parse_mask() helper to do the subtraction itself,
instead of requiring the caller to do it. This made keyboard-event decoding much
cleaner, but I didn't realise it broke mouse-event decoding. Now the subtraction
is done only for keyboard events.

Fixes #4176.
2021-04-30 14:48:37 +10:00
Maxime Coste
970a0b8997 Merge remote-tracking branch 'markus-oberhumer/ux-debug-buffer' 2021-04-28 08:11:57 +10:00
Maxime Coste
7394307a3d Merge remote-tracking branch 'nojhan/feat_padding-options' 2021-04-28 08:11:15 +10:00
nojhan
a9d33a8796 fix ncurses' padding option
- Use less iterations when drawing padding fill with multiple characters.
- Use column_length to handle null-width character as no character.
2021-04-27 15:27:57 +02:00
Markus F.X.J. Oberhumer
27d6361210 Improve UX: better error message about debug buffer on startup errors
Minuscule things like these can make a huge difference if you are
a first time user of a new text editor.
2021-04-27 12:52:10 +02:00
Ben Judd
272b70298e elif over "else if" 2021-04-19 11:53:19 -07:00
Maxime Coste
f7be47fb95 Merge remote-tracking branch 'Icantjuddle/fix_deprexated_mallinfo_call' 2021-04-19 20:56:55 +10:00
Maxime Coste
1683f7f5f5 Merge remote-tracking branch 'Icantjuddle/add_hash_unit_test' 2021-04-19 20:54:43 +10:00
Ben Judd
b09eb5e010 Comments 2021-04-18 16:28:11 -07:00
Ben Judd
56875088d4 comments 2021-04-18 16:06:05 -07:00
Maxime Coste
94c0162da7 Merge remote-tracking branch 'Screwtapello/support-keypad-keys' 2021-04-18 17:06:53 +10:00
Maxime Coste
b34bd239fa Merge remote-tracking branch 'alexherbo2/fix-edit-readonly' 2021-04-18 16:29:44 +10:00
Ben Judd
db3203fe59 mallinfo is deprecated in favor of mallinfo2 2021-04-17 13:49:21 -07:00
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