summaryrefslogtreecommitdiff
path: root/src/ncurses_ui.cc
AgeCommit message (Collapse)Author
2021-07-12Rename NCursesUI to TerminalUIMaxime Coste
2021-07-12Replace ncurses with a naive custom terminal backendMaxime Coste
2021-07-07Merge remote-tracking branch 'Screwtapello/save-restore-window-title'Maxime Coste
2021-06-27Restore terminal during suspend before changing alternate screenDmitry Matveyev
2021-06-27Handle Ctrl+Z key later in the terminal input stackMaxime Coste
The previous handling code was at a pretty random location and broke terminals that could send <c-z> encoded in a non pure ascii way. See #4238
2021-06-18Restore terminal before switching from alternate screenSolitudeSF
2021-06-15src: Restore the window title when quitting or suspending Kakoune.Tim Allen
Fixes #4228.
2021-05-28Canonicalize <s-ascii> into uppercase in csi key parsing codeMaxime Coste
Fixes #4159
2021-05-02Request xterm 'modifyOtherKeys' mode to opt-in CSI u key reportingMaxime Coste
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-04-30src: Fix mouse modifier support in the ncurses UI.Tim Allen
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-28Merge remote-tracking branch 'nojhan/feat_padding-options'Maxime Coste
2021-04-27fix ncurses' padding optionnojhan
- Use less iterations when drawing padding fill with multiple characters. - Use column_length to handle null-width character as no character.
2021-04-05[feat] add ui_options: padding_char & padding_fillnojhan
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-03-26src/ncurses_ui: Teach Kakoune about all the numeric keypad keys.Tim Allen
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-26src/ncurses_ui: move the parse_mask() helper outside parse_csi().Tim Allen
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-11Do not select on non-urgent fd when handling only urgent eventsMaxime Coste
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-02-11Fix CSI u support for escape keyMaxime Coste
2021-01-15Distinguish <c-h> and Backspace on terminals where that is possible.Tim Allen
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.
2020-11-02Handle reading from stdin returning 0Maxime Coste
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-10-31src/ncurses_ui.cc: Teach Kakoune about ctrl-symbol keys.Tim Allen
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-08-02Do not flush input buffer in UI creationMaxime Coste
Fixes #3635
2020-06-28Fix 'error: non-constant-expression cannot be narrowed...'Igor Böhm
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-28Refactor mouse press/release handling to support 3 buttonsMaxime Coste
Change button to be an additional parameter instead of having separate events for left/right buttons. Fixes #3471
2020-05-12Fix CSI u parsing of some special keysMaxime Coste
2020-05-02Add support for alpha channel in colorsMaxime Coste
This makes it easier to define faces that lighten/darken whatever they apply on.
2020-03-27Untie focus reporting and mouse handlingMaxime Coste
2020-03-04restore F1 key handlingJoachim Henke
2020-02-26Enable terminal application keypad modeMaxime Coste
2020-01-20fix several control key combinations in stJoachim Henke
2020-01-19make the Insert key work in stJoachim Henke
2020-01-11Reset SIGHUP handler on NCursesUI destructionMaxime Coste
SIGHUP handler could trigger crashes if the EventManager was already destructed when it was triggered. Fixes #3288
2020-01-05Merge remote-tracking branch 'fsub/rxvt'Maxime Coste
2020-01-04Restore support for line wrapping info boxesMaxime Coste
Fixes #3280
2019-12-14Support rxvt style s-F3 to s-F10fsub
2019-12-14Support rxvt style s-F11 and s-F12fsub
Rxvt emits `\E[23$` and `\E[24$` for `F21` and `F22` (alias `s-F11` and `s-F12` provided that `ncurses_shift_function_key` is set to `10`), respectively.
2019-12-11src/ncurses_ui.cc: Add support for VT220-style Home and End keys.Tim Allen
Because we now support a bunch of different conventions for these keys, let's add some citations for the benefit of future maintainers. Fixes #3252.
2019-11-26Fix small info text not being displayedMaxime Coste
2019-11-24Rework ncurses info display, crop content when overlflowingMaxime Coste
Optmize the code to avoid allocating like crazy, unify various info style rendering, crop content and display markers that there is more text remaining. Fixes #2257
2019-11-22Add support for markup in info boxesMaxime Coste
Fixes #2552
2019-11-18Fix recently introduced ncurses redraw artifactMaxime Coste
2019-11-17Fix search menu trimmed entry displayMaxime Coste
2019-11-13Re-merge clear_to_eol in drawMaxime Coste
2019-11-09Fix bad comparison when parsing OSI sequencesJason Felice
2019-11-09Check that stdout is a tty in ncurses uiMaxime Coste
2019-11-05Fix some ncurses rendering issuesMaxime Coste
2019-11-05Split clearing to end of line out of NCursesUI::Window::drawMaxime Coste
Explicitely clear instead of relying on a brittle heuristic.
2019-10-16Slight cleanup of the menu display codeMaxime Coste
2019-10-08Check that stdin is readable before calling readMaxime Coste
This should not be necessary, but it works around a bug in WSL. Fixes #3112
2019-09-26Fix some clang warningsMaxime Coste
2019-09-26Remove unneeded NCursesUI::Window::mark_dirty and redrawsMaxime Coste
A bug in client.cc was always forcing full redraws of the windows, leading to much more terminal output traffic than necessary.