aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mbyte.h
diff options
context:
space:
mode:
authorVanaIgr <vanaigranov@gmail.com>2023-12-18 20:57:04 -0600
committerzeertzjq <zeertzjq@outlook.com>2024-01-22 09:04:45 +0800
commitcdf848a314bf91a0c87c717f9a44742dea877515 (patch)
tree3dda7a0c7117944ce95b4f2237fdcf9c066af131 /src/nvim/mbyte.h
parentb5653984e5de514410b5654d2a9b92bdcb9eedf3 (diff)
downloadrneovim-cdf848a314bf91a0c87c717f9a44742dea877515.tar.gz
rneovim-cdf848a314bf91a0c87c717f9a44742dea877515.tar.bz2
rneovim-cdf848a314bf91a0c87c717f9a44742dea877515.zip
perf: reuse fast character size calculation algorithm from getvcol()
Diffstat (limited to 'src/nvim/mbyte.h')
-rw-r--r--src/nvim/mbyte.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/mbyte.h b/src/nvim/mbyte.h
index 68acc5075e..be632ee834 100644
--- a/src/nvim/mbyte.h
+++ b/src/nvim/mbyte.h
@@ -110,3 +110,11 @@ static inline StrCharInfo utfc_next(StrCharInfo cur)
next += next_len;
}
}
+
+static inline StrCharInfo utf_ptr2StrCharInfo(char *ptr)
+ REAL_FATTR_NONNULL_ALL REAL_FATTR_ALWAYS_INLINE REAL_FATTR_PURE;
+
+static inline StrCharInfo utf_ptr2StrCharInfo(char *ptr)
+{
+ return (StrCharInfo){ .ptr = ptr, .chr = utf_ptr2CharInfo(ptr) };
+}