mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
fix(drawline): consider position in linebuf for foldcolumn (#26803)
This commit is contained in:
parent
e0112aa1d2
commit
3299797150
@ -388,17 +388,16 @@ static void draw_foldcolumn(win_T *wp, winlinevars_T *wlv)
|
|||||||
int fdc = compute_foldcolumn(wp, 0);
|
int fdc = compute_foldcolumn(wp, 0);
|
||||||
if (fdc > 0) {
|
if (fdc > 0) {
|
||||||
int attr = win_hl_attr(wp, use_cursor_line_highlight(wp, wlv->lnum) ? HLF_CLF : HLF_FC);
|
int attr = win_hl_attr(wp, use_cursor_line_highlight(wp, wlv->lnum) ? HLF_CLF : HLF_FC);
|
||||||
fill_foldcolumn(wp, wlv->foldinfo, wlv->lnum, attr, fdc, NULL);
|
fill_foldcolumn(wp, wlv->foldinfo, wlv->lnum, attr, fdc, &wlv->off, NULL);
|
||||||
assert(wlv->off == 0);
|
|
||||||
wlv->off = fdc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw the foldcolumn or fill "out_buffer". Assume monocell characters.
|
/// Draw the foldcolumn or fill "out_buffer". Assume monocell characters.
|
||||||
///
|
///
|
||||||
/// @param fdc Current width of the foldcolumn
|
/// @param fdc Current width of the foldcolumn
|
||||||
/// @param[out] out_buffer Char array to write into, only used for 'statuscolumn'
|
/// @param[out] wlv_off Pointer to linebuf offset, incremented for default column
|
||||||
void fill_foldcolumn(win_T *wp, foldinfo_T foldinfo, linenr_T lnum, int attr, int fdc,
|
/// @param[out] out_buffer Char array to fill, only used for 'statuscolumn'
|
||||||
|
void fill_foldcolumn(win_T *wp, foldinfo_T foldinfo, linenr_T lnum, int attr, int fdc, int *wlv_off,
|
||||||
schar_T *out_buffer)
|
schar_T *out_buffer)
|
||||||
{
|
{
|
||||||
bool closed = foldinfo.fi_level != 0 && foldinfo.fi_lines > 0;
|
bool closed = foldinfo.fi_level != 0 && foldinfo.fi_lines > 0;
|
||||||
@ -408,9 +407,8 @@ void fill_foldcolumn(win_T *wp, foldinfo_T foldinfo, linenr_T lnum, int attr, in
|
|||||||
// fits and use numbers to indicate the depth.
|
// fits and use numbers to indicate the depth.
|
||||||
int first_level = MAX(level - fdc - closed + 1, 1);
|
int first_level = MAX(level - fdc - closed + 1, 1);
|
||||||
int closedcol = MIN(fdc, level);
|
int closedcol = MIN(fdc, level);
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < fdc; i++) {
|
for (int i = 0; i < fdc; i++) {
|
||||||
int symbol = 0;
|
int symbol = 0;
|
||||||
if (i >= level) {
|
if (i >= level) {
|
||||||
symbol = ' ';
|
symbol = ' ';
|
||||||
@ -429,9 +427,9 @@ void fill_foldcolumn(win_T *wp, foldinfo_T foldinfo, linenr_T lnum, int attr, in
|
|||||||
if (out_buffer) {
|
if (out_buffer) {
|
||||||
out_buffer[i] = schar_from_char(symbol);
|
out_buffer[i] = schar_from_char(symbol);
|
||||||
} else {
|
} else {
|
||||||
linebuf_vcol[i] = i >= level ? -1 : (i == closedcol - 1 && closed) ? -2 : -3;
|
linebuf_vcol[*wlv_off] = i >= level ? -1 : (i == closedcol - 1 && closed) ? -2 : -3;
|
||||||
linebuf_attr[i] = attr;
|
linebuf_attr[*wlv_off] = attr;
|
||||||
linebuf_char[i] = schar_from_char(symbol);
|
linebuf_char[(*wlv_off)++] = schar_from_char(symbol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1640,8 +1640,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op
|
|||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
if (fold) {
|
if (fold) {
|
||||||
schar_T fold_buf[10];
|
schar_T fold_buf[10];
|
||||||
fill_foldcolumn(wp, stcp->foldinfo,
|
fill_foldcolumn(wp, stcp->foldinfo, (linenr_T)get_vim_var_nr(VV_LNUM),
|
||||||
(linenr_T)get_vim_var_nr(VV_LNUM), 0, fdc, fold_buf);
|
0, fdc, NULL, fold_buf);
|
||||||
stl_items[curitem].minwid = -((stcp->use_cul ? HLF_CLF : HLF_FC) + 1);
|
stl_items[curitem].minwid = -((stcp->use_cul ? HLF_CLF : HLF_FC) + 1);
|
||||||
size_t buflen = 0;
|
size_t buflen = 0;
|
||||||
// TODO(bfredl): this is very backwards. we must support schar_T
|
// TODO(bfredl): this is very backwards. we must support schar_T
|
||||||
|
Loading…
Reference in New Issue
Block a user