aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/tui/input.c
Commit message (Collapse)AuthorAge
* refactor: fix headers with IWYUdundargoc2023-11-28
|
* build(IWYU): fix includes for func_attr.hdundargoc2023-11-27
|
* build: rework IWYU mapping filesdundargoc2023-11-25
| | | | | Create mapping to most of the C spec and some POSIX specific functions. This is more robust than relying files shipped with IWYU.
* refactor: enable formatting for ternariesdundargoc2023-11-20
| | | | | | This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators.
* refactor(tui): use termkey_interpret_modereportGregory Anders2023-11-17
| | | | | The sign extension issue has been fixed upstream, so we no longer need to use our own workaround.
* refactor(tui): refactor Kitty keyboard query implementationGregory Anders2023-11-17
| | | | | | | | | | | | | | | | | | | Refactor our implementation of querying for Kitty keyboard protocol support: - Remove usage of the "extkeys" term. This is not standard or really used elsewhere. Use "key encoding" instead - Replace usages of "CSIu" with "Kitty". "Kitty keyboard protocol" is vastly more common than "CSIu" now - Replace the countdown response counter with a simple boolean flag. We don't actually need a countdown counter because we request the primary device attributes along with the Kitty keyboard query, so we will always receive a "terminating event", making a countdown/timer unnecessary - Move the CSI response handling into a dedicated function - Bypass Unibilium for sending key encoding escape sequences. These sequences are not part of terminfo and do not have any parameters, so there's no reason to go through Unibilium
* feat(tui): support DCS responses in TermResponse event (#26061)Gregory Anders2023-11-16
|
* refactor: iwyu (#26062)zeertzjq2023-11-16
|
* feat(tui): add 'termsync' option (#25871)Gregory Anders2023-11-14
| | | | | | | The 'termsync' option enables a mode (provided the underlying terminal supports it) where all screen updates during a redraw cycle are buffered and drawn together when the redraw is complete. This eliminates tearing or flickering in cases where Nvim redraws slower than the terminal redraws the screen.
* refactor: move background color detection into LuaGregory Anders2023-11-13
|
* build: remove PVSdundargoc2023-11-12
| | | | | | | We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable.
* fix(input): set termkey buffer size to read stream capacityGregory Anders2023-11-07
| | | | | | | This ensures that the read stream never overflows termkey's internal buffer. This only happens when a large amount of bytes are pushed into termkey at the same time, which is exactly what happens when we receive a large OSC 52 response.
* feat(tui): use TermResponse event for OSC responses (#25868)Gregory Anders2023-11-06
| | | | | | | | | | | | | When the terminal emulator sends an OSC sequence to Nvim (as a response to another OSC sequence that was first sent by Nvim), populate the OSC sequence in the v:termresponse variable and fire the TermResponse event. The escape sequence is also included in the "data" field of the autocommand callback when the autocommand is defined in Lua. This makes use of the already documented but unimplemented TermResponse event. This event exists in Vim but is only fired when Vim receives a primary device attributes response. Fixes: https://github.com/neovim/neovim/issues/25856
* refactor: reorganize option header files (#25437)zeertzjq2023-09-30
| | | | | | - Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other
* build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq2023-09-30
|
* refactor: remove longdundargoc2023-09-29
| | | | | long is 32-bits even on 64-bit windows which makes the type suboptimal for a codebase meant to be cross-platform.
* refactor(map): enhanced implementation, Clean Codeā„¢, etc etcbfredl2023-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This involves two redesigns of the map.c implementations: 1. Change of macro style and code organization The old khash.h and map.c implementation used huge #define blocks with a lot of backslash line continuations. This instead uses the "implementation file" .c.h pattern. Such a file is meant to be included multiple times, with different macros set prior to inclusion as parameters. we already use this pattern e.g. for eval/typval_encode.c.h to implement different typval encoders reusing a similar structure. We can structure this code into two parts. one that only depends on key type and is enough to implement sets, and one which depends on both key and value to implement maps (as a wrapper around sets, with an added value[] array) 2. Separate the main hash buckets from the key / value arrays Change the hack buckets to only contain an index into separate key / value arrays This is a common pattern in modern, state of the art hashmap implementations. Even though this leads to one more allocated array, it is this often is a net reduction of memory consumption. Consider key+value consuming at least 12 bytes per pair. On average, we will have twice as many buckets per item. Thus old implementation: 2*12 = 24 bytes per item New implementation 1*12 + 2*4 = 20 bytes per item And the difference gets bigger with larger items. One might think we have pulled a fast one here, as wouldn't the average size of the new key/value arrays be 1.5 slots per items due to amortized grows? But remember, these arrays are fully dense, and thus the accessed memory, measured in _cache lines_, the unit which actually matters, will be the fully used memory but just rounded up to the nearest cache line boundary. This has some other interesting properties, such as an insert-only set/map will be fully ordered by insert only. Preserving this ordering in face of deletions is more tricky tho. As we currently don't use ordered maps, the "delete" operation maintains compactness of the item arrays in the simplest way by breaking the ordering. It would be possible to implement an order-preserving delete although at some cost, like allowing the items array to become non-dense until the next rehash. Finally, in face of these two major changes, all code used in khash.h has been integrated into map.c and friends. Given the heavy edits it makes no sense to "layer" the code into a vendored and a wrapper part. Rather, the layered cake follows the specialization depth: code shared for all maps, code specialized to a key type (and its equivalence relation), and finally code specialized to value+key type.
* refactor(tui): check for out of bound access after snprintf (#24751)Thomas Vigouroux2023-08-19
| | | | | | | Counterintuitively, snprintf returns the number of characters it _should have written_ if it had not encoutered the length bound, thus leading to a potential buffer overflow. Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* refactor: remove some (const char **) casts (#24423)zeertzjq2023-07-22
|
* feat(tui): support Super and Meta modifiers (#24357)zeertzjq2023-07-15
|
* refactor(api): new helper macrosFamiu Haque2023-05-23
| | | | Adds new API helper macros `CSTR_AS_OBJ()`, `STATIC_CSTR_AS_OBJ()`, and `STATIC_CSTR_TO_OBJ()`, which cleans up a lot of the current code. These macros will also be used extensively in the upcoming option refactor PRs because then API Objects will be used to get/set options. This PR also modifies pre-existing code to use old API helper macros like `CSTR_TO_OBJ()` to make them cleaner.
* refactor(map): avoid duplicated khash_t types for valuesbfredl2023-05-17
| | | | | | | | | | | | | | | | | | | | | This reduces the total number of khash_t instantiations from 22 to 8. Make the khash internal functions take the size of values as a runtime parameter. This is abstracted with typesafe Map containers which are still specialized for both key, value type. Introduce `Set(key)` type for when there is no value. Refactor shada.c to use Map/Set instead of khash directly. This requires `map_ref` operation to be more flexible. Return pointers to both key and value, plus an indicator for new_item. As a bonus, `map_key` is now redundant. Instead of Map(cstr_t, FileMarks), use a pointer map as the FileMarks struct is humongous. Make `event_strings` actually work like an intern pool instead of wtf it was doing before.
* docs: fix typos (#22353)zeertzjq2023-02-22
|
* refactor(tui/input.c): remove unused multithreading code (#22342)zeertzjq2023-02-21
|
* refactor(main.c): remove unreachable use_builtin_ui conditions (#22338)zeertzjq2023-02-20
| | | When use_builtin_ui is true, Nvim will exit before line 385 is reached.
* fix(tui): exit on input eofzeertzjq2023-02-14
|
* refactor(tests): run unittests using main nvim binary in interpreter modebfredl2023-01-31
| | | | This allows us to get rid of the separate "nvim-test" target
* fix(unittests): fix TUI broken test previously ignoredbfredl2023-01-18
|
* Merge pull request #21831 from bfredl/nofdbfredl2023-01-16
|\ | | | | fix(ui): re-organize tty fd handling and fix issues
| * fix(ui): re-organize tty fd handling and fix issuesbfredl2023-01-16
| | | | | | | | | | | | | | - Use the correct fd to replace stdin on windows (CONIN) - Don't start the TUI if there are no tty fd (not a regression, but makes sense regardless) - De-mythologize "global input fd". it is just STDIN.
* | refactor: fix IWYU mapping file and use IWYU (#21802)dundargoc2023-01-15
|/ | | Also add the EXITFREE definition to main_lib rather than the nvim target, as the header generation needs the EXITFREE flag to work properly.
* refactor(api): do not allocate temporaries for internal eventsbfredl2023-01-03
|
* fix(tui): more work in the TUIbfredl2022-12-31
|
* feat(tui): run TUI as external processhlpr982022-12-31
|
* build: allow IWYU to fix includes for all .c filesdundargoc2022-11-15
| | | | | | | | | | Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers.
* refactor: fix clang-tidy warningsdundargoc2022-11-06
| | | | | | | | Enable and fix bugprone-misplaced-widening-cast warning. Fix some modernize-macro-to-enum and readability-else-after-return warnings, but don't enable them. While the warnings can be useful, they are in general too noisy to enable.
* build(deps): require libtermkey version 0.22Andreas Schneider2022-09-28
| | | | Reduces #ifdef code.
* vim-patch:8.1.0941: macros for MS-Windows are inconsistent (#20215)dundargoc2022-09-18
| | | | | | | Problem: Macros for MS-Windows are inconsistent, using "32", "3264 and others. Solution: Use MSWIN for all MS-Windows builds. Use FEAT_GUI_MSWIN for the GUI build. (Hirohito Higashi, closes vim/vim#3932) https://github.com/vim/vim/commit/4f97475d326c2773a78561fb874e4f23c25cbcd9
* feat(tui): support 'mousemoveevent'zeertzjq2022-09-04
|
* feat(tui): recognize sidescroll events (#19992)zeertzjq2022-08-30
| | | | | | Ref https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Other-buttons This works in xterm and kitty. CSI < 66 ; x ; y M sequence is for ScrollWheelLeft. CSI < 67 ; x ; y M sequence is for ScrollWheelRight.
* refactor(api): provide a temporary copy solution for nvim_call_atomicbfredl2022-08-24
| | | | | | Make the copy_object() family accept an optional arena. More than half of the callsites should be refactored to use an arena later anyway.
* refactor(arena): use a shared block freelistbfredl2022-08-24
| | | | | This is both simpler in client code and more effective (always reuse block hottest in cache)
* feat(tui): recognize keypad keys when using kitty keyboard protocolerw72022-07-04
|
* perf(memory): use an arena for RPC decodingbfredl2022-06-14
| | | | | | | | | drawback: tracing memory errors with ASAN is less accurate for arena allocated memory. Therefore, to start with it is being used for Object types around serialization/deserialization exclusively. This is going to have a large impact especially when TUI is refactored as a co-prosess as all UI events will be serialized and deserialized by nvim itself.
* refactor(uncrustify): set maximum number of consecutive newlines to 2 (#18695)dundargoc2022-05-25
|
* refactor(uncrustify): format all c code under /src/nvim/Dundar Goc2022-04-29
|
* feat(tui): query terminal for CSI u support (#18181)Gregory Anders2022-04-25
| | | | | | On startup query the terminal for CSI u support and enable it using the escape sequence from kitty's progressive enhancement protocol [1]. [1]: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
* feat(api): ui options relevant for remote TUIhlpr982022-04-17
|
* fix(tui)!: remove `ESC NUL` forced escape (#17198)zeertzjq2022-04-11
| | | | | | | | | | This make Nvim recognize `ESC NUL` as <M-C-Space>, as many terminal emulators (including libvterm) send <M-C-Space> as `ESC NUL`. There is already another unambiguous way to encode a `ESC` key supported by libtermkey: `ESC [ 2 7 u`, which is a `CSI u` sequence. If one still wants to use `ESC NUL` as `ESC`, they can just map <M-C-Space> to <Esc>.
* refactor(tinput_wait_enqueue): use rbuffer_read() when pasting (#17754)zeertzjq2022-03-19
| | | | | When pasting, all of key buffer can be consumed, and in case of phase 3 the paste event must be put exactly once, so using rbuffer_read() should be better here.