0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

361 Commits

Author SHA1 Message Date
Yee Cheng Chin
0b5fe42071
patch 9.1.1169: using global variable for get_insert()/get_lambda_name()
Problem:  using global variable for get_insert()/get_lambda_name()
          (after v9.1.1151)
Solution: let the functions return a string_T object instead
          (Yee Cheng Chin)

In #16720, `get_insert()` was modified to store a string length in a
global variable to be queried immediately by another `get_insert_len()`
function, which is somewhat fragile. Instead, just have the function
itself return a `string_T` object instead. Also do the same for
`get_lambda_name()` which has similar issues.

closes: #16775

Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-03-03 20:12:05 +01:00
John Marriott
18bacc811c
patch 9.1.1152: Patch v9.1.1151 causes problems
Problem:  Patch v9.1.1151 causes problems
Solution: partially revert it (John Marriott)

closes: #16736

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-02-26 19:14:06 +01:00
John Marriott
d3c4b7e946
patch 9.1.1151: too many strlen() calls in getchar.c
Problem:  too many strlen() calls in getchar.c
Solution: store last inserted and recorded lengths,
          add functions to retrieve those and use those
          functions (John Marriott)

closes: #16720

Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-02-25 20:56:38 +01:00
zeertzjq
edf0f7db28
patch 9.1.1070: Cannot control cursor positioning of getchar()
Problem:  Cannot control cursor positioning of getchar().
Solution: Add "cursor" flag to {opts}, with possible values "hide",
          "keep" and "msg".

related: #10603
closes: #16569

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-02-02 19:01:01 +01:00
zeertzjq
e0a2ab397f
patch 9.1.1068: getchar() can't distinguish between C-I and Tab
Problem:  getchar() can't distinguish between C-I and Tab.
Solution: Add {opts} to pass extra flags to getchar() and getcharstr(),
          with "number" and "simplify" keys.

related: #10603
closes: #16554

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-02-02 09:14:35 +01:00
John Marriott
e7a1bbf210
patch 9.1.0851: too many strlen() calls in getchar.c
Problem:  too many strlen() calls in getchar.c
Solution: refactor code and reduce strlen() calls
          (John Marriott)

closes: #16017

Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-11-11 20:40:33 +01:00
Christian Brabandt
322ba91086
patch 9.1.0697: [security]: heap-buffer-overflow in ins_typebuf
Problem:  heap-buffer-overflow in ins_typebuf
          (SuyueGuo)
Solution: When flushing the typeahead buffer, validate that there
          is enough space left

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-4ghr-c62x-cqfh

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-25 21:33:03 +02:00
zeertzjq
74011dc1fa
patch 9.1.0644: Unnecessary STRLEN() when applying mapping
Problem:  Unnecessary STRLEN() when applying mapping.
          (after v9.1.0642)
Solution: Use m_keylen and vim_strnsave().
          (zeertzjq)

closes: #15394

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-30 19:17:56 +02:00
zeertzjq
9d997addc7
patch 9.1.0642: Check that mapping rhs starts with lhs fails if not simplified
Problem:  Check that mapping rhs starts with lhs doesn't work if lhs is
          not simplified.
Solution: Keep track of the mapblock containing the alternative lhs and
          also compare with it (zeertzjq).

fixes: #15376
closes: #15384

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-29 21:10:07 +02:00
Oleg Goncharov
56904f90d1
patch 9.1.0611: ambiguous mappings not correctly resolved with modifyOtherKeys
Problem:  ambiguous mappings not correctly resolved with modifyOtherKeys
Solution: Check for termcode when an upper case mapping is received and
          does not match (Oleg Goncharov)

Fix for mapping processing when capital leters are represented with terminal codes.

Problem: there are two mappings and
1) the first mapping is substring of the second,
2) the first non-matching letter is capital,
3) capital letters are represented with termcodes "ESC[27;2;<ascii code>~" in given system
then first mapping is applied instead of second.

Example:

    :map B b
    :map BBB blimp!

and then

    BBB -> bbb

instead of

    BBB -> blimp!

Solution: force termcodes check if capital letter does not match.

closes: #15251

Signed-off-by: Oleg Goncharov <goncharovoi@yandex.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-23 20:42:02 +02:00
Shougo Matsushita
fcc1b5741e
patch 9.1.0597: KeyInputPre cannot get the (unmapped typed) key
Problem:  KeyInputPre cannot get the (unmapped typed) key
          (after v9.1.0563)
Solution: Add the "typedchar" property to the v:event dict
          (Shougo Matsushita)

closes: #15231

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-17 20:25:22 +02:00
zeertzjq
d9be94cf03
patch 9.1.0581: Various lines are indented inconsistently
Problem:  style: Various lines are indented inconsistently
Solution: Retab these lines and correct some comments.
          (zeertzjq)

closes: #15259

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-14 10:20:20 +02:00
zeertzjq
90a800274d
patch 9.1.0580: :lmap mapping for keypad key not applied when typed in Select mode
Problem:  An :lmap mapping for a printable keypad key is not applied
          when typing it in Select mode.
Solution: Change keypad key to ASCII after setting vgetc_char.
          (zeertzjq)

closes: #15245

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-13 19:06:44 +02:00
Shougo Matsushita
8367884909
patch 9.1.0563: Cannot process any Key event
Problem:  Cannot process any Key event
Solution: Add the KeyInputPre autocmd
          (Shougo Matsushita)

closes: #15182

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: K.Takata <kentkt@csc.jp>
Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-11 22:05:12 +02:00
zeertzjq
6b13e3d4e4
patch 9.1.0365: Crash when typing many keys with D- modifier
Problem:  Crash when typing many keys with D- modifier (after 9.1.0227).
Solution: Don't treat a 0x80 byte inside a special sequence as the start
          of a special sequence (zeertzjq).

closes: #14613

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-22 21:04:29 +02:00
zeertzjq
094c4390bd
patch 9.1.0351: No test that completing a partial mapping clears 'showcmd'
Problem:  No test that completing a partial mapping clears 'showcmd'.
Solution: Complete partial mappings in Test_showcmd_part_map() instead
          of using :echo.  Adjust some comments (zeertzjq).

closes: #14580

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-18 22:09:37 +02:00
zeertzjq
acdfb8a979
patch 9.1.0343: 'showcmd' wrong for partial mapping with multibyte
Problem:  'showcmd' is wrong for partial mapping with multibyte char,
          and isn't very readable with modifyOtherKeys.
Solution: Decode multibyte char and merge modifiers into the char.
          (zeertzjq)

This improves the following situations:
- Multibyte chars whose individual bytes are considered unprintable are
  now shown properly in 'showcmd' area.
- Ctrl-W with modifyOtherKeys now shows ^W in 'showcmd' area.

The following situation may still need improvement:
- If the char is a special key or has modifiers that cannot be merged
  into it, internal keycodes are shown in 'showcmd' area like before.
  This applies to keys typed in Normal mode commands as well, and it's
  hard to decide how to make it more readable due to the limited space
  taken by 'showcmd', so I'll leave it for later.

closes: #14572

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-17 21:28:54 +02:00
Mike Williams
aca8f55596
patch 9.1.0274: MS-Windows: a few compiler warnings
Problem:  MS-Windows: a few compiler warnings
Solution: Change variable types to resolve compiler warnings
          (Mike Williams)

Windows compiles were reporting a few size_t to signed integer
conversion warnings that can be resolved by changing the variable
declarations to be size_t to start with.

closes: #14429

Signed-off-by: Mike Williams <mrmrdubya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-07 18:26:22 +02:00
zeertzjq
ea95f1a5ad
patch 9.1.0227: Recording may still be wrong in Select mode
Problem:  Recording may still be wrong in Select mode (after 8.2.3993).
Solution: Make sure a character isn't split between two buffer blocks.
          (zeertzjq)

closes: #14326

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-29 10:11:42 +01:00
zeertzjq
bf321806bf
patch 9.1.0060: Recorded register cannot be translated using keytrans()
Problem:  Recorded register cannot be translated using keytrans() when
          it involves character search (iddqd505)
Solution: Record a K_IGNORE instead of a K_NOP (zeertzjq)

related: #13916
closes: #13925

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-28 19:03:00 +01:00
Keith Thompson
184f71cc68
patch 9.1.0006: is*() and to*() function may be unsafe
Problem:  is*() and to*() function may be unsafe
Solution: Add SAFE_* macros and start using those instead
          (Keith Thompson)

Use SAFE_() macros for is*() and to*() functions

The standard is*() and to*() functions declared in <ctype.h> have
undefined behavior for negative arguments other than EOF.  If plain char
is signed, passing an unchecked value from argv for from user input
to one of these functions has undefined behavior.

Solution: Add SAFE_*() macros that cast the argument to unsigned char.

Most implementations behave sanely for negative arguments, and most
character values in practice are non-negative, but it's still best
to avoid undefined behavior.

The change from #13347 has been omitted, as this has already been
separately fixed in commit ac709e2fc0db6d31abb7da96f743c40956b60c3a
(v9.0.2054)

fixes: #13332
closes: #13347

Signed-off-by: Keith Thompson <Keith.S.Thompson@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-04 21:19:04 +01:00
David Leadbeater
67ec655383
patch 9.0.2069: possible to escape bracketed paste mode with Ctrl-C
Problem:  possible to escape bracketed paste mode with Ctrl-C
Solution: Do not handle Ctrl-C specially when key_protocol
          is in use, makes bracketed paste mode more robust

When a key protocol is in use Ctrl-C will be sent as an escape sequence,
but a raw Ctrl-C can be sent when pasting data. Pass this through, so
that a Ctrl-C can be pasted and won't result in exiting insert mode
(where the rest of the pasted keys can cause all kind of nasty
side-effects).

Many terminals will strip control characters in paste data (and xterm
will strip ^C since version 388), but this provides some defense in
depth if users change settings like xterm's allowPasteControls.

closes: #13398

Signed-off-by: David Leadbeater <dgl@dgl.cx>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-26 22:08:41 +02:00
zeertzjq
bacc83009b
patch 9.0.1694: wrong mapping applied when replaying a char search
Problem: wrong mapping applied when replaying a char search
Solution: Store a NOP after the ESC

closes: #12708
closes: #6350

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-08-12 00:09:31 +02:00
RestorerZ
68ebcee023 patch 9.0.1594: some internal error messages are translated
Problem:    Some internal error messages are translated.
Solution:   Consistently do not translate internal error messages.
            (closes #12459)
2023-05-31 17:12:14 +01:00
zeertzjq
30b6d6104c patch 9.0.1521: failing redo of command with control characters
Problem:    Failing redo of command with control characters.
Solution:   Use AppendToRedobuffLit() for colon commands. (closes #12354)
2023-05-07 17:39:23 +01:00
zeertzjq
3ab3a86481 patch 9.0.1516: cannot use special keys in <Cmd> mapping
Problem:    Cannot use special keys in <Cmd> mapping.
Solution:   Do allow for special keys in <Cmd> and <ScriptCmd> mappings.
            (closes #12326)
2023-05-06 16:22:04 +01:00
Bram Moolenaar
f39d9e9dca patch 9.0.1479: small source file problems; outdated list of distrib. files
Problem:    Small source file problems; outdated list of distributed files.
Solution:   Small updates to source files and list of distributed files.
2023-04-22 22:54:40 +01:00
Bram Moolenaar
ea83c19462 patch 9.0.1414: <M-S-x> in Kitty does not use the Shift modifier
Problem:    <M-S-x> in Kitty does not use the Shift modifier.
Solution:   Apply the Shift modifier to ASCII letters. (closes #11913)
2023-03-18 17:22:46 +00:00
Bram Moolenaar
7ac5023a5f patch 9.0.1392: using NULL pointer with nested :open command
Problem:    Using NULL pointer with nested :open command.
Solution:   Check that ccline.cmdbuff is not NULL.
2023-03-07 21:05:04 +00:00
Bram Moolenaar
6b066c6d8f patch 9.0.1333: when redo'ing twice <ScriptCmd> may not get the script ID
Problem:    When redo'ing twice <ScriptCmd> may not get the script ID.
Solution:   When "last_used_map" map is not set use "last_used_sid".
            (closes #11930)
2023-02-20 18:44:33 +00:00
Bram Moolenaar
a9a6b0323e patch 9.0.1285: various small problems
Problem:    Various small problems.
Solution:   Adjust white space and comments.
2023-02-05 18:00:42 +00:00
Yegappan Lakshmanan
fadc02a2a5 patch 9.0.1251: checking returned value of ga_grow() is inconsistent
Problem:    Checking returned value of ga_grow() is inconsistent.
Solution:   Check for FAIL instaed of "not OK". (Yegappan Lakshmanan,
            closes #11897)
2023-01-27 21:03:12 +00:00
Bram Moolenaar
0f843ef091 patch 9.0.1244: cursor displayed in wrong position when leaving Insert mode
Problem:    Cursor briefly displayed in a wrong position when pressing Esc in
            Insert mode after autoindent was used.
Solution:   Do not adjust the cursor position for assumed deleted white space
            if text is following.  (closes #11877)
2023-01-25 17:34:41 +00:00
Yegappan Lakshmanan
7f8b2559a3 patch 9.0.1158: code is indented more than necessary
Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes #11787)
2023-01-08 13:44:24 +00:00
Bram Moolenaar
dffa6ea85c patch 9.0.0974: even when Esc is encoded a timeout is used
Problem:    Even when Esc is encoded a timeout is used.
Solution:   Use K_ESC when an encoded Esc is found.
2022-11-29 20:33:20 +00:00
Bram Moolenaar
c255b78965 patch 9.0.0954: cannot detect whether modifyOtherKeys is enabled
Problem:    Cannot detect whether modifyOtherKeys is enabled.
Solution:   Use XTQMODKEYS introduced by xterm version 377 to request the
            modifyOtherKeys level.  Update the keycode check results.
2022-11-26 19:16:48 +00:00
Bram Moolenaar
d330e8422d patch 9.0.0943: pretending to go out of Insert mode when Esc is received
Problem:    Pretending to go out of Insert mode when Esc is received has side
            effects.
Solution:   When the kitty keyboard protocol is enabled expect Esc to always
            be the start of an escape sequence.
2022-11-24 20:23:24 +00:00
Bram Moolenaar
47f1fdc28c patch 9.0.0939: still using simplified mappings when using kitty protocol
Problem:    Still using simplified mappings when using the kitty keyboard
            protocol.
Solution:   Use the kitty_protocol_state value to decide whether to use
            simplified mappings.  Improve how seenModifyOtherKeys is set and
            reset.
2022-11-24 13:27:36 +00:00
Christopher Plewright
0319306f20 patch 9.0.0918: MS-Windows: modifier keys do not work with mouse scroll event
Problem:    MS-Windows: modifier keys do not work with mouse scroll events.
Solution:   Use K_SPECIAL instead of CSI for the modifier keys. (Christopher
            Plewright, closes #11587)
2022-11-22 12:58:27 +00:00
Bram Moolenaar
c896adbcde patch 9.0.0912: libvterm with modifyOtherKeys level 2 does not match xterm
Problem:    libvterm with modifyOtherKeys level 2 does not match xterm.
Solution:   Adjust key code escape sequences to be the same as what xterm
            sends in modifyOtherKeys level 2 mode.  Check the value of
            no_reduce_keys before using it.
2022-11-19 19:02:40 +00:00
Bram Moolenaar
88456cd3c4 patch 9.0.0904: various comment and indent flaws
Problem:    Various comment and indent flaws.
Solution:   Improve comments and indenting.
2022-11-18 22:14:09 +00:00
dundargoc
c57b5bcd22 patch 9.0.0828: various typos
Problem:    Various typos.
Solution:   Correct typos. (closes #11432)
2022-11-02 13:30:51 +00:00
Christopher Plewright
7fa02bcb3b patch 9.0.0812: GUI mouse scrollwheel mappings don't work
Problem:    GUI mouse scrollwheel mappings don't work.
Solution:   Add check for "gui.in_use". (Christopher Plewright, closes #11418)
2022-10-21 13:03:33 +01:00
zeertzjq
49660f5139 patch 9.0.0806: 'langmap' works differently when there are modifiers
Problem:    'langmap' works differently when there are modifiers.
Solution:   Only apply 'langmap' to a character where modifiers have no
            effect. (closes #11395, closes #11404)
2022-10-20 17:59:38 +01:00
Christopher Plewright
4c36678ffd patch 9.0.0802: MS-Windows: cannot map console mouse scroll events
Problem:    MS-Windows: cannot map console mouse scroll events.
Solution:   Change CSI to K_SPECIAL when checking for a mapping. (Christopher
            Plewright, closes #11410)
2022-10-20 13:11:15 +01:00
Christopher Plewright
605d02a9b7 patch 9.0.0793: MS-Windows: mouse scroll events only work with the dll
Problem:    MS-Windows: mouse scroll events only work with the dll.
Solution:   Accept CSI codes for MS-Windows without the GUI. (Christopher
            Plewright, closes #11401)
2022-10-19 11:54:46 +01:00
Martin Tournoij
ba43e76fcd patch 9.0.0747: too many #ifdefs
Problem:    Too many #ifdefs.
Solution:   Gradudate the +cmdline_info feature. (Martin Tournoij,
            closes #11330)
2022-10-13 22:12:15 +01:00
Yee Cheng Chin
4314e4f7da patch 9.0.0694: no native sound support on Mac OS
Problem:    No native sound support on Mac OS.
Solution:   Add sound support for Mac OS. (Yee Cheng Chin, closes #11274)
2022-10-08 13:50:05 +01:00
Martin Tournoij
7904fa420e patch 9.0.0657: too many #ifdefs
Problem:    Too many #ifdefs.
Solution:   Graduate the +cmdwin feature.  Now the tiny and small builds are
            equal, drop the small build.  (Martin Tournoij, closes #11268)
2022-10-04 16:28:45 +01:00
Bram Moolenaar
78aed95c8d patch 9.0.0575: the getchar() function behaves strangely with bracketed paste
Problem:    The getchar() function behaves strangely with bracketed paste.
Solution:   Do not handle paste-start in getchar(). (issue #11172)
2022-09-24 15:36:35 +01:00