aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-02 16:32:33 +0800
committerGitHub <noreply@github.com>2022-10-02 16:32:33 +0800
commit0643645d5c9e34f7c385925b98bbcf8f64260385 (patch)
tree35554aa042ceb9564aa2370e5a7e569c5064f5d0 /src
parentdd1c613d0b47e818b7a6657f3c4bdeb959199628 (diff)
downloadrneovim-0643645d5c9e34f7c385925b98bbcf8f64260385.tar.gz
rneovim-0643645d5c9e34f7c385925b98bbcf8f64260385.tar.bz2
rneovim-0643645d5c9e34f7c385925b98bbcf8f64260385.zip
fix(folds): fix fold marker multibyte comparison (#20439)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/fold.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index d46470d413..76fc531627 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -3012,7 +3012,7 @@ static void foldlevelMarker(fline_T *flp)
char *s = ml_get_buf(flp->wp->w_buffer, flp->lnum + flp->off, false);
while (*s) {
- if (*s == cstart
+ if ((unsigned char)(*s) == cstart
&& STRNCMP(s + 1, startmarker, foldstartmarkerlen - 1) == 0) {
// found startmarker: set flp->lvl
s += foldstartmarkerlen;
@@ -3032,8 +3032,8 @@ static void foldlevelMarker(fline_T *flp)
flp->lvl_next++;
flp->start++;
}
- } else if (*s == cend && STRNCMP(s + 1, foldendmarker + 1,
- foldendmarkerlen - 1) == 0) {
+ } else if ((unsigned char)(*s) == cend
+ && STRNCMP(s + 1, foldendmarker + 1, foldendmarkerlen - 1) == 0) {
// found endmarker: set flp->lvl_next
s += foldendmarkerlen;
if (ascii_isdigit(*s)) {