diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-13 15:00:43 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-03-14 13:09:54 +0800 |
commit | 090d1fd0b86897d2f5a80a600becf1525398ef30 (patch) | |
tree | 94b10da1cf7d680654d6b597dae2c5bd0686b0be /src/nvim/statusline.c | |
parent | 3502aa63f0f4ea8d8982aea81a819424e71029bc (diff) | |
download | rneovim-090d1fd0b86897d2f5a80a600becf1525398ef30.tar.gz rneovim-090d1fd0b86897d2f5a80a600becf1525398ef30.tar.bz2 rneovim-090d1fd0b86897d2f5a80a600becf1525398ef30.zip |
vim-patch:9.1.0172: More code can use ml_get_buf_len() instead of STRLEN()
Problem: More code can use ml_get_buf_len() instead of STRLEN().
Solution: Change more STRLEN() calls to ml_get_buf_len(). Also do not
set ml_line_textlen in ml_replace_len() if "has_props" is set,
because "len_arg" also includes the size of text properties in
that case. (zeertzjq)
closes: vim/vim#14183
https://github.com/vim/vim/commit/94b7c3233ef534acc669b3083ed1fe59cf3a090b
Diffstat (limited to 'src/nvim/statusline.c')
-rw-r--r-- | src/nvim/statusline.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index b403f840ca..1d914dd105 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -1002,11 +1002,11 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op // Get the byte value now, in case we need it below. This is more // efficient than making a copy of the line. int byteval; - const size_t len = strlen(line_ptr); - if (wp->w_cursor.col > (colnr_T)len) { + const colnr_T len = ml_get_buf_len(wp->w_buffer, lnum); + if (wp->w_cursor.col > len) { // Line may have changed since checking the cursor column, or the lnum // was adjusted above. - wp->w_cursor.col = (colnr_T)len; + wp->w_cursor.col = len; wp->w_cursor.coladd = 0; byteval = 0; } else { |