Mercurial > vim
comparison src/drawline.c @ 34540:9e093c96dff6 v9.1.0172
patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN()
Commit: https://github.com/vim/vim/commit/94b7c3233ef534acc669b3083ed1fe59cf3a090b
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue Mar 12 21:50:32 2024 +0100
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: #14183
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 12 Mar 2024 22:00:04 +0100 |
parents | b67de41ae869 |
children | 33cb93a8d573 |
comparison
equal
deleted
inserted
replaced
34539:0dbb6f014f5e | 34540:9e093c96dff6 |
---|---|
1531 nextlinecol = MAXCOL; | 1531 nextlinecol = MAXCOL; |
1532 nextline_idx = 0; | 1532 nextline_idx = 0; |
1533 } | 1533 } |
1534 else | 1534 else |
1535 { | 1535 { |
1536 v = (long)STRLEN(line); | 1536 v = ml_get_buf_len(wp->w_buffer, lnum); |
1537 if (v < SPWORDLEN) | 1537 if (v < SPWORDLEN) |
1538 { | 1538 { |
1539 // Short line, use it completely and append the start of the | 1539 // Short line, use it completely and append the start of the |
1540 // next line. | 1540 // next line. |
1541 nextlinecol = 0; | 1541 nextlinecol = 0; |
1568 extra_check = TRUE; | 1568 extra_check = TRUE; |
1569 | 1569 |
1570 // find start of trailing whitespace | 1570 // find start of trailing whitespace |
1571 if (wp->w_lcs_chars.trail) | 1571 if (wp->w_lcs_chars.trail) |
1572 { | 1572 { |
1573 trailcol = (colnr_T)STRLEN(ptr); | 1573 trailcol = ml_get_buf_len(wp->w_buffer, lnum); |
1574 while (trailcol > (colnr_T)0 && VIM_ISWHITE(ptr[trailcol - 1])) | 1574 while (trailcol > (colnr_T)0 && VIM_ISWHITE(ptr[trailcol - 1])) |
1575 --trailcol; | 1575 --trailcol; |
1576 trailcol += (colnr_T)(ptr - line); | 1576 trailcol += (colnr_T)(ptr - line); |
1577 } | 1577 } |
1578 // find end of leading whitespace | 1578 // find end of leading whitespace |