diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-01-18 10:03:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-18 02:03:13 +0000 |
commit | c9000a6b13fd6695f6e28a890b82b490a123f25e (patch) | |
tree | 8d25376bd57687bdf0463c67bdd93c153ffdb70d /src/nvim/statusline.c | |
parent | c6cc937512f59af12fd1b15ca4f7a11288f28ca0 (diff) | |
download | rneovim-c9000a6b13fd6695f6e28a890b82b490a123f25e.tar.gz rneovim-c9000a6b13fd6695f6e28a890b82b490a123f25e.tar.bz2 rneovim-c9000a6b13fd6695f6e28a890b82b490a123f25e.zip |
vim-patch:9.1.1028: too many strlen() calls in screen.c (#32083)
Problem: too many strlen() calls in screen.c
Solution: refactor screen.c and remove calls to strlen(),
verify that leadmultispace != NULL (John Marriott)
closes: vim/vim#16460
https://github.com/vim/vim/commit/c15de972e8131def2f506bb9eb6b306ca089629c
Co-authored-by: John Marriott <basilisk@internode.on.net>
Diffstat (limited to 'src/nvim/statusline.c')
-rw-r--r-- | src/nvim/statusline.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index 434d4c8a6f..b8515fa3e2 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -772,8 +772,7 @@ void draw_tabline(void) if (modified || wincount > 1) { if (wincount > 1) { - vim_snprintf(NameBuff, MAXPATHL, "%d", wincount); - int len = (int)strlen(NameBuff); + int len = vim_snprintf(NameBuff, MAXPATHL, "%d", wincount); if (col + len >= Columns - 3) { break; } @@ -798,7 +797,8 @@ void draw_tabline(void) len -= ptr2cells(p); MB_PTR_ADV(p); } - len = MIN(len, Columns - col - 1); + int n = Columns - col - 1; + len = MIN(len, n); grid_line_puts(col, p, -1, attr); col += len; @@ -832,7 +832,8 @@ void draw_tabline(void) // Draw the 'showcmd' information if 'showcmdloc' == "tabline". if (p_sc && *p_sloc == 't') { - const int sc_width = MIN(10, (int)Columns - col - (tabcount > 1) * 3); + int n = Columns - col - (tabcount > 1) * 3; + const int sc_width = MIN(10, n); if (sc_width > 0) { grid_line_puts(Columns - sc_width - (tabcount > 1) * 2, |