mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 11:18:19 +00:00
vim-patch:8.0.1123: cannot define a toolbar for a window
Problem: Cannot define a toolbar for a window.
Solution: Add a window-local toolbar.
1b9645de3c
"WinBar" code in "screen.c" was not ported.
Fix https://github.com/neovim/neovim/issues/11513#issuecomment-562012827
This commit is contained in:
@@ -1741,6 +1741,31 @@ static int advance_color_col(int vcol, int **color_cols)
|
||||
return **color_cols >= 0;
|
||||
}
|
||||
|
||||
// Returns the next grid column.
|
||||
static int text_to_screenline(win_T *wp, char_u *text, int col, int off)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
int idx = wp->w_p_rl ? off : off + col;
|
||||
LineState s = LINE_STATE(text);
|
||||
|
||||
while (*s.p != NUL) {
|
||||
// TODO(bfredl): cargo-culted from the old Vim code:
|
||||
// if(col + cells > wp->w_width - (wp->w_p_rl ? col : 0)) { break; }
|
||||
// This is obvious wrong. If Vim ever fixes this, solve for "cells" again
|
||||
// in the correct condition.
|
||||
const int maxcells = wp->w_grid.Columns - col - (wp->w_p_rl ? col : 0);
|
||||
const int cells = line_putchar(&s, &linebuf_char[idx], maxcells,
|
||||
wp->w_p_rl);
|
||||
if (cells == -1) {
|
||||
break;
|
||||
}
|
||||
col += cells;
|
||||
idx += cells;
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
// Compute the width of the foldcolumn. Based on 'foldcolumn' and how much
|
||||
// space is available for window "wp", minus "col".
|
||||
static int compute_foldcolumn(win_T *wp, int col)
|
||||
@@ -1942,29 +1967,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
|
||||
// 5. move the text to linebuf_char[off]. Fill up with "fold".
|
||||
// Right-left text is put in columns 0 - number-col, normal text is put
|
||||
// in columns number-col - window-width.
|
||||
int idx;
|
||||
|
||||
if (wp->w_p_rl) {
|
||||
idx = off;
|
||||
} else {
|
||||
idx = off + col;
|
||||
}
|
||||
|
||||
LineState s = LINE_STATE(text);
|
||||
|
||||
while (*s.p != NUL) {
|
||||
// TODO(bfredl): cargo-culted from the old Vim code:
|
||||
// if(col + cells > wp->w_width - (wp->w_p_rl ? col : 0)) { break; }
|
||||
// This is obvious wrong. If Vim ever fixes this, solve for "cells" again
|
||||
// in the correct condition.
|
||||
int maxcells = wp->w_grid.Columns - col - (wp->w_p_rl ? col : 0);
|
||||
int cells = line_putchar(&s, &linebuf_char[idx], maxcells, wp->w_p_rl);
|
||||
if (cells == -1) {
|
||||
break;
|
||||
}
|
||||
col += cells;
|
||||
idx += cells;
|
||||
}
|
||||
col = text_to_screenline(wp, text, col, off);
|
||||
|
||||
/* Fill the rest of the line with the fold filler */
|
||||
if (wp->w_p_rl)
|
||||
|
Reference in New Issue
Block a user