perf: cache breakindent/showbreak width in win_lbr_chartabsize

breakindent was recomputed on every call to win_lbr_charbabsize() when the character
is past the end of the first row of a wrapped line. Even though the function for computing
breakindent cached the last result, reusing the cached value required strcmp of the cached line with the given line.
This commit is contained in:
VanaIgr
2023-12-13 13:25:48 -06:00
parent 77c3d66be9
commit a9c551e5e3
3 changed files with 44 additions and 34 deletions

View File

@@ -12,15 +12,16 @@ typedef struct {
win_T *cts_win;
char *cts_line; ///< start of the line
char *cts_ptr; ///< current position in line
int cts_row;
int cts_vcol; ///< virtual column at current position
int indent_width; ///< width of showbreak and breakindent on wrapped lines
/// INT_MIN if not yet calculated
bool cts_has_virt_text; ///< true if if there is inline virtual text
int virt_row; ///< line number, -1 if no virtual text
int cts_cur_text_width_left; ///< width of virtual text left of cursor
int cts_cur_text_width_right; ///< width of virtual text right of cursor
MarkTreeIter cts_iter[1];
int cts_vcol; ///< virtual column at current position
int cts_max_head_vcol; ///< see win_lbr_chartabsize()
MarkTreeIter cts_iter[1];
} chartabsize_T;
#ifdef INCLUDE_GENERATED_DECLARATIONS