diff options
author | zeertzjq <zeertzjq@outlook.com> | 2021-11-18 09:55:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-17 20:55:59 -0500 |
commit | 5ff972cafe67dbaad7deafa2de60513f763732f6 (patch) | |
tree | d8f2e29f5077bf8545aad3f119a74f09c153734c /src/nvim/charset.c | |
parent | eb3d59126eff50c64c2108e308884a722e7ee32e (diff) | |
download | rneovim-5ff972cafe67dbaad7deafa2de60513f763732f6.tar.gz rneovim-5ff972cafe67dbaad7deafa2de60513f763732f6.tar.bz2 rneovim-5ff972cafe67dbaad7deafa2de60513f763732f6.zip |
vim-patch:8.2.3522: cannot use \x and \u when setting 'listchars' (#16049)
Problem: Cannot use \x and \u when setting 'listchars'.
Solution: Support hex and unicode in hex form. (closes vim/vim#9006)
https://github.com/vim/vim/commit/93ff6720fe4427341bc426b6d46e6324f226c270
Diffstat (limited to 'src/nvim/charset.c')
-rw-r--r-- | src/nvim/charset.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 5e18f9d86e..eb0903b594 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1642,6 +1642,16 @@ int hex2nr(int c) return c - '0'; } +/// Convert two hex characters to a byte. +/// Return -1 if one of the characters is not hex. +int hexhex2nr(char_u *p) +{ + if (!ascii_isxdigit(p[0]) || !ascii_isxdigit(p[1])) { + return -1; + } + return (hex2nr(p[0]) << 4) + hex2nr(p[1]); +} + /// Check that "str" starts with a backslash that should be removed. /// For Windows this is only done when the character after the /// backslash is not a normal file name character. |