comparison src/charset.c @ 25978:40b17deb294f v8.2.3522

patch 8.2.3522: cannot use x and u when setting 'listchars' Commit: https://github.com/vim/vim/commit/93ff6720fe4427341bc426b6d46e6324f226c270 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 16 17:51:40 2021 +0100 patch 8.2.3522: cannot use \x and \u when setting 'listchars' Problem: Cannot use \x and \u when setting 'listchars'. Solution: Support hex and unicode in hex form. (closes https://github.com/vim/vim/issues/9006)
author Bram Moolenaar <Bram@vim.org>
date Sat, 16 Oct 2021 19:00:03 +0200
parents 661d15592d3c
children 227543e4181f
comparison
equal deleted inserted replaced
25977:93fc4b568a54 25978:40b17deb294f
2011 if (c >= 'A' && c <= 'F') 2011 if (c >= 'A' && c <= 'F')
2012 return c - 'A' + 10; 2012 return c - 'A' + 10;
2013 return c - '0'; 2013 return c - '0';
2014 } 2014 }
2015 2015
2016 #if defined(FEAT_TERMRESPONSE) || defined(FEAT_GUI_GTK) \
2017 || defined(PROTO) || defined(FEAT_AUTOSHELLDIR)
2018 /* 2016 /*
2019 * Convert two hex characters to a byte. 2017 * Convert two hex characters to a byte.
2020 * Return -1 if one of the characters is not hex. 2018 * Return -1 if one of the characters is not hex.
2021 */ 2019 */
2022 int 2020 int
2024 { 2022 {
2025 if (!vim_isxdigit(p[0]) || !vim_isxdigit(p[1])) 2023 if (!vim_isxdigit(p[0]) || !vim_isxdigit(p[1]))
2026 return -1; 2024 return -1;
2027 return (hex2nr(p[0]) << 4) + hex2nr(p[1]); 2025 return (hex2nr(p[0]) << 4) + hex2nr(p[1]);
2028 } 2026 }
2029 #endif
2030 2027
2031 /* 2028 /*
2032 * Return TRUE if "str" starts with a backslash that should be removed. 2029 * Return TRUE if "str" starts with a backslash that should be removed.
2033 * For MS-DOS, MSWIN and OS/2 this is only done when the character after the 2030 * For MS-DOS, MSWIN and OS/2 this is only done when the character after the
2034 * backslash is not a normal file name character. 2031 * backslash is not a normal file name character.