mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
refactor(ui): separate types for allocated grids and viewports
This commit is contained in:
@@ -1034,8 +1034,8 @@ Integer nvim_open_term(Buffer buffer, Dict(open_term) *opts, Error *err)
|
||||
.data = chan,
|
||||
// NB: overridden in terminal_check_size if a window is already
|
||||
// displaying the buffer
|
||||
.width = (uint16_t)MAX(curwin->w_width_inner - win_col_off(curwin), 0),
|
||||
.height = (uint16_t)curwin->w_height_inner,
|
||||
.width = (uint16_t)MAX(curwin->w_view_width - win_col_off(curwin), 0),
|
||||
.height = (uint16_t)curwin->w_view_height,
|
||||
.write_cb = term_write,
|
||||
.resize_cb = term_resize,
|
||||
.close_cb = term_close,
|
||||
@@ -2197,11 +2197,13 @@ static void redraw_status(win_T *wp, Dict(redraw) *opts, bool *flush)
|
||||
wp->w_nrwidth_line_count = 0;
|
||||
changed_window_setting(wp);
|
||||
}
|
||||
|
||||
int old_row_offset = wp->w_grid.row_offset;
|
||||
win_grid_alloc(wp);
|
||||
|
||||
// Flush later in case winbar was just hidden or shown for the first time, or
|
||||
// statuscolumn is being drawn.
|
||||
if (wp->w_lines_valid == 0) {
|
||||
if (wp->w_lines_valid == 0 || wp->w_grid.row_offset != old_row_offset) {
|
||||
*flush = true;
|
||||
}
|
||||
|
||||
|
@@ -1171,9 +1171,9 @@ struct window_S {
|
||||
///< this includes float border but excludes special columns
|
||||
///< implemented in win_line() (i.e. signs, folds, numbers)
|
||||
|
||||
// inner size of window, which can be overridden by external UI
|
||||
int w_height_inner;
|
||||
int w_width_inner;
|
||||
// Size of the window viewport. This is the area usable to draw columns and buffer contents
|
||||
int w_view_height;
|
||||
int w_view_width;
|
||||
// external UI request. If non-zero, the inner size will use this.
|
||||
int w_height_request;
|
||||
int w_width_request;
|
||||
@@ -1235,6 +1235,7 @@ struct window_S {
|
||||
// This is used for efficient redrawing.
|
||||
int w_lines_valid; // number of valid entries
|
||||
wline_T *w_lines;
|
||||
int w_lines_size;
|
||||
|
||||
garray_T w_folds; // array of nested folds
|
||||
bool w_fold_manual; // when true: some folds are opened/closed
|
||||
@@ -1331,7 +1332,7 @@ struct window_S {
|
||||
int w_tagstackidx; // idx just below active entry
|
||||
int w_tagstacklen; // number of tags on stack
|
||||
|
||||
ScreenGrid w_grid; // the grid specific to the window
|
||||
GridView w_grid; // area to draw on, excluding borders and winbar
|
||||
ScreenGrid w_grid_alloc; // the grid specific to the window
|
||||
bool w_pos_changed; // true if window position changed
|
||||
bool w_floating; ///< whether the window is floating
|
||||
|
@@ -633,7 +633,7 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
|
||||
|
||||
// Tricky: wildmenu can be drawn either over a status line, or at empty
|
||||
// scrolled space in the message output
|
||||
grid_line_start((wild_menu_showing == WM_SCROLLED) ? &msg_grid_adj : &default_grid, row);
|
||||
grid_line_start((wild_menu_showing == WM_SCROLLED) ? &msg_grid_adj : &default_gridview, row);
|
||||
|
||||
grid_line_puts(0, buf, -1, attr);
|
||||
if (selstart != NULL && highlight) {
|
||||
|
@@ -122,12 +122,12 @@ static int coladvance2(win_T *wp, pos_T *pos, bool addspaces, bool finetune, col
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int width = wp->w_width_inner - win_col_off(wp);
|
||||
int width = wp->w_view_width - win_col_off(wp);
|
||||
int csize = 0;
|
||||
|
||||
if (finetune
|
||||
&& wp->w_p_wrap
|
||||
&& wp->w_width_inner != 0
|
||||
&& wp->w_view_width != 0
|
||||
&& wcol >= (colnr_T)width
|
||||
&& width > 0) {
|
||||
csize = linetabsize_eol(wp, pos->lnum);
|
||||
@@ -233,7 +233,7 @@ static int coladvance2(win_T *wp, pos_T *pos, bool addspaces, bool finetune, col
|
||||
int b = (int)wcol - (int)col;
|
||||
|
||||
// The difference between wcol and col is used to set coladd.
|
||||
if (b > 0 && b < (MAXCOL - 2 * wp->w_width_inner)) {
|
||||
if (b > 0 && b < (MAXCOL - 2 * wp->w_view_width)) {
|
||||
pos->coladd = b;
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ bool set_leftcol(colnr_T leftcol)
|
||||
changed_cline_bef_curs(curwin);
|
||||
// TODO(hinidu): I think it should be colnr_T or int, but p_siso is long.
|
||||
// Perhaps we can change p_siso to int.
|
||||
int64_t lastcol = curwin->w_leftcol + curwin->w_width_inner - win_col_off(curwin) - 1;
|
||||
int64_t lastcol = curwin->w_leftcol + curwin->w_view_width - win_col_off(curwin) - 1;
|
||||
validate_virtcol(curwin);
|
||||
|
||||
bool retval = false;
|
||||
|
@@ -181,7 +181,7 @@ static void margin_columns_win(win_T *wp, int *left_col, int *right_col)
|
||||
static int prev_right_col;
|
||||
|
||||
int cur_col_off = win_col_off(wp);
|
||||
int width1 = wp->w_width_inner - cur_col_off;
|
||||
int width1 = wp->w_view_width - cur_col_off;
|
||||
int width2 = width1 + win_col_off2(wp);
|
||||
|
||||
if (saved_w_virtcol == wp->w_virtcol && prev_wp == wp
|
||||
@@ -258,7 +258,7 @@ static int line_putchar(buf_T *buf, const char **pp, schar_T *dest, int maxcells
|
||||
static void draw_virt_text(win_T *wp, buf_T *buf, int col_off, int *end_col, int win_row)
|
||||
{
|
||||
DecorState *const state = &decor_state;
|
||||
int const max_col = wp->w_grid.cols;
|
||||
int const max_col = wp->w_view_width;
|
||||
int right_pos = max_col;
|
||||
bool const do_eol = state->eol_col > -1;
|
||||
|
||||
@@ -330,7 +330,7 @@ static void draw_virt_text(win_T *wp, buf_T *buf, int col_off, int *end_col, int
|
||||
} else {
|
||||
updated = false;
|
||||
}
|
||||
if (updated && (item->draw_col < 0 || item->draw_col >= wp->w_grid.cols)) {
|
||||
if (updated && (item->draw_col < 0 || item->draw_col >= wp->w_view_width)) {
|
||||
// Out of window, don't draw at all.
|
||||
item->draw_col = INT_MIN;
|
||||
}
|
||||
@@ -432,9 +432,9 @@ static void draw_col_buf(win_T *wp, winlinevars_T *wlv, const char *text, size_t
|
||||
const colnr_T *fold_vcol, bool inc_vcol)
|
||||
{
|
||||
const char *ptr = text;
|
||||
while (ptr < text + len && wlv->off < wp->w_grid.cols) {
|
||||
while (ptr < text + len && wlv->off < wp->w_view_width) {
|
||||
int cells = line_putchar(wp->w_buffer, &ptr, &linebuf_char[wlv->off],
|
||||
wp->w_grid.cols - wlv->off, wlv->off);
|
||||
wp->w_view_width - wlv->off, wlv->off);
|
||||
int myattr = attr;
|
||||
if (inc_vcol) {
|
||||
advance_color_col(wlv, wlv->vcol);
|
||||
@@ -788,7 +788,7 @@ static void handle_breakindent(win_T *wp, winlinevars_T *wlv)
|
||||
|
||||
static void handle_showbreak_and_filler(win_T *wp, winlinevars_T *wlv)
|
||||
{
|
||||
int remaining = wp->w_grid.cols - wlv->off;
|
||||
int remaining = wp->w_view_width - wlv->off;
|
||||
if (wlv->filler_todo > wlv->filler_lines - wlv->n_virt_lines) {
|
||||
// TODO(bfredl): check this doesn't inhibit TUI-style
|
||||
// clear-to-end-of-line.
|
||||
@@ -986,7 +986,7 @@ static void win_line_start(win_T *wp, winlinevars_T *wlv)
|
||||
wlv->col = 0;
|
||||
wlv->off = 0;
|
||||
wlv->need_lbr = false;
|
||||
for (int i = 0; i < wp->w_grid.cols; i++) {
|
||||
for (int i = 0; i < wp->w_view_width; i++) {
|
||||
linebuf_char[i] = schar_from_ascii(' ');
|
||||
linebuf_attr[i] = 0;
|
||||
linebuf_vcol[i] = -1;
|
||||
@@ -1041,7 +1041,9 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
spellvars_T *spv, foldinfo_T foldinfo)
|
||||
{
|
||||
colnr_T vcol_prev = -1; // "wlv.vcol" of previous character
|
||||
ScreenGrid *grid = &wp->w_grid; // grid specific to the window
|
||||
GridView *grid = &wp->w_grid; // grid specific to the window
|
||||
const int view_width = wp->w_view_width;
|
||||
const int view_height = wp->w_view_height;
|
||||
|
||||
const bool in_curline = wp == curwin && lnum == curwin->w_cursor.lnum;
|
||||
const bool has_fold = foldinfo.fi_level != 0 && foldinfo.fi_lines > 0;
|
||||
@@ -1695,7 +1697,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
|
||||
// When only updating the columns and that's done, stop here.
|
||||
if (col_rows > 0) {
|
||||
wlv_put_linebuf(wp, &wlv, MIN(wlv.off, grid->cols), false, bg_attr, 0);
|
||||
wlv_put_linebuf(wp, &wlv, MIN(wlv.off, view_width), false, bg_attr, 0);
|
||||
// Need to update more screen lines if:
|
||||
// - 'statuscolumn' needs to be drawn, or
|
||||
// - LineNrAbove or LineNrBelow is used, or
|
||||
@@ -1740,8 +1742,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
// hide virt_text on text hidden by 'nowrap' or 'smoothscroll'
|
||||
decor_redraw_col(wp, (colnr_T)(ptr - line) - 1, wlv.off, true, &decor_state);
|
||||
}
|
||||
if (wlv.col >= grid->cols) {
|
||||
wlv.col = wlv.off = grid->cols;
|
||||
if (wlv.col >= view_width) {
|
||||
wlv.col = wlv.off = view_width;
|
||||
goto end_check;
|
||||
}
|
||||
}
|
||||
@@ -1761,7 +1763,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
if (wp->w_p_cuc) {
|
||||
wlv.row = wp->w_cline_row + wp->w_cline_height;
|
||||
} else {
|
||||
wlv.row = grid->rows;
|
||||
wlv.row = view_height;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1944,14 +1946,14 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
ptr = line + v;
|
||||
}
|
||||
|
||||
if (draw_folded && wlv.n_extra == 0 && wlv.col < grid->cols && (has_foldtext || *ptr == NUL)) {
|
||||
if (draw_folded && wlv.n_extra == 0 && wlv.col < view_width && (has_foldtext || *ptr == NUL)) {
|
||||
// Fill rest of line with 'fold'.
|
||||
wlv.sc_extra = wp->w_p_fcs_chars.fold;
|
||||
wlv.sc_final = NUL;
|
||||
wlv.n_extra = grid->cols - wlv.col;
|
||||
wlv.n_extra = view_width - wlv.col;
|
||||
}
|
||||
|
||||
if (draw_folded && wlv.n_extra != 0 && wlv.col >= grid->cols) {
|
||||
if (draw_folded && wlv.n_extra != 0 && wlv.col >= view_width) {
|
||||
// Truncate the folding.
|
||||
wlv.n_extra = 0;
|
||||
}
|
||||
@@ -1981,7 +1983,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
|
||||
// If a double-width char doesn't fit display a '>' in the last column.
|
||||
// Don't advance the pointer but put the character at the start of the next line.
|
||||
if (wlv.col >= grid->cols - 1 && schar_cells(mb_schar) == 2) {
|
||||
if (wlv.col >= view_width - 1 && schar_cells(mb_schar) == 2) {
|
||||
mb_c = '>';
|
||||
mb_l = 1;
|
||||
mb_schar = schar_from_ascii(mb_c);
|
||||
@@ -2054,7 +2056,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
// initialize these.
|
||||
mb_c = ' ';
|
||||
mb_schar = schar_from_ascii(' ');
|
||||
} else if (has_foldtext || (has_fold && wlv.col >= grid->cols)) {
|
||||
} else if (has_foldtext || (has_fold && wlv.col >= view_width)) {
|
||||
// skip writing the buffer line itself
|
||||
mb_schar = NUL;
|
||||
} else {
|
||||
@@ -2104,7 +2106,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
// If a double-width char doesn't fit display a '>' in the
|
||||
// last column; the character is displayed at the start of the
|
||||
// next line.
|
||||
if (wlv.col >= grid->cols - 1 && schar_cells(mb_schar) == 2) {
|
||||
if (wlv.col >= view_width - 1 && schar_cells(mb_schar) == 2) {
|
||||
mb_schar = schar_from_ascii('>');
|
||||
mb_c = '>';
|
||||
mb_l = 1;
|
||||
@@ -2286,7 +2288,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
search_attr = 0;
|
||||
}
|
||||
|
||||
if (mb_c == TAB && wlv.n_extra + wlv.col > grid->cols) {
|
||||
if (mb_c == TAB && wlv.n_extra + wlv.col > view_width) {
|
||||
wlv.n_extra = tabstop_padding(wlv.vcol, wp->w_buffer->b_p_ts,
|
||||
wp->w_buffer->b_p_vts_array) - 1;
|
||||
}
|
||||
@@ -2478,7 +2480,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
|| ((wlv.fromcol >= 0 || fromcol_prev >= 0)
|
||||
&& wlv.tocol > wlv.vcol
|
||||
&& VIsual_mode != Ctrl_V
|
||||
&& wlv.col < grid->cols
|
||||
&& wlv.col < view_width
|
||||
&& !(noinvcur
|
||||
&& lnum == wp->w_cursor.lnum
|
||||
&& wlv.vcol == wp->w_virtcol)))
|
||||
@@ -2536,7 +2538,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
&& virtual_active(wp)
|
||||
&& wlv.tocol != MAXCOL
|
||||
&& wlv.vcol < wlv.tocol
|
||||
&& wlv.col < grid->cols) {
|
||||
&& wlv.col < view_width) {
|
||||
mb_c = ' ';
|
||||
mb_schar = schar_from_char(mb_c);
|
||||
ptr--; // put it back at the NUL
|
||||
@@ -2693,7 +2695,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
|| prevcol_hl_flag)) {
|
||||
int n = 0;
|
||||
|
||||
if (wlv.col >= grid->cols) {
|
||||
if (wlv.col >= view_width) {
|
||||
n = -1;
|
||||
}
|
||||
if (n != 0) {
|
||||
@@ -2748,13 +2750,13 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
decor_redraw_eol(wp, &decor_state, &wlv.line_attr, wlv.col + eol_skip);
|
||||
}
|
||||
|
||||
for (int i = wlv.col; i < grid->cols; i++) {
|
||||
for (int i = wlv.col; i < view_width; i++) {
|
||||
linebuf_vcol[wlv.off + (i - wlv.col)] = wlv.vcol + (i - wlv.col);
|
||||
}
|
||||
|
||||
if (((wp->w_p_cuc
|
||||
&& wp->w_virtcol >= vcol_hlc(wlv) - eol_hl_off
|
||||
&& wp->w_virtcol < grid->cols * (ptrdiff_t)(wlv.row - startrow + 1) + start_col
|
||||
&& wp->w_virtcol < view_width * (ptrdiff_t)(wlv.row - startrow + 1) + start_col
|
||||
&& lnum != wp->w_cursor.lnum)
|
||||
|| wlv.color_cols || wlv.line_attr_lowprio || wlv.line_attr
|
||||
|| wlv.diff_hlf != 0 || wp->w_buffer->terminal)) {
|
||||
@@ -2776,7 +2778,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
rightmost_vcol = INT_MAX;
|
||||
}
|
||||
|
||||
while (wlv.col < grid->cols) {
|
||||
while (wlv.col < view_width) {
|
||||
linebuf_char[wlv.off] = schar_from_ascii(' ');
|
||||
|
||||
advance_color_col(&wlv, vcol_hlc(wlv));
|
||||
@@ -2809,7 +2811,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
}
|
||||
|
||||
if (kv_size(fold_vt) > 0) {
|
||||
draw_virt_text_item(buf, win_col_offset, fold_vt, kHlModeCombine, grid->cols, 0, 0);
|
||||
draw_virt_text_item(buf, win_col_offset, fold_vt, kHlModeCombine, view_width, 0, 0);
|
||||
}
|
||||
draw_virt_text(wp, buf, win_col_offset, &wlv.col, wlv.row);
|
||||
// Set increasing virtual columns in grid->vcols[] to set correct curswant
|
||||
@@ -2837,7 +2839,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
&& wp->w_p_list
|
||||
&& !wp->w_p_wrap
|
||||
&& wlv.filler_todo <= 0
|
||||
&& wlv.col == grid->cols - 1
|
||||
&& wlv.col == view_width - 1
|
||||
&& !has_foldtext) {
|
||||
if (has_decor && *ptr == NUL && lcs_eol == 0 && lcs_eol_todo) {
|
||||
// Tricky: there might be a virtual text just _after_ the last char
|
||||
@@ -2999,7 +3001,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
wlv.char_attr = saved_attr2;
|
||||
}
|
||||
|
||||
if (has_decor && wlv.filler_todo <= 0 && wlv.col >= grid->cols) {
|
||||
if (has_decor && wlv.filler_todo <= 0 && wlv.col >= view_width) {
|
||||
// At the end of screen line: might need to peek for decorations just after
|
||||
// this position.
|
||||
if (is_wrapped && wlv.n_extra == 0) {
|
||||
@@ -3017,31 +3019,31 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
end_check:
|
||||
// At end of screen line and there is more to come: Display the line
|
||||
// so far. If there is no more to display it is caught above.
|
||||
if (wlv.col >= grid->cols && (!has_foldtext || virt_line_index >= 0)
|
||||
if (wlv.col >= view_width && (!has_foldtext || virt_line_index >= 0)
|
||||
&& (wlv.col <= leftcols_width
|
||||
|| *ptr != NUL
|
||||
|| wlv.filler_todo > 0
|
||||
|| (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL && lcs_eol_todo)
|
||||
|| (wlv.n_extra != 0 && (wlv.sc_extra != NUL || *wlv.p_extra != NUL))
|
||||
|| (may_have_inline_virt && has_more_inline_virt(&wlv, ptr - line)))) {
|
||||
const bool wrap = is_wrapped // Wrapping enabled (not a folded line).
|
||||
&& wlv.filler_todo <= 0 // Not drawing diff filler lines.
|
||||
&& lcs_eol_todo // Haven't printed the lcs_eol character.
|
||||
&& wlv.row != endrow - 1 // Not the last line being displayed.
|
||||
&& (grid->cols == Columns // Window spans the width of the screen,
|
||||
|| ui_has(kUIMultigrid)) // or has dedicated grid.
|
||||
&& !wp->w_p_rl; // Not right-to-left.
|
||||
const bool wrap = is_wrapped // Wrapping enabled (not a folded line).
|
||||
&& wlv.filler_todo <= 0 // Not drawing diff filler lines.
|
||||
&& lcs_eol_todo // Haven't printed the lcs_eol character.
|
||||
&& wlv.row != endrow - 1 // Not the last line being displayed.
|
||||
&& (view_width == Columns // Window spans the width of the screen,
|
||||
|| wp->w_grid_alloc.chars) // or has dedicated grid.
|
||||
&& !wp->w_p_rl; // Not right-to-left.
|
||||
|
||||
int draw_col = wlv.col - wlv.boguscols;
|
||||
|
||||
for (int i = draw_col; i < grid->cols; i++) {
|
||||
for (int i = draw_col; i < view_width; i++) {
|
||||
linebuf_vcol[wlv.off + (i - draw_col)] = wlv.vcol - 1;
|
||||
}
|
||||
|
||||
// Apply 'cursorline' highlight.
|
||||
if (wlv.boguscols != 0 && (wlv.line_attr_lowprio != 0 || wlv.line_attr != 0)) {
|
||||
int attr = hl_combine_attr(wlv.line_attr_lowprio, wlv.line_attr);
|
||||
while (draw_col < grid->cols) {
|
||||
while (draw_col < view_width) {
|
||||
linebuf_char[wlv.off] = schar_from_char(' ');
|
||||
linebuf_attr[wlv.off] = attr;
|
||||
// linebuf_vcol[] already filled by the for loop above
|
||||
@@ -3055,7 +3057,7 @@ end_check:
|
||||
virt_line_flags & kVLLeftcol ? 0 : win_col_offset,
|
||||
kv_A(virt_lines, virt_line_index).line,
|
||||
kHlModeReplace,
|
||||
grid->cols,
|
||||
view_width,
|
||||
0,
|
||||
virt_line_flags & kVLScroll ? wp->w_leftcol : 0);
|
||||
} else if (wlv.filler_todo <= 0) {
|
||||
@@ -3064,10 +3066,9 @@ end_check:
|
||||
|
||||
wlv_put_linebuf(wp, &wlv, draw_col, true, bg_attr, wrap ? SLF_WRAP : 0);
|
||||
if (wrap) {
|
||||
ScreenGrid *current_grid = grid;
|
||||
int current_row = wlv.row;
|
||||
int dummy_col = 0; // unused
|
||||
grid_adjust(¤t_grid, ¤t_row, &dummy_col);
|
||||
ScreenGrid *current_grid = grid_adjust(grid, ¤t_row, &dummy_col);
|
||||
|
||||
// Force a redraw of the first column of the next line.
|
||||
current_grid->attrs[current_grid->line_offset[current_row + 1]] = -1;
|
||||
@@ -3084,7 +3085,7 @@ end_check:
|
||||
|
||||
// When the window is too narrow draw all "@" lines.
|
||||
if (wlv.col <= leftcols_width) {
|
||||
win_draw_end(wp, schar_from_ascii('@'), true, wlv.row, wp->w_grid.rows, HLF_AT);
|
||||
win_draw_end(wp, schar_from_ascii('@'), true, wlv.row, wp->w_view_height, HLF_AT);
|
||||
set_empty_rows(wp, wlv.row);
|
||||
wlv.row = endrow;
|
||||
}
|
||||
@@ -3132,14 +3133,14 @@ end_check:
|
||||
static void wlv_put_linebuf(win_T *wp, const winlinevars_T *wlv, int endcol, bool clear_end,
|
||||
int bg_attr, int flags)
|
||||
{
|
||||
ScreenGrid *grid = &wp->w_grid;
|
||||
GridView *grid = &wp->w_grid;
|
||||
|
||||
int startcol = 0;
|
||||
int clear_width = clear_end ? grid->cols : endcol;
|
||||
int clear_width = clear_end ? wp->w_view_width : endcol;
|
||||
|
||||
assert(!(flags & SLF_RIGHTLEFT));
|
||||
if (wp->w_p_rl) {
|
||||
linebuf_mirror(&startcol, &endcol, &clear_width, grid->cols);
|
||||
linebuf_mirror(&startcol, &endcol, &clear_width, wp->w_view_width);
|
||||
flags |= SLF_RIGHTLEFT;
|
||||
}
|
||||
|
||||
@@ -3152,13 +3153,13 @@ static void wlv_put_linebuf(win_T *wp, const winlinevars_T *wlv, int endcol, boo
|
||||
int off = 0;
|
||||
if (wp->w_p_nu && wp->w_p_rnu) {
|
||||
// do not overwrite the line number, change "123 text" to "123<<<xt".
|
||||
while (off < grid->cols && ascii_isdigit(schar_get_ascii(linebuf_char[off]))) {
|
||||
while (off < wp->w_view_width && ascii_isdigit(schar_get_ascii(linebuf_char[off]))) {
|
||||
off++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3 && off < grid->cols; i++) {
|
||||
if (off + 1 < grid->cols && linebuf_char[off + 1] == NUL) {
|
||||
for (int i = 0; i < 3 && off < wp->w_view_width; i++) {
|
||||
if (off + 1 < wp->w_view_width && linebuf_char[off + 1] == NUL) {
|
||||
// When the first half of a double-width character is
|
||||
// overwritten, change the second half to a space.
|
||||
linebuf_char[off + 1] = schar_from_ascii(' ');
|
||||
@@ -3171,6 +3172,6 @@ static void wlv_put_linebuf(win_T *wp, const winlinevars_T *wlv, int endcol, boo
|
||||
|
||||
int row = wlv->row;
|
||||
int coloff = 0;
|
||||
grid_adjust(&grid, &row, &coloff);
|
||||
grid_put_linebuf(grid, row, coloff, startcol, endcol, clear_width, bg_attr, wlv->vcol - 1, flags);
|
||||
ScreenGrid *g = grid_adjust(grid, &row, &coloff);
|
||||
grid_put_linebuf(g, row, coloff, startcol, endcol, clear_width, bg_attr, wlv->vcol - 1, flags);
|
||||
}
|
||||
|
@@ -210,8 +210,6 @@ bool default_grid_alloc(void)
|
||||
default_grid.comp_height = Rows;
|
||||
default_grid.comp_width = Columns;
|
||||
|
||||
default_grid.row_offset = 0;
|
||||
default_grid.col_offset = 0;
|
||||
default_grid.handle = DEFAULT_GRID_HANDLE;
|
||||
|
||||
resizing = false;
|
||||
@@ -569,7 +567,7 @@ int update_screen(void)
|
||||
|
||||
// might need to clear space on default_grid for the message area.
|
||||
if (type == UPD_NOT_VALID && clear_cmdline && !ui_has(kUIMessages)) {
|
||||
grid_clear(&default_grid, Rows - (int)p_ch, Rows, 0, Columns, 0);
|
||||
grid_clear(&default_gridview, Rows - (int)p_ch, Rows, 0, Columns, 0);
|
||||
}
|
||||
|
||||
ui_comp_set_screen_valid(true);
|
||||
@@ -773,11 +771,11 @@ static void win_redr_border(win_T *wp)
|
||||
int *attrs = wp->w_config.border_attr;
|
||||
|
||||
int *adj = wp->w_border_adj;
|
||||
int irow = wp->w_height_inner + wp->w_winbar_height;
|
||||
int icol = wp->w_width_inner;
|
||||
int irow = wp->w_view_height + wp->w_winbar_height;
|
||||
int icol = wp->w_view_width;
|
||||
|
||||
if (adj[0]) {
|
||||
grid_line_start(grid, 0);
|
||||
screengrid_line_start(grid, 0, 0);
|
||||
if (adj[3]) {
|
||||
grid_line_put_schar(0, chars[0], attrs[0]);
|
||||
}
|
||||
@@ -799,20 +797,20 @@ static void win_redr_border(win_T *wp)
|
||||
|
||||
for (int i = 0; i < irow; i++) {
|
||||
if (adj[3]) {
|
||||
grid_line_start(grid, i + adj[0]);
|
||||
screengrid_line_start(grid, i + adj[0], 0);
|
||||
grid_line_put_schar(0, chars[7], attrs[7]);
|
||||
grid_line_flush();
|
||||
}
|
||||
if (adj[1]) {
|
||||
int ic = (i == 0 && !adj[0] && chars[2]) ? 2 : 3;
|
||||
grid_line_start(grid, i + adj[0]);
|
||||
screengrid_line_start(grid, i + adj[0], 0);
|
||||
grid_line_put_schar(icol + adj[3], chars[ic], attrs[ic]);
|
||||
grid_line_flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (adj[2]) {
|
||||
grid_line_start(grid, irow + adj[0]);
|
||||
screengrid_line_start(grid, irow + adj[0], 0);
|
||||
if (adj[3]) {
|
||||
grid_line_put_schar(0, chars[6], attrs[6]);
|
||||
}
|
||||
@@ -847,19 +845,20 @@ void setcursor_mayforce(win_T *wp, bool force)
|
||||
if (force || redrawing()) {
|
||||
validate_cursor(wp);
|
||||
|
||||
ScreenGrid *grid = &wp->w_grid;
|
||||
int row = wp->w_wrow;
|
||||
int col = wp->w_wcol;
|
||||
if (wp->w_p_rl) {
|
||||
// With 'rightleft' set and the cursor on a double-wide character,
|
||||
// position it on the leftmost column.
|
||||
char *cursor = ml_get_buf(wp->w_buffer, wp->w_cursor.lnum) + wp->w_cursor.col;
|
||||
col = wp->w_width_inner - wp->w_wcol - ((utf_ptr2cells(cursor) == 2
|
||||
&& vim_isprintc(utf_ptr2char(cursor))) ? 2 : 1);
|
||||
col = wp->w_view_width - wp->w_wcol - ((utf_ptr2cells(cursor) == 2
|
||||
&& vim_isprintc(utf_ptr2char(cursor))) ? 2 : 1);
|
||||
}
|
||||
|
||||
grid_adjust(&grid, &row, &col);
|
||||
ui_grid_cursor_goto(grid->handle, row, col);
|
||||
ScreenGrid *grid = grid_adjust(&wp->w_grid, &row, &col);
|
||||
if (grid) {
|
||||
ui_grid_cursor_goto(grid->handle, row, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1338,7 +1337,7 @@ static void draw_vsep_win(win_T *wp)
|
||||
|
||||
// draw the vertical separator right of this window
|
||||
for (int row = wp->w_winrow; row < W_ENDROW(wp); row++) {
|
||||
grid_line_start(&default_grid, row);
|
||||
grid_line_start(&default_gridview, row);
|
||||
grid_line_put_schar(W_ENDCOL(wp), wp->w_p_fcs_chars.vert, win_hl_attr(wp, HLF_C));
|
||||
grid_line_flush();
|
||||
}
|
||||
@@ -1352,7 +1351,7 @@ static void draw_hsep_win(win_T *wp)
|
||||
}
|
||||
|
||||
// draw the horizontal separator below this window
|
||||
grid_line_start(&default_grid, W_ENDROW(wp));
|
||||
grid_line_start(&default_gridview, W_ENDROW(wp));
|
||||
grid_line_fill(wp->w_wincol, W_ENDCOL(wp), wp->w_p_fcs_chars.horiz, win_hl_attr(wp, HLF_C));
|
||||
grid_line_flush();
|
||||
}
|
||||
@@ -1417,22 +1416,22 @@ static void draw_sep_connectors_win(win_T *wp)
|
||||
bool bot_right = !(win_at_bottom || win_at_right);
|
||||
|
||||
if (top_left) {
|
||||
grid_line_start(&default_grid, wp->w_winrow - 1);
|
||||
grid_line_start(&default_gridview, wp->w_winrow - 1);
|
||||
grid_line_put_schar(wp->w_wincol - 1, get_corner_sep_connector(wp, WC_TOP_LEFT), hl);
|
||||
grid_line_flush();
|
||||
}
|
||||
if (top_right) {
|
||||
grid_line_start(&default_grid, wp->w_winrow - 1);
|
||||
grid_line_start(&default_gridview, wp->w_winrow - 1);
|
||||
grid_line_put_schar(W_ENDCOL(wp), get_corner_sep_connector(wp, WC_TOP_RIGHT), hl);
|
||||
grid_line_flush();
|
||||
}
|
||||
if (bot_left) {
|
||||
grid_line_start(&default_grid, W_ENDROW(wp));
|
||||
grid_line_start(&default_gridview, W_ENDROW(wp));
|
||||
grid_line_put_schar(wp->w_wincol - 1, get_corner_sep_connector(wp, WC_BOTTOM_LEFT), hl);
|
||||
grid_line_flush();
|
||||
}
|
||||
if (bot_right) {
|
||||
grid_line_start(&default_grid, W_ENDROW(wp));
|
||||
grid_line_start(&default_gridview, W_ENDROW(wp));
|
||||
grid_line_put_schar(W_ENDCOL(wp), get_corner_sep_connector(wp, WC_BOTTOM_RIGHT), hl);
|
||||
grid_line_flush();
|
||||
}
|
||||
@@ -1500,7 +1499,7 @@ static void win_update(win_T *wp)
|
||||
}
|
||||
|
||||
// Window is zero-height: Only need to draw the separator
|
||||
if (wp->w_grid.rows == 0) {
|
||||
if (wp->w_view_height == 0) {
|
||||
// draw the horizontal separator below this window
|
||||
draw_hsep_win(wp);
|
||||
draw_sep_connectors_win(wp);
|
||||
@@ -1509,7 +1508,7 @@ static void win_update(win_T *wp)
|
||||
}
|
||||
|
||||
// Window is zero-width: Only need to draw the separator.
|
||||
if (wp->w_grid.cols == 0) {
|
||||
if (wp->w_view_width == 0) {
|
||||
// draw the vertical separator right of this window
|
||||
draw_vsep_win(wp);
|
||||
draw_sep_connectors_win(wp);
|
||||
@@ -1544,9 +1543,9 @@ static void win_update(win_T *wp)
|
||||
|
||||
// Make sure skipcol is valid, it depends on various options and the window
|
||||
// width.
|
||||
if (wp->w_skipcol > 0 && wp->w_width_inner > win_col_off(wp)) {
|
||||
if (wp->w_skipcol > 0 && wp->w_view_width > win_col_off(wp)) {
|
||||
int w = 0;
|
||||
int width1 = wp->w_width_inner - win_col_off(wp);
|
||||
int width1 = wp->w_view_width - win_col_off(wp);
|
||||
int width2 = width1 + win_col_off2(wp);
|
||||
int add = width1;
|
||||
|
||||
@@ -1738,7 +1737,7 @@ static void win_update(win_T *wp)
|
||||
j = 0;
|
||||
for (linenr_T ln = wp->w_topline; ln < wp->w_lines[0].wl_lnum; ln++) {
|
||||
j += !decor_conceal_line(wp, ln - 1, false);
|
||||
if (j >= wp->w_grid.rows - 2) {
|
||||
if (j >= wp->w_view_height - 2) {
|
||||
break;
|
||||
}
|
||||
hasFolding(wp, ln, NULL, &ln);
|
||||
@@ -1746,13 +1745,13 @@ static void win_update(win_T *wp)
|
||||
} else {
|
||||
j = wp->w_lines[0].wl_lnum - wp->w_topline;
|
||||
}
|
||||
if (j < wp->w_grid.rows - 2) { // not too far off
|
||||
int i = plines_m_win(wp, wp->w_topline, wp->w_lines[0].wl_lnum - 1, wp->w_height_inner);
|
||||
if (j < wp->w_view_height - 2) { // not too far off
|
||||
int i = plines_m_win(wp, wp->w_topline, wp->w_lines[0].wl_lnum - 1, wp->w_view_height);
|
||||
// insert extra lines for previously invisible filler lines
|
||||
if (wp->w_lines[0].wl_lnum != wp->w_topline) {
|
||||
i += win_get_fill(wp, wp->w_lines[0].wl_lnum) - wp->w_old_topfill;
|
||||
}
|
||||
if (i != 0 && i < wp->w_grid.rows - 2) { // less than a screen off
|
||||
if (i != 0 && i < wp->w_view_height - 2) { // less than a screen off
|
||||
// Try to insert the correct number of lines.
|
||||
// If not the last window, delete the lines at the bottom.
|
||||
// win_ins_lines may fail when the terminal can't do it.
|
||||
@@ -1766,8 +1765,8 @@ static void win_update(win_T *wp)
|
||||
|
||||
// Move the entries that were scrolled, disable
|
||||
// the entries for the lines to be redrawn.
|
||||
if ((wp->w_lines_valid += (linenr_T)j) > wp->w_grid.rows) {
|
||||
wp->w_lines_valid = wp->w_grid.rows;
|
||||
if ((wp->w_lines_valid += (linenr_T)j) > wp->w_view_height) {
|
||||
wp->w_lines_valid = wp->w_view_height;
|
||||
}
|
||||
int idx;
|
||||
for (idx = wp->w_lines_valid; idx - j >= 0; idx--) {
|
||||
@@ -1818,7 +1817,7 @@ static void win_update(win_T *wp)
|
||||
row -= wp->w_topfill;
|
||||
if (row > 0) {
|
||||
win_scroll_lines(wp, 0, -row);
|
||||
bot_start = wp->w_grid.rows - row;
|
||||
bot_start = wp->w_view_height - row;
|
||||
bot_scroll_start = bot_start;
|
||||
}
|
||||
if ((row == 0 || bot_start < 999) && wp->w_lines_valid != 0) {
|
||||
@@ -1833,7 +1832,7 @@ static void win_update(win_T *wp)
|
||||
// stop at line that didn't fit, unless it is still
|
||||
// valid (no lines deleted)
|
||||
if (row > 0 && bot_start + row
|
||||
+ (int)wp->w_lines[j].wl_size > wp->w_grid.rows) {
|
||||
+ (int)wp->w_lines[j].wl_size > wp->w_view_height) {
|
||||
wp->w_lines_valid = idx + 1;
|
||||
break;
|
||||
}
|
||||
@@ -1851,7 +1850,7 @@ static void win_update(win_T *wp)
|
||||
if (win_may_fill(wp) && bot_start > 0) {
|
||||
int n = plines_win_nofill(wp, wp->w_topline, false) + wp->w_topfill
|
||||
- adjust_plines_for_skipcol(wp);
|
||||
n = MIN(n, wp->w_height_inner);
|
||||
n = MIN(n, wp->w_view_height);
|
||||
wp->w_lines[0].wl_size = (uint16_t)n;
|
||||
}
|
||||
}
|
||||
@@ -1860,18 +1859,18 @@ static void win_update(win_T *wp)
|
||||
|
||||
// When starting redraw in the first line, redraw all lines.
|
||||
if (mid_start == 0) {
|
||||
mid_end = wp->w_grid.rows;
|
||||
mid_end = wp->w_view_height;
|
||||
}
|
||||
} else {
|
||||
// Not UPD_VALID or UPD_INVERTED: redraw all lines.
|
||||
mid_start = 0;
|
||||
mid_end = wp->w_grid.rows;
|
||||
mid_end = wp->w_view_height;
|
||||
}
|
||||
|
||||
if (type == UPD_SOME_VALID) {
|
||||
// UPD_SOME_VALID: redraw all lines.
|
||||
mid_start = 0;
|
||||
mid_end = wp->w_grid.rows;
|
||||
mid_end = wp->w_view_height;
|
||||
type = UPD_NOT_VALID;
|
||||
}
|
||||
|
||||
@@ -2019,7 +2018,7 @@ static void win_update(win_T *wp)
|
||||
}
|
||||
}
|
||||
srow += mid_start;
|
||||
mid_end = wp->w_grid.rows;
|
||||
mid_end = wp->w_view_height;
|
||||
for (; idx < wp->w_lines_valid; idx++) { // find end
|
||||
if (wp->w_lines[idx].wl_valid
|
||||
&& wp->w_lines[idx].wl_lnum >= to + 1) {
|
||||
@@ -2068,7 +2067,7 @@ static void win_update(win_T *wp)
|
||||
while (true) {
|
||||
// stop updating when reached the end of the window (check for _past_
|
||||
// the end of the window is at the end of the loop)
|
||||
if (row == wp->w_grid.rows) {
|
||||
if (row == wp->w_view_height) {
|
||||
didline = true;
|
||||
break;
|
||||
}
|
||||
@@ -2191,9 +2190,9 @@ static void win_update(win_T *wp)
|
||||
for (l = lnum; l < mod_bot; l++) {
|
||||
int n = plines_win_full(wp, l, &l, NULL, true, false);
|
||||
n -= (l == wp->w_topline ? adjust_plines_for_skipcol(wp) : 0);
|
||||
new_rows += MIN(n, wp->w_height_inner);
|
||||
new_rows += MIN(n, wp->w_view_height);
|
||||
j += n > 0; // don't count concealed lines
|
||||
if (new_rows > wp->w_grid.rows - row - 2) {
|
||||
if (new_rows > wp->w_view_height - row - 2) {
|
||||
// it's getting too much, must redraw the rest
|
||||
new_rows = 9999;
|
||||
break;
|
||||
@@ -2205,18 +2204,18 @@ static void win_update(win_T *wp)
|
||||
// remaining text or scrolling fails, must redraw the
|
||||
// rest. If scrolling works, must redraw the text
|
||||
// below the scrolled text.
|
||||
if (row - xtra_rows >= wp->w_grid.rows - 2) {
|
||||
if (row - xtra_rows >= wp->w_view_height - 2) {
|
||||
mod_bot = MAXLNUM;
|
||||
} else {
|
||||
win_scroll_lines(wp, row, xtra_rows);
|
||||
bot_start = wp->w_grid.rows + xtra_rows;
|
||||
bot_start = wp->w_view_height + xtra_rows;
|
||||
bot_scroll_start = bot_start;
|
||||
}
|
||||
} else if (xtra_rows > 0) {
|
||||
// May scroll text down. If there is not enough
|
||||
// remaining text of scrolling fails, must redraw the
|
||||
// rest.
|
||||
if (row + xtra_rows >= wp->w_grid.rows - 2) {
|
||||
if (row + xtra_rows >= wp->w_view_height - 2) {
|
||||
mod_bot = MAXLNUM;
|
||||
} else {
|
||||
win_scroll_lines(wp, row + old_rows, xtra_rows);
|
||||
@@ -2245,7 +2244,7 @@ static void win_update(win_T *wp)
|
||||
wp->w_lines[j] = wp->w_lines[i];
|
||||
// stop at a line that won't fit
|
||||
if (x + (int)wp->w_lines[j].wl_size
|
||||
> wp->w_grid.rows) {
|
||||
> wp->w_view_height) {
|
||||
wp->w_lines_valid = j + 1;
|
||||
break;
|
||||
}
|
||||
@@ -2257,7 +2256,7 @@ static void win_update(win_T *wp)
|
||||
// move entries in w_lines[] downwards
|
||||
j -= i;
|
||||
wp->w_lines_valid += (linenr_T)j;
|
||||
wp->w_lines_valid = MIN(wp->w_lines_valid, wp->w_grid.rows);
|
||||
wp->w_lines_valid = MIN(wp->w_lines_valid, wp->w_view_height);
|
||||
for (i = wp->w_lines_valid; i - j >= idx; i--) {
|
||||
wp->w_lines[i] = wp->w_lines[i - j];
|
||||
}
|
||||
@@ -2280,11 +2279,11 @@ static void win_update(win_T *wp)
|
||||
&& wp->w_lines[idx].wl_lnum == lnum
|
||||
&& lnum > wp->w_topline
|
||||
&& !(dy_flags & (kOptDyFlagLastline | kOptDyFlagTruncate))
|
||||
&& srow + wp->w_lines[idx].wl_size > wp->w_grid.rows
|
||||
&& srow + wp->w_lines[idx].wl_size > wp->w_view_height
|
||||
&& win_get_fill(wp, lnum) == 0) {
|
||||
// This line is not going to fit. Don't draw anything here,
|
||||
// will draw "@ " lines below.
|
||||
row = wp->w_grid.rows + 1;
|
||||
row = wp->w_view_height + 1;
|
||||
} else {
|
||||
prepare_search_hl(wp, &screen_search_hl, lnum);
|
||||
// Let the syntax stuff know we skipped a few lines.
|
||||
@@ -2297,7 +2296,7 @@ static void win_update(win_T *wp)
|
||||
|
||||
// Display one line
|
||||
spellvars_T zero_spv = { 0 };
|
||||
row = win_line(wp, lnum, srow, wp->w_grid.rows, 0, concealed,
|
||||
row = win_line(wp, lnum, srow, wp->w_view_height, 0, concealed,
|
||||
display_buf_line ? &spv : &zero_spv, foldinfo);
|
||||
|
||||
if (display_buf_line) {
|
||||
@@ -2320,7 +2319,7 @@ static void win_update(win_T *wp)
|
||||
}
|
||||
|
||||
// Adjust "wl_lastlnum" for concealed lines below the last line in the window.
|
||||
while (row == wp->w_grid.rows
|
||||
while (row == wp->w_view_height
|
||||
&& wp->w_lines[idx].wl_lastlnum < buf->b_ml.ml_line_count
|
||||
&& decor_conceal_line(wp, wp->w_lines[idx].wl_lastlnum, false)) {
|
||||
wp->w_lines[idx].wl_lastlnum++;
|
||||
@@ -2331,7 +2330,7 @@ static void win_update(win_T *wp)
|
||||
wp->w_lines[idx].wl_lnum = lnum;
|
||||
wp->w_lines[idx].wl_valid = true;
|
||||
|
||||
if (row > wp->w_grid.rows) { // past end of grid
|
||||
if (row > wp->w_view_height) { // past end of grid
|
||||
// we may need the size of that too long line later on
|
||||
if (dollar_vcol == -1) {
|
||||
wp->w_lines[idx].wl_size = (uint16_t)plines_win(wp, lnum, true);
|
||||
@@ -2355,12 +2354,12 @@ static void win_update(win_T *wp)
|
||||
&& !decor_conceal_line(wp, lnum - 1, true)) {
|
||||
foldinfo_T info = wp->w_p_cul && lnum == wp->w_cursor.lnum
|
||||
? cursorline_fi : fold_info(wp, lnum);
|
||||
win_line(wp, lnum, srow, wp->w_grid.rows, wp->w_lines[idx].wl_size, false, &spv, info);
|
||||
win_line(wp, lnum, srow, wp->w_view_height, wp->w_lines[idx].wl_size, false, &spv, info);
|
||||
}
|
||||
|
||||
// This line does not need to be drawn, advance to the next one.
|
||||
row += wp->w_lines[idx++].wl_size;
|
||||
if (row > wp->w_grid.rows) { // past end of screen
|
||||
if (row > wp->w_view_height) { // past end of screen
|
||||
break;
|
||||
}
|
||||
lnum = wp->w_lines[idx - 1].wl_lastlnum + 1;
|
||||
@@ -2414,31 +2413,31 @@ redr_statuscol:
|
||||
// Single line that does not fit!
|
||||
// Don't overwrite it, it can be edited.
|
||||
wp->w_botline = lnum + 1;
|
||||
} else if (win_get_fill(wp, lnum) >= wp->w_grid.rows - srow) {
|
||||
} else if (win_get_fill(wp, lnum) >= wp->w_view_height - srow) {
|
||||
// Window ends in filler lines.
|
||||
wp->w_botline = lnum;
|
||||
wp->w_filler_rows = wp->w_grid.rows - srow;
|
||||
wp->w_filler_rows = wp->w_view_height - srow;
|
||||
} else if (dy_flags & kOptDyFlagTruncate) { // 'display' has "truncate"
|
||||
// Last line isn't finished: Display "@@@" in the last screen line.
|
||||
grid_line_start(&wp->w_grid, wp->w_grid.rows - 1);
|
||||
grid_line_fill(0, MIN(wp->w_grid.cols, 3), wp->w_p_fcs_chars.lastline, at_attr);
|
||||
grid_line_fill(3, wp->w_grid.cols, schar_from_ascii(' '), at_attr);
|
||||
grid_line_start(&wp->w_grid, wp->w_view_height - 1);
|
||||
grid_line_fill(0, MIN(wp->w_view_width, 3), wp->w_p_fcs_chars.lastline, at_attr);
|
||||
grid_line_fill(3, wp->w_view_width, schar_from_ascii(' '), at_attr);
|
||||
grid_line_flush();
|
||||
set_empty_rows(wp, srow);
|
||||
wp->w_botline = lnum;
|
||||
} else if (dy_flags & kOptDyFlagLastline) { // 'display' has "lastline"
|
||||
// Last line isn't finished: Display "@@@" at the end.
|
||||
// If this would split a doublewidth char in two, we need to display "@@@@" instead
|
||||
grid_line_start(&wp->w_grid, wp->w_grid.rows - 1);
|
||||
int width = grid_line_getchar(MAX(wp->w_grid.cols - 3, 0), NULL) == NUL ? 4 : 3;
|
||||
grid_line_fill(MAX(wp->w_grid.cols - width, 0), wp->w_grid.cols,
|
||||
grid_line_start(&wp->w_grid, wp->w_view_height - 1);
|
||||
int width = grid_line_getchar(MAX(wp->w_view_width - 3, 0), NULL) == NUL ? 4 : 3;
|
||||
grid_line_fill(MAX(wp->w_view_width - width, 0), wp->w_view_width,
|
||||
wp->w_p_fcs_chars.lastline, at_attr);
|
||||
grid_line_flush();
|
||||
set_empty_rows(wp, srow);
|
||||
wp->w_botline = lnum;
|
||||
} else {
|
||||
win_draw_end(wp, wp->w_p_fcs_chars.lastline, true, srow,
|
||||
wp->w_grid.rows, HLF_AT);
|
||||
wp->w_view_height, HLF_AT);
|
||||
set_empty_rows(wp, srow);
|
||||
wp->w_botline = lnum;
|
||||
}
|
||||
@@ -2446,12 +2445,13 @@ redr_statuscol:
|
||||
if (eof) { // we hit the end of the file
|
||||
wp->w_botline = buf->b_ml.ml_line_count + 1;
|
||||
int j = win_get_fill(wp, wp->w_botline);
|
||||
if (j > 0 && !wp->w_botfill && row < wp->w_grid.rows) {
|
||||
if (j > 0 && !wp->w_botfill && row < wp->w_view_height) {
|
||||
// Display filler text below last line. win_line() will check
|
||||
// for ml_line_count+1 and only draw filler lines
|
||||
spellvars_T zero_spv = { 0 };
|
||||
foldinfo_T zero_foldinfo = { 0 };
|
||||
row = win_line(wp, wp->w_botline, row, wp->w_grid.rows, 0, false, &zero_spv, zero_foldinfo);
|
||||
row = win_line(wp, wp->w_botline, row, wp->w_view_height, 0, false, &zero_spv,
|
||||
zero_foldinfo);
|
||||
if (wp->w_redr_statuscol) {
|
||||
eof = false;
|
||||
goto redr_statuscol;
|
||||
@@ -2475,7 +2475,7 @@ redr_statuscol:
|
||||
}
|
||||
|
||||
win_draw_end(wp, wp->w_p_fcs_chars.eob, false, MAX(lastline, row),
|
||||
wp->w_grid.rows,
|
||||
wp->w_view_height,
|
||||
HLF_EOB);
|
||||
set_empty_rows(wp, row);
|
||||
}
|
||||
@@ -2551,16 +2551,20 @@ void win_scroll_lines(win_T *wp, int row, int line_count)
|
||||
}
|
||||
|
||||
// No lines are being moved, just draw over the entire area
|
||||
if (row + abs(line_count) >= wp->w_grid.rows) {
|
||||
if (row + abs(line_count) >= wp->w_view_height) {
|
||||
return;
|
||||
}
|
||||
|
||||
int col = 0;
|
||||
int row_off = 0;
|
||||
ScreenGrid *grid = grid_adjust(&wp->w_grid, &row_off, &col);
|
||||
|
||||
if (line_count < 0) {
|
||||
grid_del_lines(&wp->w_grid, row, -line_count,
|
||||
wp->w_grid.rows, 0, wp->w_grid.cols);
|
||||
grid_del_lines(grid, row + row_off, -line_count,
|
||||
wp->w_view_height + row_off, col, wp->w_view_width);
|
||||
} else {
|
||||
grid_ins_lines(&wp->w_grid, row, line_count,
|
||||
wp->w_grid.rows, 0, wp->w_grid.cols);
|
||||
grid_ins_lines(grid, row + row_off, line_count,
|
||||
wp->w_view_height + row_off, col, wp->w_view_width);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2590,15 +2594,15 @@ void win_draw_end(win_T *wp, schar_T c1, bool draw_margin, int startrow, int end
|
||||
|
||||
int attr = hl_combine_attr(win_bg_attr(wp), win_hl_attr(wp, (int)hl));
|
||||
|
||||
if (n < wp->w_grid.cols) {
|
||||
if (n < wp->w_view_width) {
|
||||
grid_line_put_schar(n, c1, 0); // base attr is inherited from clear
|
||||
n++;
|
||||
}
|
||||
|
||||
grid_line_clear_end(n, wp->w_grid.cols, attr);
|
||||
grid_line_clear_end(n, wp->w_view_width, attr);
|
||||
|
||||
if (wp->w_p_rl) {
|
||||
grid_line_mirror();
|
||||
grid_line_mirror(wp->w_view_width);
|
||||
}
|
||||
grid_line_flush();
|
||||
}
|
||||
@@ -2610,7 +2614,7 @@ int compute_foldcolumn(win_T *wp, int col)
|
||||
{
|
||||
int fdc = win_fdccol_count(wp);
|
||||
int wmw = wp == curwin && p_wmw == 0 ? 1 : (int)p_wmw;
|
||||
int n = wp->w_grid.cols - (col + wmw);
|
||||
int n = wp->w_view_width - (col + wmw);
|
||||
|
||||
return MIN(fdc, n);
|
||||
}
|
||||
@@ -2624,7 +2628,7 @@ int number_width(win_T *wp)
|
||||
|
||||
if (wp->w_p_rnu && !wp->w_p_nu) {
|
||||
// cursor line shows "0"
|
||||
lnum = wp->w_height_inner;
|
||||
lnum = wp->w_view_height;
|
||||
} else {
|
||||
// cursor line shows absolute line number
|
||||
lnum = wp->w_buffer->b_ml.ml_line_count;
|
||||
|
@@ -479,7 +479,7 @@ static int insert_check(VimState *state)
|
||||
curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array,
|
||||
false)
|
||||
&& curwin->w_wrow == curwin->w_height_inner - 1 - get_scrolloff_value(curwin)
|
||||
&& curwin->w_wrow == curwin->w_view_height - 1 - get_scrolloff_value(curwin)
|
||||
&& (curwin->w_cursor.lnum != curwin->w_topline
|
||||
|| curwin->w_topfill > 0)) {
|
||||
if (curwin->w_topfill > 0) {
|
||||
@@ -1478,7 +1478,7 @@ void edit_putchar(int c, bool highlight)
|
||||
pc_status = PC_STATUS_UNSET;
|
||||
grid_line_start(&curwin->w_grid, pc_row);
|
||||
if (curwin->w_p_rl) {
|
||||
pc_col = curwin->w_grid.cols - 1 - curwin->w_wcol;
|
||||
pc_col = curwin->w_view_width - 1 - curwin->w_wcol;
|
||||
|
||||
if (grid_line_getchar(pc_col, NULL) == NUL) {
|
||||
grid_line_put_schar(pc_col - 1, schar_from_ascii(' '), attr);
|
||||
@@ -1603,7 +1603,7 @@ void display_dollar(colnr_T col_arg)
|
||||
char *p = get_cursor_line_ptr();
|
||||
curwin->w_cursor.col -= utf_head_off(p, p + col);
|
||||
curs_columns(curwin, false); // Recompute w_wrow and w_wcol
|
||||
if (curwin->w_wcol < curwin->w_grid.cols) {
|
||||
if (curwin->w_wcol < curwin->w_view_width) {
|
||||
edit_putchar('$', false);
|
||||
dollar_vcol = curwin->w_virtcol;
|
||||
}
|
||||
|
@@ -4019,8 +4019,8 @@ void f_jobstart(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
overlapped = false;
|
||||
detach = false;
|
||||
stdin_mode = kChannelStdinPipe;
|
||||
width = (uint16_t)MAX(0, curwin->w_width_inner - win_col_off(curwin));
|
||||
height = (uint16_t)curwin->w_height_inner;
|
||||
width = (uint16_t)MAX(0, curwin->w_view_width - win_col_off(curwin));
|
||||
height = (uint16_t)curwin->w_view_height;
|
||||
}
|
||||
|
||||
if (pty) {
|
||||
|
@@ -321,13 +321,13 @@ static dict_T *get_win_info(win_T *wp, int16_t tpnr, int16_t winnr)
|
||||
tv_dict_add_nr(dict, S_LEN("tabnr"), tpnr);
|
||||
tv_dict_add_nr(dict, S_LEN("winnr"), winnr);
|
||||
tv_dict_add_nr(dict, S_LEN("winid"), wp->handle);
|
||||
tv_dict_add_nr(dict, S_LEN("height"), wp->w_height_inner);
|
||||
tv_dict_add_nr(dict, S_LEN("height"), wp->w_view_height);
|
||||
tv_dict_add_nr(dict, S_LEN("winrow"), wp->w_winrow + 1);
|
||||
tv_dict_add_nr(dict, S_LEN("topline"), wp->w_topline);
|
||||
tv_dict_add_nr(dict, S_LEN("botline"), wp->w_botline - 1);
|
||||
tv_dict_add_nr(dict, S_LEN("leftcol"), wp->w_leftcol);
|
||||
tv_dict_add_nr(dict, S_LEN("winbar"), wp->w_winbar_height);
|
||||
tv_dict_add_nr(dict, S_LEN("width"), wp->w_width_inner);
|
||||
tv_dict_add_nr(dict, S_LEN("width"), wp->w_view_width);
|
||||
tv_dict_add_nr(dict, S_LEN("bufnr"), wp->w_buffer->b_fnum);
|
||||
tv_dict_add_nr(dict, S_LEN("wincol"), wp->w_wincol + 1);
|
||||
tv_dict_add_nr(dict, S_LEN("textoff"), win_col_off(wp));
|
||||
@@ -786,7 +786,7 @@ void f_winheight(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
if (wp == NULL) {
|
||||
rettv->vval.v_number = -1;
|
||||
} else {
|
||||
rettv->vval.v_number = wp->w_height_inner;
|
||||
rettv->vval.v_number = wp->w_view_height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -923,7 +923,7 @@ void f_winwidth(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
if (wp == NULL) {
|
||||
rettv->vval.v_number = -1;
|
||||
} else {
|
||||
rettv->vval.v_number = wp->w_width_inner;
|
||||
rettv->vval.v_number = wp->w_view_width;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -263,7 +263,7 @@ void ex_align(exarg_T *eap)
|
||||
width = (int)curbuf->b_p_tw;
|
||||
}
|
||||
if (width == 0 && curbuf->b_p_wm > 0) {
|
||||
width = curwin->w_width_inner - (int)curbuf->b_p_wm;
|
||||
width = curwin->w_view_width - (int)curbuf->b_p_wm;
|
||||
}
|
||||
if (width <= 0) {
|
||||
width = 80;
|
||||
@@ -2949,7 +2949,7 @@ void ex_z(exarg_T *eap)
|
||||
} else if (ONE_WINDOW) {
|
||||
bigness = curwin->w_p_scr * 2;
|
||||
} else {
|
||||
bigness = curwin->w_height_inner - 3;
|
||||
bigness = curwin->w_view_height - 3;
|
||||
}
|
||||
bigness = MAX(bigness, 1);
|
||||
|
||||
|
@@ -468,7 +468,7 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
|
||||
if (do_cursor) {
|
||||
// Restore the cursor line in the file and relatively in the
|
||||
// window. Don't use "G", it changes the jumplist.
|
||||
if (wp->w_height_inner <= 0) {
|
||||
if (wp->w_view_height <= 0) {
|
||||
if (fprintf(fd, "let s:l = %" PRIdLINENR "\n", wp->w_cursor.lnum) < 0) {
|
||||
return FAIL;
|
||||
}
|
||||
@@ -477,8 +477,8 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
|
||||
" * winheight(0) + %d) / %d)\n",
|
||||
wp->w_cursor.lnum,
|
||||
wp->w_cursor.lnum - wp->w_topline,
|
||||
(wp->w_height_inner / 2),
|
||||
wp->w_height_inner) < 0) {
|
||||
(wp->w_view_height / 2),
|
||||
wp->w_view_height) < 0) {
|
||||
return FAIL;
|
||||
}
|
||||
if (fprintf(fd,
|
||||
|
@@ -2749,8 +2749,8 @@ static int vgetorpeek(bool advance)
|
||||
}
|
||||
|
||||
curwin->w_wrow = curwin->w_cline_row
|
||||
+ curwin->w_wcol / curwin->w_width_inner;
|
||||
curwin->w_wcol %= curwin->w_width_inner;
|
||||
+ curwin->w_wcol / curwin->w_view_width;
|
||||
curwin->w_wcol %= curwin->w_view_width;
|
||||
curwin->w_wcol += win_col_off(curwin);
|
||||
col = 0; // no correction needed
|
||||
} else {
|
||||
@@ -2759,7 +2759,7 @@ static int vgetorpeek(bool advance)
|
||||
}
|
||||
} else if (curwin->w_p_wrap && curwin->w_wrow) {
|
||||
curwin->w_wrow--;
|
||||
curwin->w_wcol = curwin->w_width_inner - 1;
|
||||
curwin->w_wcol = curwin->w_view_width - 1;
|
||||
col = curwin->w_cursor.col - 1;
|
||||
}
|
||||
if (col > 0 && curwin->w_wcol > 0) {
|
||||
|
@@ -64,13 +64,11 @@ static Set(glyph) glyph_cache = SET_INIT;
|
||||
///
|
||||
/// If the default_grid is used, adjust window relative positions to global
|
||||
/// screen positions.
|
||||
void grid_adjust(ScreenGrid **grid, int *row_off, int *col_off)
|
||||
ScreenGrid *grid_adjust(GridView *grid, int *row_off, int *col_off)
|
||||
{
|
||||
if ((*grid)->target) {
|
||||
*row_off += (*grid)->row_offset;
|
||||
*col_off += (*grid)->col_offset;
|
||||
*grid = (*grid)->target;
|
||||
}
|
||||
*row_off += grid->row_offset;
|
||||
*col_off += grid->col_offset;
|
||||
return grid->target;
|
||||
}
|
||||
|
||||
schar_T schar_from_str(const char *str)
|
||||
@@ -337,8 +335,6 @@ static bool grid_invalid_row(ScreenGrid *grid, int row)
|
||||
/// @param[out] attrp set to the character's attribute (optional)
|
||||
schar_T grid_getchar(ScreenGrid *grid, int row, int col, int *attrp)
|
||||
{
|
||||
grid_adjust(&grid, &row, &col);
|
||||
|
||||
// safety check
|
||||
if (grid->chars == NULL || row >= grid->rows || col >= grid->cols) {
|
||||
return NUL;
|
||||
@@ -365,11 +361,16 @@ static int grid_line_flags = 0;
|
||||
///
|
||||
/// Must be matched with a grid_line_flush call before moving to
|
||||
/// another line.
|
||||
void grid_line_start(ScreenGrid *grid, int row)
|
||||
void grid_line_start(GridView *view, int row)
|
||||
{
|
||||
int col = 0;
|
||||
ScreenGrid *grid = grid_adjust(view, &row, &col);
|
||||
screengrid_line_start(grid, row, col);
|
||||
}
|
||||
|
||||
void screengrid_line_start(ScreenGrid *grid, int row, int col)
|
||||
{
|
||||
grid_line_maxcol = grid->cols;
|
||||
grid_adjust(&grid, &row, &col);
|
||||
assert(grid_line_grid == NULL);
|
||||
grid_line_row = row;
|
||||
grid_line_grid = grid;
|
||||
@@ -534,23 +535,23 @@ void grid_line_cursor_goto(int col)
|
||||
ui_grid_cursor_goto(grid_line_grid->handle, grid_line_row, col);
|
||||
}
|
||||
|
||||
void grid_line_mirror(void)
|
||||
void grid_line_mirror(int width)
|
||||
{
|
||||
grid_line_clear_to = MAX(grid_line_last, grid_line_clear_to);
|
||||
if (grid_line_first >= grid_line_clear_to) {
|
||||
return;
|
||||
}
|
||||
linebuf_mirror(&grid_line_first, &grid_line_last, &grid_line_clear_to, grid_line_maxcol);
|
||||
linebuf_mirror(&grid_line_first, &grid_line_last, &grid_line_clear_to, width);
|
||||
grid_line_flags |= SLF_RIGHTLEFT;
|
||||
}
|
||||
|
||||
void linebuf_mirror(int *firstp, int *lastp, int *clearp, int maxcol)
|
||||
void linebuf_mirror(int *firstp, int *lastp, int *clearp, int width)
|
||||
{
|
||||
int first = *firstp;
|
||||
int last = *lastp;
|
||||
|
||||
size_t n = (size_t)(last - first);
|
||||
int mirror = maxcol - 1; // Mirrors are more fun than television.
|
||||
int mirror = width - 1; // Mirrors are more fun than television.
|
||||
schar_T *scratch_char = (schar_T *)linebuf_scratch;
|
||||
memcpy(scratch_char + first, linebuf_char + first, n * sizeof(schar_T));
|
||||
for (int col = first; col < last; col++) {
|
||||
@@ -577,9 +578,9 @@ void linebuf_mirror(int *firstp, int *lastp, int *clearp, int maxcol)
|
||||
linebuf_vcol[mirror - col] = scratch_vcol[col];
|
||||
}
|
||||
|
||||
*firstp = maxcol - *clearp;
|
||||
*clearp = maxcol - first;
|
||||
*lastp = maxcol - last;
|
||||
*firstp = width - *clearp;
|
||||
*clearp = width - first;
|
||||
*lastp = width - last;
|
||||
}
|
||||
|
||||
/// End a group of grid_line_puts calls and send the screen buffer to the UI layer.
|
||||
@@ -613,7 +614,7 @@ void grid_line_flush_if_valid_row(void)
|
||||
grid_line_flush();
|
||||
}
|
||||
|
||||
void grid_clear(ScreenGrid *grid, int start_row, int end_row, int start_col, int end_col, int attr)
|
||||
void grid_clear(GridView *grid, int start_row, int end_row, int start_col, int end_col, int attr)
|
||||
{
|
||||
for (int row = start_row; row < end_row; row++) {
|
||||
grid_line_start(grid, row);
|
||||
@@ -924,21 +925,20 @@ void grid_free_all_mem(void)
|
||||
/// resized grid.
|
||||
void win_grid_alloc(win_T *wp)
|
||||
{
|
||||
ScreenGrid *grid = &wp->w_grid;
|
||||
GridView *grid = &wp->w_grid;
|
||||
ScreenGrid *grid_allocated = &wp->w_grid_alloc;
|
||||
|
||||
int rows = wp->w_height_inner;
|
||||
int cols = wp->w_width_inner;
|
||||
int total_rows = wp->w_height_outer;
|
||||
int total_cols = wp->w_width_outer;
|
||||
|
||||
bool want_allocation = ui_has(kUIMultigrid) || wp->w_floating;
|
||||
bool has_allocation = (grid_allocated->chars != NULL);
|
||||
|
||||
if (grid->rows != rows) {
|
||||
if (wp->w_view_height > wp->w_lines_size) {
|
||||
wp->w_lines_valid = 0;
|
||||
xfree(wp->w_lines);
|
||||
wp->w_lines = xcalloc((size_t)rows + 1, sizeof(wline_T));
|
||||
wp->w_lines = xcalloc((size_t)wp->w_view_height + 1, sizeof(wline_T));
|
||||
wp->w_lines_size = wp->w_view_height;
|
||||
}
|
||||
|
||||
bool was_resized = false;
|
||||
@@ -963,9 +963,6 @@ void win_grid_alloc(win_T *wp)
|
||||
grid_allocated->valid = true;
|
||||
}
|
||||
|
||||
grid->rows = rows;
|
||||
grid->cols = cols;
|
||||
|
||||
if (want_allocation) {
|
||||
grid->target = grid_allocated;
|
||||
grid->row_offset = wp->w_winrow_off;
|
||||
@@ -1009,11 +1006,6 @@ void grid_ins_lines(ScreenGrid *grid, int row, int line_count, int end, int col,
|
||||
int j;
|
||||
unsigned temp;
|
||||
|
||||
int row_off = 0;
|
||||
grid_adjust(&grid, &row_off, &col);
|
||||
row += row_off;
|
||||
end += row_off;
|
||||
|
||||
if (line_count <= 0) {
|
||||
return;
|
||||
}
|
||||
@@ -1054,11 +1046,6 @@ void grid_del_lines(ScreenGrid *grid, int row, int line_count, int end, int col,
|
||||
int j;
|
||||
unsigned temp;
|
||||
|
||||
int row_off = 0;
|
||||
grid_adjust(&grid, &row_off, &col);
|
||||
row += row_off;
|
||||
end += row_off;
|
||||
|
||||
if (line_count <= 0) {
|
||||
return;
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@
|
||||
/// Note: before the screen is initialized and when out of memory these can be
|
||||
/// NULL.
|
||||
EXTERN ScreenGrid default_grid INIT( = SCREEN_GRID_INIT);
|
||||
EXTERN GridView default_gridview INIT( = { .target = &default_grid });
|
||||
|
||||
#define DEFAULT_GRID_HANDLE 1 // handle for the default_grid
|
||||
|
||||
|
@@ -65,14 +65,6 @@ struct ScreenGrid {
|
||||
// external UI.
|
||||
bool throttled;
|
||||
|
||||
// TODO(bfredl): maybe physical grids and "views" (i e drawing
|
||||
// specifications) should be two separate types?
|
||||
// offsets for the grid relative to another grid. Used for grids
|
||||
// that are views into another, actually allocated grid 'target'
|
||||
int row_offset;
|
||||
int col_offset;
|
||||
ScreenGrid *target;
|
||||
|
||||
// whether the compositor should blend the grid with the background grid
|
||||
bool blending;
|
||||
|
||||
@@ -103,13 +95,21 @@ struct ScreenGrid {
|
||||
// moving around grids etc.
|
||||
bool comp_disabled;
|
||||
|
||||
bool composition_updated;
|
||||
// need to resend win_float_pos or similar due to comp_index change
|
||||
bool pending_comp_index_update;
|
||||
};
|
||||
|
||||
#define SCREEN_GRID_INIT { 0, NULL, NULL, NULL, NULL, NULL, 0, 0, false, \
|
||||
false, 0, 0, NULL, false, true, 0, \
|
||||
false, false, true, 0, \
|
||||
0, 0, 0, 0, 0, false, true }
|
||||
|
||||
/// Represents the position of a viewport within a ScreenGrid
|
||||
typedef struct {
|
||||
ScreenGrid *target;
|
||||
int row_offset;
|
||||
int col_offset;
|
||||
} GridView;
|
||||
|
||||
typedef struct {
|
||||
int args[3];
|
||||
int icell;
|
||||
|
@@ -851,7 +851,7 @@ int get_breakindent_win(win_T *wp, char *line)
|
||||
static char *prev_flp = NULL; // cached formatlistpat value
|
||||
int bri = 0;
|
||||
// window width minus window margin space, i.e. what rests for text
|
||||
const int eff_wwidth = wp->w_width_inner - win_col_off(wp) + win_col_off2(wp);
|
||||
const int eff_wwidth = wp->w_view_width - win_col_off(wp) + win_col_off2(wp);
|
||||
|
||||
// In list mode, if 'listchars' "tab" isn't set, a TAB is displayed as ^I.
|
||||
const bool no_ts = wp->w_p_list && wp->w_p_lcs_chars.tab1 == NUL;
|
||||
|
@@ -173,7 +173,7 @@ static void ui_ext_msg_set_pos(int row, bool scrolled)
|
||||
ui_call_msg_set_pos(msg_grid.handle, row, scrolled,
|
||||
(String){ .data = buf, .size = size }, msg_grid.zindex,
|
||||
(int)msg_grid.comp_index);
|
||||
msg_grid.composition_updated = false;
|
||||
msg_grid.pending_comp_index_update = false;
|
||||
}
|
||||
|
||||
void msg_grid_set_pos(int row, bool scrolled)
|
||||
@@ -235,7 +235,6 @@ void msg_grid_validate(void)
|
||||
grid_clear(&msg_grid_adj, Rows - diff, Rows, 0, Columns, HL_ATTR(HLF_MSG));
|
||||
}
|
||||
}
|
||||
msg_grid_adj.cols = Columns;
|
||||
|
||||
if (msg_grid.chars && !msg_scrolled && cmdline_row < msg_grid_pos) {
|
||||
// TODO(bfredl): this should already be the case, but fails in some
|
||||
@@ -2384,18 +2383,17 @@ static void msg_puts_display(const char *str, int maxlen, int hl_id, int recurse
|
||||
void msg_line_flush(void)
|
||||
{
|
||||
if (cmdmsg_rl) {
|
||||
grid_line_mirror();
|
||||
grid_line_mirror(msg_grid.cols);
|
||||
}
|
||||
grid_line_flush_if_valid_row();
|
||||
}
|
||||
|
||||
void msg_cursor_goto(int row, int col)
|
||||
{
|
||||
ScreenGrid *grid = &msg_grid_adj;
|
||||
if (cmdmsg_rl) {
|
||||
col = Columns - 1 - col;
|
||||
}
|
||||
grid_adjust(&grid, &row, &col);
|
||||
ScreenGrid *grid = grid_adjust(&msg_grid_adj, &row, &col);
|
||||
ui_grid_cursor_goto(grid->handle, row, col);
|
||||
}
|
||||
|
||||
@@ -2533,7 +2531,7 @@ void msg_ui_refresh(void)
|
||||
|
||||
void msg_ui_flush(void)
|
||||
{
|
||||
if (ui_has(kUIMultigrid) && msg_grid.chars && msg_grid.composition_updated) {
|
||||
if (ui_has(kUIMultigrid) && msg_grid.chars && msg_grid.pending_comp_index_update) {
|
||||
ui_ext_msg_set_pos(msg_grid_pos, msg_scrolled);
|
||||
}
|
||||
}
|
||||
@@ -2978,7 +2976,7 @@ static bool do_more_prompt(int typed_char)
|
||||
}
|
||||
|
||||
if (toscroll == -1 && !to_redraw) {
|
||||
grid_ins_lines(&msg_grid_adj, 0, 1, Rows, 0, Columns);
|
||||
grid_ins_lines(&msg_grid, 0, 1, Rows, 0, Columns);
|
||||
grid_clear(&msg_grid_adj, 0, 1, 0, Columns, HL_ATTR(HLF_MSG));
|
||||
// display line at top
|
||||
disp_sb_line(0, mp);
|
||||
|
@@ -34,8 +34,8 @@ EXTERN bool msg_ext_need_clear INIT( = false);
|
||||
// Set to true to force grouping a set of message chunks into a single `cmdline_show` event.
|
||||
EXTERN bool msg_ext_skip_flush INIT( = false);
|
||||
|
||||
/// allocated grid for messages. Used when display+=msgsep is set, or
|
||||
/// ext_multigrid is active. See also the description at msg_scroll_flush()
|
||||
/// allocated grid for messages. Used unless ext_messages is active.
|
||||
/// See also the description at msg_scroll_flush()
|
||||
EXTERN ScreenGrid msg_grid INIT( = SCREEN_GRID_INIT);
|
||||
EXTERN int msg_grid_pos INIT( = 0);
|
||||
|
||||
@@ -45,7 +45,7 @@ EXTERN int msg_grid_pos INIT( = 0);
|
||||
/// for legacy (display-=msgsep) message scroll behavior.
|
||||
/// TODO(bfredl): refactor "internal" message logic, msg_row etc
|
||||
/// to use the correct positions already.
|
||||
EXTERN ScreenGrid msg_grid_adj INIT( = SCREEN_GRID_INIT);
|
||||
EXTERN GridView msg_grid_adj INIT( = { 0 });
|
||||
|
||||
/// value of msg_scrolled at latest msg_scroll_flush.
|
||||
EXTERN int msg_scrolled_at_flush INIT( = 0);
|
||||
|
@@ -249,19 +249,19 @@ static int get_fpos_of_mouse(pos_T *mpos)
|
||||
|
||||
if (!below_buffer && *wp->w_p_stc != NUL
|
||||
&& (wp->w_p_rl
|
||||
? wincol >= wp->w_width_inner - win_col_off(wp)
|
||||
? wincol >= wp->w_view_width - win_col_off(wp)
|
||||
: wincol < win_col_off(wp))) {
|
||||
return MOUSE_STATUSCOL;
|
||||
}
|
||||
|
||||
// winpos and height may change in win_enter()!
|
||||
if (winrow >= wp->w_height_inner + wp->w_status_height) { // Below window
|
||||
if (winrow >= wp->w_view_height + wp->w_status_height) { // Below window
|
||||
if (mouse_grid <= 1 && mouse_row < Rows - p_ch
|
||||
&& mouse_row >= Rows - p_ch - global_stl_height()) { // In global status line
|
||||
return IN_STATUS_LINE;
|
||||
}
|
||||
return IN_UNKNOWN;
|
||||
} else if (winrow >= wp->w_height_inner) { // In window status line
|
||||
} else if (winrow >= wp->w_view_height) { // In window status line
|
||||
return IN_STATUS_LINE;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ static int get_fpos_of_mouse(pos_T *mpos)
|
||||
return MOUSE_WINBAR;
|
||||
}
|
||||
|
||||
if (wincol >= wp->w_width_inner) { // In vertical separator line
|
||||
if (wincol >= wp->w_view_width) { // In vertical separator line
|
||||
return IN_SEP_LINE;
|
||||
}
|
||||
|
||||
@@ -682,7 +682,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, int count, bool fixindent)
|
||||
}
|
||||
|
||||
if (in_statuscol && wp->w_p_rl) {
|
||||
click_col = wp->w_width_inner - click_col - 1;
|
||||
click_col = wp->w_view_width - click_col - 1;
|
||||
}
|
||||
|
||||
if ((in_statuscol && click_col >= (int)wp->w_statuscol_click_defs_size)
|
||||
@@ -1053,7 +1053,7 @@ void do_mousescroll(cmdarg_T *cap)
|
||||
}
|
||||
} else {
|
||||
// Horizontal scrolling
|
||||
int step = shift_or_ctrl ? curwin->w_width_inner : (int)p_mousescroll_hor;
|
||||
int step = shift_or_ctrl ? curwin->w_view_width : (int)p_mousescroll_hor;
|
||||
colnr_T leftcol = curwin->w_leftcol + (cap->arg == MSCR_RIGHT ? -step : +step);
|
||||
leftcol = MAX(leftcol, 0);
|
||||
do_mousescroll_horiz(leftcol);
|
||||
@@ -1277,7 +1277,7 @@ retnomove:
|
||||
on_statuscol = !below_window && !on_status_line && !on_sep_line && !on_winbar
|
||||
&& *wp->w_p_stc != NUL
|
||||
&& (wp->w_p_rl
|
||||
? col >= wp->w_width_inner - win_col_off(wp)
|
||||
? col >= wp->w_view_width - win_col_off(wp)
|
||||
: col < win_col_off(wp));
|
||||
|
||||
// The rightmost character of the status line might be a vertical
|
||||
@@ -1346,7 +1346,7 @@ retnomove:
|
||||
|| (!status_line_offset
|
||||
&& !sep_line_offset
|
||||
&& (wp->w_p_rl
|
||||
? col < wp->w_width_inner - fdc
|
||||
? col < wp->w_view_width - fdc
|
||||
: col >= fdc + (wp != cmdwin_win ? 0 : 1))
|
||||
&& (flags & MOUSE_MAY_STOP_VIS)))) {
|
||||
end_visual_mode();
|
||||
@@ -1455,7 +1455,7 @@ retnomove:
|
||||
~(VALID_WROW|VALID_CROW|VALID_BOTLINE|VALID_BOTLINE_AP);
|
||||
redraw_later(curwin, UPD_VALID);
|
||||
row = 0;
|
||||
} else if (row >= curwin->w_height_inner) {
|
||||
} else if (row >= curwin->w_view_height) {
|
||||
count = 0;
|
||||
for (first = true; curwin->w_topline < curbuf->b_ml.ml_line_count;) {
|
||||
if (curwin->w_topfill > 0) {
|
||||
@@ -1464,7 +1464,7 @@ retnomove:
|
||||
count += plines_win(curwin, curwin->w_topline, true);
|
||||
}
|
||||
|
||||
if (!first && count > row - curwin->w_height_inner + 1) {
|
||||
if (!first && count > row - curwin->w_view_height + 1) {
|
||||
break;
|
||||
}
|
||||
first = false;
|
||||
@@ -1484,7 +1484,7 @@ retnomove:
|
||||
redraw_later(curwin, UPD_VALID);
|
||||
curwin->w_valid &=
|
||||
~(VALID_WROW|VALID_CROW|VALID_BOTLINE|VALID_BOTLINE_AP);
|
||||
row = curwin->w_height_inner - 1;
|
||||
row = curwin->w_view_height - 1;
|
||||
} else if (row == 0) {
|
||||
// When dragging the mouse, while the text has been scrolled up as
|
||||
// far as it goes, moving the mouse in the top line should scroll
|
||||
@@ -1615,7 +1615,7 @@ bool mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump)
|
||||
int count;
|
||||
|
||||
if (win->w_p_rl) {
|
||||
col = win->w_width_inner - 1 - col;
|
||||
col = win->w_view_width - 1 - col;
|
||||
}
|
||||
|
||||
linenr_T lnum = win->w_topline;
|
||||
@@ -1631,7 +1631,7 @@ bool mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump)
|
||||
}
|
||||
|
||||
if (win->w_skipcol > 0 && lnum == win->w_topline) {
|
||||
int width1 = win->w_width_inner - win_col_off(win);
|
||||
int width1 = win->w_view_width - win_col_off(win);
|
||||
|
||||
if (width1 > 0) {
|
||||
int skip_lines = 0;
|
||||
@@ -1673,7 +1673,7 @@ bool mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump)
|
||||
// Compute the column without wrapping.
|
||||
int off = win_col_off(win) - win_col_off2(win);
|
||||
col = MAX(col, off);
|
||||
col += row * (win->w_width_inner - off);
|
||||
col += row * (win->w_view_width - off);
|
||||
|
||||
// Add skip column for the topline.
|
||||
if (lnum == win->w_topline) {
|
||||
@@ -1750,8 +1750,8 @@ static win_T *mouse_find_grid_win(int *gridp, int *rowp, int *colp)
|
||||
win_T *wp = get_win_by_grid_handle(*gridp);
|
||||
if (wp && wp->w_grid_alloc.chars
|
||||
&& !(wp->w_floating && !wp->w_config.mouse)) {
|
||||
*rowp = MIN(*rowp - wp->w_grid.row_offset, wp->w_grid.rows - 1);
|
||||
*colp = MIN(*colp - wp->w_grid.col_offset, wp->w_grid.cols - 1);
|
||||
*rowp = MIN(*rowp - wp->w_grid.row_offset, wp->w_view_height - 1);
|
||||
*colp = MIN(*colp - wp->w_grid.col_offset, wp->w_view_width - 1);
|
||||
return wp;
|
||||
}
|
||||
} else if (*gridp == 0) {
|
||||
@@ -1884,10 +1884,9 @@ static void mouse_check_grid(colnr_T *vcolp, int *flagsp)
|
||||
|| curwin->w_redr_type != 0) {
|
||||
return;
|
||||
}
|
||||
ScreenGrid *gp = &curwin->w_grid;
|
||||
int start_row = 0;
|
||||
int start_col = 0;
|
||||
grid_adjust(&gp, &start_row, &start_col);
|
||||
ScreenGrid *gp = grid_adjust(&curwin->w_grid, &start_row, &start_col);
|
||||
if (gp->handle != click_grid || gp->chars == NULL) {
|
||||
return;
|
||||
}
|
||||
|
198
src/nvim/move.c
198
src/nvim/move.c
@@ -67,7 +67,7 @@ int adjust_plines_for_skipcol(win_T *wp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int width = wp->w_width_inner - win_col_off(wp);
|
||||
int width = wp->w_view_width - win_col_off(wp);
|
||||
int w2 = width + win_col_off2(wp);
|
||||
if (wp->w_skipcol >= width && w2 > 0) {
|
||||
return (wp->w_skipcol - width) / w2 + 1;
|
||||
@@ -86,8 +86,8 @@ static int plines_correct_topline(win_T *wp, linenr_T lnum, linenr_T *nextp, boo
|
||||
if (lnum == wp->w_topline) {
|
||||
n -= adjust_plines_for_skipcol(wp);
|
||||
}
|
||||
if (limit_winheight && n > wp->w_height_inner) {
|
||||
return wp->w_height_inner;
|
||||
if (limit_winheight && n > wp->w_view_height) {
|
||||
return wp->w_view_height;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ static void comp_botline(win_T *wp)
|
||||
redraw_for_cursorline(wp);
|
||||
wp->w_valid |= (VALID_CROW|VALID_CHEIGHT);
|
||||
}
|
||||
if (done + n > wp->w_height_inner) {
|
||||
if (done + n > wp->w_view_height) {
|
||||
break;
|
||||
}
|
||||
done += n;
|
||||
@@ -210,7 +210,7 @@ int sms_marker_overlap(win_T *wp, int extra2)
|
||||
/// physical lines we want to scroll down.
|
||||
static int skipcol_from_plines(win_T *wp, int plines_off)
|
||||
{
|
||||
int width1 = wp->w_width_inner - win_col_off(wp);
|
||||
int width1 = wp->w_view_width - win_col_off(wp);
|
||||
|
||||
int skipcol = 0;
|
||||
if (plines_off > 0) {
|
||||
@@ -251,7 +251,7 @@ void update_topline(win_T *wp)
|
||||
|
||||
// If there is no valid screen and when the window height is zero just use
|
||||
// the cursor line.
|
||||
if (!default_grid.chars || wp->w_height_inner == 0) {
|
||||
if (!default_grid.chars || wp->w_view_height == 0) {
|
||||
wp->w_topline = wp->w_cursor.lnum;
|
||||
wp->w_botline = wp->w_topline;
|
||||
wp->w_viewport_invalid = true;
|
||||
@@ -313,7 +313,7 @@ void update_topline(win_T *wp)
|
||||
}
|
||||
|
||||
if (check_topline) {
|
||||
int halfheight = wp->w_height_inner / 2 - 1;
|
||||
int halfheight = wp->w_view_height / 2 - 1;
|
||||
if (halfheight < 2) {
|
||||
halfheight = 2;
|
||||
}
|
||||
@@ -405,7 +405,7 @@ void update_topline(win_T *wp)
|
||||
for (linenr_T lnum = wp->w_cursor.lnum; lnum >= wp->w_botline - *so_ptr; lnum--) {
|
||||
line_count += !decor_conceal_line(wp, lnum - 1, false);
|
||||
// stop at end of file or when we know we are far off
|
||||
if (lnum <= 0 || line_count > wp->w_height_inner + 1) {
|
||||
if (lnum <= 0 || line_count > wp->w_view_height + 1) {
|
||||
break;
|
||||
}
|
||||
hasFolding(wp, lnum, &lnum, NULL);
|
||||
@@ -413,7 +413,7 @@ void update_topline(win_T *wp)
|
||||
} else {
|
||||
line_count = wp->w_cursor.lnum - wp->w_botline + 1 + (int)(*so_ptr);
|
||||
}
|
||||
if (line_count <= wp->w_height_inner + 1) {
|
||||
if (line_count <= wp->w_view_height + 1) {
|
||||
scroll_cursor_bot(wp, scrolljump_value(wp), false);
|
||||
} else {
|
||||
scroll_cursor_halfway(wp, false, false);
|
||||
@@ -452,7 +452,7 @@ void update_topline(win_T *wp)
|
||||
/// When 'scrolljump' is negative use it as a percentage of the window height.
|
||||
static int scrolljump_value(win_T *wp)
|
||||
{
|
||||
int result = p_sj >= 0 ? (int)p_sj : (wp->w_height_inner * (int)(-p_sj)) / 100;
|
||||
int result = p_sj >= 0 ? (int)p_sj : (wp->w_view_height * (int)(-p_sj)) / 100;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -748,12 +748,12 @@ void validate_cursor_col(win_T *wp)
|
||||
colnr_T col = wp->w_virtcol;
|
||||
colnr_T off = win_col_off(wp);
|
||||
col += off;
|
||||
int width = wp->w_width_inner - off + win_col_off2(wp);
|
||||
int width = wp->w_view_width - off + win_col_off2(wp);
|
||||
|
||||
// long line wrapping, adjust wp->w_wrow
|
||||
if (wp->w_p_wrap && col >= (colnr_T)wp->w_width_inner && width > 0) {
|
||||
if (wp->w_p_wrap && col >= (colnr_T)wp->w_view_width && width > 0) {
|
||||
// use same formula as what is used in curs_columns()
|
||||
col -= ((col - wp->w_width_inner) / width + 1) * width;
|
||||
col -= ((col - wp->w_view_width) / width + 1) * width;
|
||||
}
|
||||
if (col > (int)wp->w_leftcol) {
|
||||
col -= wp->w_leftcol;
|
||||
@@ -825,19 +825,19 @@ void curs_columns(win_T *wp, int may_scroll)
|
||||
wp->w_wrow = wp->w_cline_row;
|
||||
|
||||
int n;
|
||||
int width1 = wp->w_width_inner - extra; // text width for first screen line
|
||||
int width1 = wp->w_view_width - extra; // text width for first screen line
|
||||
int width2 = 0; // text width for second and later screen line
|
||||
bool did_sub_skipcol = false;
|
||||
if (width1 <= 0) {
|
||||
// No room for text, put cursor in last char of window.
|
||||
// If not wrapping, the last non-empty line.
|
||||
wp->w_wcol = wp->w_width_inner - 1;
|
||||
wp->w_wcol = wp->w_view_width - 1;
|
||||
if (wp->w_p_wrap) {
|
||||
wp->w_wrow = wp->w_height_inner - 1;
|
||||
wp->w_wrow = wp->w_view_height - 1;
|
||||
} else {
|
||||
wp->w_wrow = wp->w_height_inner - 1 - wp->w_empty_rows;
|
||||
wp->w_wrow = wp->w_view_height - 1 - wp->w_empty_rows;
|
||||
}
|
||||
} else if (wp->w_p_wrap && wp->w_width_inner != 0) {
|
||||
} else if (wp->w_p_wrap && wp->w_view_width != 0) {
|
||||
width2 = width1 + win_col_off2(wp);
|
||||
|
||||
// skip columns that are not visible
|
||||
@@ -856,9 +856,9 @@ void curs_columns(win_T *wp, int may_scroll)
|
||||
}
|
||||
|
||||
// long line wrapping, adjust wp->w_wrow
|
||||
if (wp->w_wcol >= wp->w_width_inner) {
|
||||
if (wp->w_wcol >= wp->w_view_width) {
|
||||
// this same formula is used in validate_cursor_col()
|
||||
n = (wp->w_wcol - wp->w_width_inner) / width2 + 1;
|
||||
n = (wp->w_wcol - wp->w_view_width) / width2 + 1;
|
||||
wp->w_wcol -= n * width2;
|
||||
wp->w_wrow += n;
|
||||
}
|
||||
@@ -874,7 +874,7 @@ void curs_columns(win_T *wp, int may_scroll)
|
||||
// extra
|
||||
int siso = get_sidescrolloff_value(wp);
|
||||
int off_left = startcol - wp->w_leftcol - siso;
|
||||
int off_right = endcol - wp->w_leftcol - wp->w_width_inner + siso + 1;
|
||||
int off_right = endcol - wp->w_leftcol - wp->w_view_width + siso + 1;
|
||||
if (off_left < 0 || off_right > 0) {
|
||||
int diff = (off_left < 0) ? -off_left : off_right;
|
||||
|
||||
@@ -920,15 +920,15 @@ void curs_columns(win_T *wp, int may_scroll)
|
||||
int plines = 0;
|
||||
int so = get_scrolloff_value(wp);
|
||||
colnr_T prev_skipcol = wp->w_skipcol;
|
||||
if ((wp->w_wrow >= wp->w_height_inner
|
||||
if ((wp->w_wrow >= wp->w_view_height
|
||||
|| ((prev_skipcol > 0
|
||||
|| wp->w_wrow + so >= wp->w_height_inner)
|
||||
|| wp->w_wrow + so >= wp->w_view_height)
|
||||
&& (plines = plines_win_nofill(wp, wp->w_cursor.lnum, false)) - 1
|
||||
>= wp->w_height_inner))
|
||||
&& wp->w_height_inner != 0
|
||||
>= wp->w_view_height))
|
||||
&& wp->w_view_height != 0
|
||||
&& wp->w_cursor.lnum == wp->w_topline
|
||||
&& width2 > 0
|
||||
&& wp->w_width_inner != 0) {
|
||||
&& wp->w_view_width != 0) {
|
||||
// Cursor past end of screen. Happens with a single line that does
|
||||
// not fit on screen. Find a skipcol to show the text around the
|
||||
// cursor. Avoid scrolling all the time. compute value of "extra":
|
||||
@@ -951,21 +951,21 @@ void curs_columns(win_T *wp, int may_scroll)
|
||||
} else {
|
||||
n = plines;
|
||||
}
|
||||
if ((colnr_T)n >= wp->w_height_inner + wp->w_skipcol / width2 - so) {
|
||||
if ((colnr_T)n >= wp->w_view_height + wp->w_skipcol / width2 - so) {
|
||||
extra += 2;
|
||||
}
|
||||
|
||||
if (extra == 3 || wp->w_height_inner <= so * 2) {
|
||||
if (extra == 3 || wp->w_view_height <= so * 2) {
|
||||
// not enough room for 'scrolloff', put cursor in the middle
|
||||
n = wp->w_virtcol / width2;
|
||||
if (n > wp->w_height_inner / 2) {
|
||||
n -= wp->w_height_inner / 2;
|
||||
if (n > wp->w_view_height / 2) {
|
||||
n -= wp->w_view_height / 2;
|
||||
} else {
|
||||
n = 0;
|
||||
}
|
||||
// don't skip more than necessary
|
||||
if (n > plines - wp->w_height_inner + 1) {
|
||||
n = plines - wp->w_height_inner + 1;
|
||||
if (n > plines - wp->w_view_height + 1) {
|
||||
n = plines - wp->w_view_height + 1;
|
||||
}
|
||||
wp->w_skipcol = n > 0 ? width1 + (n - 1) * width2
|
||||
: 0;
|
||||
@@ -981,7 +981,7 @@ void curs_columns(win_T *wp, int may_scroll)
|
||||
}
|
||||
} else if (extra == 2) {
|
||||
// less than 'scrolloff' lines below, increase skipcol
|
||||
endcol = (n - wp->w_height_inner + 1) * width2;
|
||||
endcol = (n - wp->w_view_height + 1) * width2;
|
||||
while (endcol > wp->w_virtcol) {
|
||||
endcol -= width2;
|
||||
}
|
||||
@@ -995,16 +995,20 @@ void curs_columns(win_T *wp, int may_scroll)
|
||||
wp->w_wrow -= wp->w_skipcol / width2;
|
||||
}
|
||||
|
||||
if (wp->w_wrow >= wp->w_height_inner) {
|
||||
if (wp->w_wrow >= wp->w_view_height) {
|
||||
// small window, make sure cursor is in it
|
||||
extra = wp->w_wrow - wp->w_height_inner + 1;
|
||||
extra = wp->w_wrow - wp->w_view_height + 1;
|
||||
wp->w_skipcol += extra * width2;
|
||||
wp->w_wrow -= extra;
|
||||
}
|
||||
|
||||
// extra could be either positive or negative
|
||||
extra = (prev_skipcol - wp->w_skipcol) / width2;
|
||||
win_scroll_lines(wp, 0, extra);
|
||||
// TODO(bfredl): this is very suspicious when not called by win_update()
|
||||
// We should not randomly alter screen state outside of update_screen() :(
|
||||
if (wp->w_grid.target) {
|
||||
win_scroll_lines(wp, 0, extra);
|
||||
}
|
||||
} else if (!wp->w_p_sms) {
|
||||
wp->w_skipcol = 0;
|
||||
}
|
||||
@@ -1053,7 +1057,7 @@ void textpos2screenpos(win_T *wp, pos_T *pos, int *rowp, int *scolp, int *ccolp,
|
||||
} else if (!local || lnum < wp->w_topline) {
|
||||
row = 0;
|
||||
} else {
|
||||
row = wp->w_height_inner - 1;
|
||||
row = wp->w_view_height - 1;
|
||||
}
|
||||
|
||||
bool existing_row = (lnum > 0 && lnum <= wp->w_buffer->b_ml.ml_line_count);
|
||||
@@ -1070,26 +1074,26 @@ void textpos2screenpos(win_T *wp, pos_T *pos, int *rowp, int *scolp, int *ccolp,
|
||||
// similar to what is done in validate_cursor_col()
|
||||
colnr_T col = scol;
|
||||
col += off;
|
||||
int width = wp->w_width_inner - off + win_col_off2(wp);
|
||||
int width = wp->w_view_width - off + win_col_off2(wp);
|
||||
|
||||
// long line wrapping, adjust row
|
||||
if (wp->w_p_wrap && col >= (colnr_T)wp->w_width_inner && width > 0) {
|
||||
if (wp->w_p_wrap && col >= (colnr_T)wp->w_view_width && width > 0) {
|
||||
// use same formula as what is used in curs_columns()
|
||||
int rowoff = visible_row ? ((col - wp->w_width_inner) / width + 1) : 0;
|
||||
int rowoff = visible_row ? ((col - wp->w_view_width) / width + 1) : 0;
|
||||
col -= rowoff * width;
|
||||
row += rowoff;
|
||||
}
|
||||
|
||||
col -= wp->w_leftcol;
|
||||
|
||||
if (col >= 0 && col < wp->w_width_inner && row >= 0 && row < wp->w_height_inner) {
|
||||
if (col >= 0 && col < wp->w_view_width && row >= 0 && row < wp->w_view_height) {
|
||||
coloff = col - scol + (local ? 0 : wp->w_wincol + wp->w_wincol_off) + 1;
|
||||
row += (local ? 0 : wp->w_winrow + wp->w_winrow_off) + 1;
|
||||
} else {
|
||||
// character is left, right or below of the window
|
||||
scol = ccol = ecol = 0;
|
||||
if (local) {
|
||||
coloff = col < 0 ? -1 : wp->w_width_inner + 1;
|
||||
coloff = col < 0 ? -1 : wp->w_view_width + 1;
|
||||
} else {
|
||||
row = 0;
|
||||
}
|
||||
@@ -1193,10 +1197,10 @@ static void cursor_correct_sms(win_T *wp)
|
||||
}
|
||||
|
||||
int so = get_scrolloff_value(wp);
|
||||
int width1 = wp->w_width_inner - win_col_off(wp);
|
||||
int width1 = wp->w_view_width - win_col_off(wp);
|
||||
int width2 = width1 + win_col_off2(wp);
|
||||
int so_cols = so == 0 ? 0 : width1 + (so - 1) * width2;
|
||||
int space_cols = (wp->w_height_inner - 1) * width2;
|
||||
int space_cols = (wp->w_view_height - 1) * width2;
|
||||
int size = so == 0 ? 0 : linetabsize_eol(wp, wp->w_topline);
|
||||
|
||||
if (wp->w_topline == 1 && wp->w_skipcol == 0) {
|
||||
@@ -1214,10 +1218,10 @@ static void cursor_correct_sms(win_T *wp)
|
||||
}
|
||||
|
||||
int overlap = wp->w_skipcol == 0
|
||||
? 0 : sms_marker_overlap(wp, wp->w_width_inner - width2);
|
||||
? 0 : sms_marker_overlap(wp, wp->w_view_width - width2);
|
||||
// If we have non-zero scrolloff, ignore marker overlap.
|
||||
int top = wp->w_skipcol + (so_cols != 0 ? so_cols : overlap);
|
||||
int bot = wp->w_skipcol + width1 + (wp->w_height_inner - 1) * width2 - so_cols;
|
||||
int bot = wp->w_skipcol + width1 + (wp->w_view_height - 1) * width2 - so_cols;
|
||||
|
||||
validate_virtcol(wp);
|
||||
colnr_T col = wp->w_virtcol;
|
||||
@@ -1323,7 +1327,7 @@ bool scrolldown(win_T *wp, linenr_T line_count, int byfold)
|
||||
bool do_sms = wp->w_p_wrap && wp->w_p_sms;
|
||||
|
||||
if (do_sms) {
|
||||
width1 = wp->w_width_inner - win_col_off(wp);
|
||||
width1 = wp->w_view_width - win_col_off(wp);
|
||||
width2 = width1 + win_col_off2(wp);
|
||||
}
|
||||
|
||||
@@ -1332,7 +1336,7 @@ bool scrolldown(win_T *wp, linenr_T line_count, int byfold)
|
||||
validate_cursor(wp); // w_wrow needs to be valid
|
||||
for (int todo = line_count; todo > 0; todo--) {
|
||||
if (wp->w_topfill < win_get_fill(wp, wp->w_topline)
|
||||
&& wp->w_topfill < wp->w_height_inner - 1) {
|
||||
&& wp->w_topfill < wp->w_view_height - 1) {
|
||||
wp->w_topfill++;
|
||||
done++;
|
||||
} else {
|
||||
@@ -1405,14 +1409,14 @@ bool scrolldown(win_T *wp, linenr_T line_count, int byfold)
|
||||
// Compute the row number of the last row of the cursor line
|
||||
// and move the cursor onto the displayed part of the window.
|
||||
int wrow = wp->w_wrow;
|
||||
if (wp->w_p_wrap && wp->w_width_inner != 0) {
|
||||
if (wp->w_p_wrap && wp->w_view_width != 0) {
|
||||
validate_virtcol(wp);
|
||||
validate_cheight(wp);
|
||||
wrow += wp->w_cline_height - 1 -
|
||||
wp->w_virtcol / wp->w_width_inner;
|
||||
wp->w_virtcol / wp->w_view_width;
|
||||
}
|
||||
bool moved = false;
|
||||
while (wrow >= wp->w_height_inner && wp->w_cursor.lnum > 1) {
|
||||
while (wrow >= wp->w_view_height && wp->w_cursor.lnum > 1) {
|
||||
linenr_T first;
|
||||
if (hasFolding(wp, wp->w_cursor.lnum, &first, NULL)) {
|
||||
wrow -= !decor_conceal_line(wp, wp->w_cursor.lnum - 1, false);
|
||||
@@ -1445,7 +1449,7 @@ bool scrollup(win_T *wp, linenr_T line_count, bool byfold)
|
||||
bool do_sms = wp->w_p_wrap && wp->w_p_sms;
|
||||
|
||||
if (do_sms || (byfold && win_lines_concealed(wp)) || win_may_fill(wp)) {
|
||||
int width1 = wp->w_width_inner - win_col_off(wp);
|
||||
int width1 = wp->w_view_width - win_col_off(wp);
|
||||
int width2 = width1 + win_col_off2(wp);
|
||||
int size = 0;
|
||||
const colnr_T prev_skipcol = wp->w_skipcol;
|
||||
@@ -1540,7 +1544,7 @@ void adjust_skipcol(void)
|
||||
return;
|
||||
}
|
||||
|
||||
int width1 = curwin->w_width_inner - win_col_off(curwin);
|
||||
int width1 = curwin->w_view_width - win_col_off(curwin);
|
||||
if (width1 <= 0) {
|
||||
return; // no text will be displayed
|
||||
}
|
||||
@@ -1550,17 +1554,17 @@ void adjust_skipcol(void)
|
||||
bool scrolled = false;
|
||||
|
||||
validate_cheight(curwin);
|
||||
if (curwin->w_cline_height == curwin->w_height_inner
|
||||
// w_cline_height may be capped at w_height_inner, check there aren't
|
||||
if (curwin->w_cline_height == curwin->w_view_height
|
||||
// w_cline_height may be capped at w_view_height, check there aren't
|
||||
// actually more lines.
|
||||
&& plines_win(curwin, curwin->w_cursor.lnum, false) <= curwin->w_height_inner) {
|
||||
&& plines_win(curwin, curwin->w_cursor.lnum, false) <= curwin->w_view_height) {
|
||||
// the line just fits in the window, don't scroll
|
||||
reset_skipcol(curwin);
|
||||
return;
|
||||
}
|
||||
|
||||
validate_virtcol(curwin);
|
||||
int overlap = sms_marker_overlap(curwin, curwin->w_width_inner - width2);
|
||||
int overlap = sms_marker_overlap(curwin, curwin->w_view_width - width2);
|
||||
while (curwin->w_skipcol > 0
|
||||
&& curwin->w_virtcol < curwin->w_skipcol + overlap + scrolloff_cols) {
|
||||
// scroll a screen line down
|
||||
@@ -1596,13 +1600,13 @@ void adjust_skipcol(void)
|
||||
if (col > width2) {
|
||||
row += (int)col / width2;
|
||||
}
|
||||
if (row >= curwin->w_height_inner) {
|
||||
if (row >= curwin->w_view_height) {
|
||||
if (curwin->w_skipcol == 0) {
|
||||
curwin->w_skipcol += width1;
|
||||
row--;
|
||||
}
|
||||
if (row >= curwin->w_height_inner) {
|
||||
curwin->w_skipcol += (row - curwin->w_height_inner) * width2;
|
||||
if (row >= curwin->w_view_height) {
|
||||
curwin->w_skipcol += (row - curwin->w_view_height) * width2;
|
||||
}
|
||||
redraw_later(curwin, UPD_NOT_VALID);
|
||||
}
|
||||
@@ -1615,12 +1619,12 @@ void check_topfill(win_T *wp, bool down)
|
||||
{
|
||||
if (wp->w_topfill > 0) {
|
||||
int n = plines_win_nofill(wp, wp->w_topline, true);
|
||||
if (wp->w_topfill + n > wp->w_height_inner) {
|
||||
if (wp->w_topfill + n > wp->w_view_height) {
|
||||
if (down && wp->w_topline > 1) {
|
||||
wp->w_topline--;
|
||||
wp->w_topfill = 0;
|
||||
} else {
|
||||
wp->w_topfill = wp->w_height_inner - n;
|
||||
wp->w_topfill = wp->w_view_height - n;
|
||||
wp->w_topfill = MAX(wp->w_topfill, 0);
|
||||
}
|
||||
}
|
||||
@@ -1650,13 +1654,13 @@ void scrolldown_clamp(void)
|
||||
} else {
|
||||
end_row += plines_win_nofill(curwin, curwin->w_topline - 1, true);
|
||||
}
|
||||
if (curwin->w_p_wrap && curwin->w_width_inner != 0) {
|
||||
if (curwin->w_p_wrap && curwin->w_view_width != 0) {
|
||||
validate_cheight(curwin);
|
||||
validate_virtcol(curwin);
|
||||
end_row += curwin->w_cline_height - 1 -
|
||||
curwin->w_virtcol / curwin->w_width_inner;
|
||||
curwin->w_virtcol / curwin->w_view_width;
|
||||
}
|
||||
if (end_row < curwin->w_height_inner - get_scrolloff_value(curwin)) {
|
||||
if (end_row < curwin->w_view_height - get_scrolloff_value(curwin)) {
|
||||
if (can_fill) {
|
||||
curwin->w_topfill++;
|
||||
check_topfill(curwin, true);
|
||||
@@ -1687,9 +1691,9 @@ void scrollup_clamp(void)
|
||||
int start_row = (curwin->w_wrow
|
||||
- plines_win_nofill(curwin, curwin->w_topline, true)
|
||||
- curwin->w_topfill);
|
||||
if (curwin->w_p_wrap && curwin->w_width_inner != 0) {
|
||||
if (curwin->w_p_wrap && curwin->w_view_width != 0) {
|
||||
validate_virtcol(curwin);
|
||||
start_row -= curwin->w_virtcol / curwin->w_width_inner;
|
||||
start_row -= curwin->w_virtcol / curwin->w_view_width;
|
||||
}
|
||||
if (start_row >= get_scrolloff_value(curwin)) {
|
||||
if (curwin->w_topfill > 0) {
|
||||
@@ -1818,7 +1822,7 @@ void scroll_cursor_top(win_T *wp, int min_scroll, int always)
|
||||
if (extra + i <= off && bot < wp->w_buffer->b_ml.ml_line_count) {
|
||||
used += plines_win_full(wp, bot, &bot, NULL, true, true);
|
||||
}
|
||||
if (used > wp->w_height_inner) {
|
||||
if (used > wp->w_view_height) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1831,7 +1835,7 @@ void scroll_cursor_top(win_T *wp, int min_scroll, int always)
|
||||
// If we don't have enough space, put cursor in the middle.
|
||||
// This makes sure we get the same position when using "k" and "j"
|
||||
// in a small window.
|
||||
if (used > wp->w_height_inner) {
|
||||
if (used > wp->w_view_height) {
|
||||
scroll_cursor_halfway(wp, false, false);
|
||||
} else {
|
||||
// If "always" is false, only adjust topline to a lower value, higher
|
||||
@@ -1875,7 +1879,7 @@ void set_empty_rows(win_T *wp, int used)
|
||||
if (used == 0) {
|
||||
wp->w_empty_rows = 0; // single line that doesn't fit
|
||||
} else {
|
||||
wp->w_empty_rows = wp->w_height_inner - used;
|
||||
wp->w_empty_rows = wp->w_view_height - used;
|
||||
if (wp->w_botline <= wp->w_buffer->b_ml.ml_line_count) {
|
||||
wp->w_filler_rows = win_get_fill(wp, wp->w_botline);
|
||||
if (wp->w_empty_rows > wp->w_filler_rows) {
|
||||
@@ -1914,14 +1918,14 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
|
||||
if (loff.height == MAXCOL) {
|
||||
break;
|
||||
}
|
||||
if (used + loff.height > wp->w_height_inner) {
|
||||
if (used + loff.height > wp->w_view_height) {
|
||||
if (do_sms) {
|
||||
// 'smoothscroll' and 'wrap' are set. The above line is
|
||||
// too long to show in its entirety, so we show just a part
|
||||
// of it.
|
||||
if (used < wp->w_height_inner) {
|
||||
int plines_offset = used + loff.height - wp->w_height_inner;
|
||||
used = wp->w_height_inner;
|
||||
if (used < wp->w_view_height) {
|
||||
int plines_offset = used + loff.height - wp->w_view_height;
|
||||
used = wp->w_view_height;
|
||||
wp->w_topfill = loff.fill;
|
||||
wp->w_topline = loff.lnum;
|
||||
wp->w_skipcol = skipcol_from_plines(wp, plines_offset);
|
||||
@@ -1970,7 +1974,7 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
|
||||
// need to scroll the additional clipped lines to scroll past the
|
||||
// top line before we can move on to the other lines.
|
||||
int top_plines = plines_win_nofill(wp, wp->w_topline, false);
|
||||
int width1 = wp->w_width_inner - win_col_off(wp);
|
||||
int width1 = wp->w_view_width - win_col_off(wp);
|
||||
|
||||
if (width1 > 0) {
|
||||
int width2 = width1 + win_col_off2(wp);
|
||||
@@ -1984,8 +1988,8 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
|
||||
}
|
||||
|
||||
top_plines -= skip_lines;
|
||||
if (top_plines > wp->w_height_inner) {
|
||||
scrolled += (top_plines - wp->w_height_inner);
|
||||
if (top_plines > wp->w_view_height) {
|
||||
scrolled += (top_plines - wp->w_view_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2026,7 +2030,7 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
|
||||
} else {
|
||||
used += loff.height;
|
||||
}
|
||||
if (used > wp->w_height_inner) {
|
||||
if (used > wp->w_view_height) {
|
||||
break;
|
||||
}
|
||||
if (loff.lnum >= wp->w_botline
|
||||
@@ -2044,7 +2048,7 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
|
||||
// Add one line below
|
||||
botline_forw(wp, &boff);
|
||||
used += boff.height;
|
||||
if (used > wp->w_height_inner) {
|
||||
if (used > wp->w_view_height) {
|
||||
break;
|
||||
}
|
||||
if (extra < (mouse_dragging > 0 ? mouse_dragging - 1 : so)
|
||||
@@ -2069,7 +2073,7 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
|
||||
if (scrolled <= 0) {
|
||||
line_count = 0;
|
||||
// more than a screenfull, don't scroll but redraw
|
||||
} else if (used > wp->w_height_inner) {
|
||||
} else if (used > wp->w_view_height) {
|
||||
line_count = used;
|
||||
// scroll minimal number of lines
|
||||
} else {
|
||||
@@ -2089,7 +2093,7 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
|
||||
|
||||
// Scroll up if the cursor is off the bottom of the screen a bit.
|
||||
// Otherwise put it at 1/2 of the screen.
|
||||
if (line_count >= wp->w_height_inner && line_count > min_scroll) {
|
||||
if (line_count >= wp->w_view_height && line_count > min_scroll) {
|
||||
scroll_cursor_halfway(wp, false, true);
|
||||
} else if (line_count > 0) {
|
||||
if (do_sms) {
|
||||
@@ -2137,10 +2141,10 @@ void scroll_cursor_halfway(win_T *wp, bool atend, bool prefer_above)
|
||||
if (do_sms) {
|
||||
// 'smoothscroll' and 'wrap' are set
|
||||
if (atend) {
|
||||
want_height = (wp->w_height_inner - used) / 2;
|
||||
want_height = (wp->w_view_height - used) / 2;
|
||||
used = 0;
|
||||
} else {
|
||||
want_height = wp->w_height_inner;
|
||||
want_height = wp->w_view_height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2189,7 +2193,7 @@ void scroll_cursor_halfway(win_T *wp, bool atend, bool prefer_above)
|
||||
if (boff.lnum < wp->w_buffer->b_ml.ml_line_count) {
|
||||
botline_forw(wp, &boff);
|
||||
used += boff.height;
|
||||
if (used > wp->w_height_inner) {
|
||||
if (used > wp->w_view_height) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
@@ -2212,7 +2216,7 @@ void scroll_cursor_halfway(win_T *wp, bool atend, bool prefer_above)
|
||||
} else {
|
||||
used += loff.height;
|
||||
}
|
||||
if (used > wp->w_height_inner) {
|
||||
if (used > wp->w_view_height) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
@@ -2237,7 +2241,7 @@ void scroll_cursor_halfway(win_T *wp, bool atend, bool prefer_above)
|
||||
}
|
||||
}
|
||||
wp->w_topfill = topfill;
|
||||
if (old_topline > wp->w_topline + wp->w_height_inner) {
|
||||
if (old_topline > wp->w_topline + wp->w_view_height) {
|
||||
wp->w_botfill = false;
|
||||
}
|
||||
check_topfill(wp, false);
|
||||
@@ -2261,14 +2265,14 @@ void cursor_correct(win_T *wp)
|
||||
}
|
||||
if (wp->w_topline == 1) {
|
||||
above_wanted = 0;
|
||||
int max_off = wp->w_height_inner / 2;
|
||||
int max_off = wp->w_view_height / 2;
|
||||
below_wanted = MIN(below_wanted, max_off);
|
||||
}
|
||||
validate_botline(wp);
|
||||
if (wp->w_botline == wp->w_buffer->b_ml.ml_line_count + 1
|
||||
&& mouse_dragging == 0) {
|
||||
below_wanted = 0;
|
||||
int max_off = (wp->w_height_inner - 1) / 2;
|
||||
int max_off = (wp->w_view_height - 1) / 2;
|
||||
above_wanted = MIN(above_wanted, max_off);
|
||||
}
|
||||
|
||||
@@ -2283,7 +2287,7 @@ void cursor_correct(win_T *wp)
|
||||
|
||||
if (wp->w_p_sms && !wp->w_p_wrap) {
|
||||
// 'smoothscroll' is active
|
||||
if (wp->w_cline_height == wp->w_height_inner) {
|
||||
if (wp->w_cline_height == wp->w_view_height) {
|
||||
// The cursor line just fits in the window, don't scroll.
|
||||
reset_skipcol(wp);
|
||||
return;
|
||||
@@ -2351,7 +2355,7 @@ void cursor_correct(win_T *wp)
|
||||
static int get_scroll_overlap(Direction dir)
|
||||
{
|
||||
lineoff_T loff;
|
||||
int min_height = curwin->w_height_inner - 2;
|
||||
int min_height = curwin->w_view_height - 2;
|
||||
|
||||
validate_botline(curwin);
|
||||
if ((dir == BACKWARD && curwin->w_topline == 1)
|
||||
@@ -2456,21 +2460,21 @@ int pagescroll(Direction dir, int count, bool half)
|
||||
if (half) {
|
||||
// Scroll [count], 'scroll' or current window height lines.
|
||||
if (count) {
|
||||
curwin->w_p_scr = MIN(curwin->w_height_inner, count);
|
||||
curwin->w_p_scr = MIN(curwin->w_view_height, count);
|
||||
}
|
||||
count = MIN(curwin->w_height_inner, (int)curwin->w_p_scr);
|
||||
count = MIN(curwin->w_view_height, (int)curwin->w_p_scr);
|
||||
|
||||
int curscount = count;
|
||||
// Adjust count so as to not reveal end of buffer lines.
|
||||
if (dir == FORWARD
|
||||
&& (curwin->w_topline + curwin->w_height_inner + count > buflen
|
||||
&& (curwin->w_topline + curwin->w_view_height + count > buflen
|
||||
|| win_lines_concealed(curwin))) {
|
||||
int n = plines_correct_topline(curwin, curwin->w_topline, NULL, false, NULL);
|
||||
if (n - count < curwin->w_height_inner && curwin->w_topline < buflen) {
|
||||
n += plines_m_win(curwin, curwin->w_topline + 1, buflen, curwin->w_height_inner + count);
|
||||
if (n - count < curwin->w_view_height && curwin->w_topline < buflen) {
|
||||
n += plines_m_win(curwin, curwin->w_topline + 1, buflen, curwin->w_view_height + count);
|
||||
}
|
||||
if (n < curwin->w_height_inner + count) {
|
||||
count = n - curwin->w_height_inner;
|
||||
if (n < curwin->w_view_height + count) {
|
||||
count = n - curwin->w_view_height;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2503,14 +2503,14 @@ bool nv_screengo(oparg_T *oap, int dir, int dist, bool skip_conceal)
|
||||
|
||||
col_off1 = win_col_off(curwin);
|
||||
col_off2 = col_off1 - win_col_off2(curwin);
|
||||
width1 = curwin->w_width_inner - col_off1;
|
||||
width2 = curwin->w_width_inner - col_off2;
|
||||
width1 = curwin->w_view_width - col_off1;
|
||||
width2 = curwin->w_view_width - col_off2;
|
||||
|
||||
if (width2 == 0) {
|
||||
width2 = 1; // Avoid divide by zero.
|
||||
}
|
||||
|
||||
if (curwin->w_width_inner != 0) {
|
||||
if (curwin->w_view_width != 0) {
|
||||
int n;
|
||||
// Instead of sticking at the last character of the buffer line we
|
||||
// try to stick in the last column of the screen.
|
||||
@@ -2843,7 +2843,7 @@ static void nv_zet(cmdarg_T *cap)
|
||||
|
||||
// "zH" - scroll screen right half-page
|
||||
case 'H':
|
||||
cap->count1 *= curwin->w_width_inner / 2;
|
||||
cap->count1 *= curwin->w_view_width / 2;
|
||||
FALLTHROUGH;
|
||||
|
||||
// "zh" - scroll screen to the right
|
||||
@@ -2857,7 +2857,7 @@ static void nv_zet(cmdarg_T *cap)
|
||||
|
||||
// "zL" - scroll window left half-page
|
||||
case 'L':
|
||||
cap->count1 *= curwin->w_width_inner / 2;
|
||||
cap->count1 *= curwin->w_view_width / 2;
|
||||
FALLTHROUGH;
|
||||
|
||||
// "zl" - scroll window to the left if not wrapping
|
||||
@@ -2896,7 +2896,7 @@ static void nv_zet(cmdarg_T *cap)
|
||||
} else {
|
||||
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col);
|
||||
}
|
||||
int n = curwin->w_width_inner - win_col_off(curwin);
|
||||
int n = curwin->w_view_width - win_col_off(curwin);
|
||||
if (col + siso < n) {
|
||||
col = 0;
|
||||
} else {
|
||||
@@ -3637,7 +3637,7 @@ static void nv_scroll(cmdarg_T *cap)
|
||||
// Don't count filler lines above the window.
|
||||
used -= win_get_fill(curwin, curwin->w_topline) - curwin->w_topfill;
|
||||
validate_botline(curwin); // make sure w_empty_rows is valid
|
||||
int half = (curwin->w_height_inner - curwin->w_empty_rows + 1) / 2;
|
||||
int half = (curwin->w_view_height - curwin->w_empty_rows + 1) / 2;
|
||||
for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; n++) {
|
||||
// Count half the number of filler lines to be "below this
|
||||
// line" and half to be "above the next line".
|
||||
@@ -3653,7 +3653,7 @@ static void nv_scroll(cmdarg_T *cap)
|
||||
n = lnum - curwin->w_topline;
|
||||
}
|
||||
}
|
||||
if (n > 0 && used > curwin->w_height_inner) {
|
||||
if (n > 0 && used > curwin->w_view_height) {
|
||||
n--;
|
||||
}
|
||||
} else { // (cap->cmdchar == 'H')
|
||||
@@ -5222,8 +5222,8 @@ void nv_g_home_m_cmd(cmdarg_T *cap)
|
||||
|
||||
cap->oap->motion_type = kMTCharWise;
|
||||
cap->oap->inclusive = false;
|
||||
if (curwin->w_p_wrap && curwin->w_width_inner != 0) {
|
||||
int width1 = curwin->w_width_inner - win_col_off(curwin);
|
||||
if (curwin->w_p_wrap && curwin->w_view_width != 0) {
|
||||
int width1 = curwin->w_view_width - win_col_off(curwin);
|
||||
int width2 = width1 + win_col_off2(curwin);
|
||||
|
||||
validate_virtcol(curwin);
|
||||
@@ -5235,7 +5235,7 @@ void nv_g_home_m_cmd(cmdarg_T *cap)
|
||||
// When ending up below 'smoothscroll' marker, move just beyond it so
|
||||
// that skipcol is not adjusted later.
|
||||
if (curwin->w_skipcol > 0 && curwin->w_cursor.lnum == curwin->w_topline) {
|
||||
int overlap = sms_marker_overlap(curwin, curwin->w_width_inner - width2);
|
||||
int overlap = sms_marker_overlap(curwin, curwin->w_view_width - width2);
|
||||
if (overlap > 0 && i == curwin->w_skipcol) {
|
||||
i += overlap;
|
||||
}
|
||||
@@ -5247,7 +5247,7 @@ void nv_g_home_m_cmd(cmdarg_T *cap)
|
||||
// 'relativenumber' is on and lines are wrapping the middle can be more
|
||||
// to the left.
|
||||
if (cap->nchar == 'm') {
|
||||
i += (curwin->w_width_inner - win_col_off(curwin)
|
||||
i += (curwin->w_view_width - win_col_off(curwin)
|
||||
+ ((curwin->w_p_wrap && i > 0) ? win_col_off2(curwin) : 0)) / 2;
|
||||
}
|
||||
coladvance(curwin, (colnr_T)i);
|
||||
@@ -5303,10 +5303,10 @@ static void nv_g_dollar_cmd(cmdarg_T *cap)
|
||||
|
||||
oap->motion_type = kMTCharWise;
|
||||
oap->inclusive = true;
|
||||
if (curwin->w_p_wrap && curwin->w_width_inner != 0) {
|
||||
if (curwin->w_p_wrap && curwin->w_view_width != 0) {
|
||||
curwin->w_curswant = MAXCOL; // so we stay at the end
|
||||
if (cap->count1 == 1) {
|
||||
int width1 = curwin->w_width_inner - col_off;
|
||||
int width1 = curwin->w_view_width - col_off;
|
||||
int width2 = width1 + win_col_off2(curwin);
|
||||
|
||||
validate_virtcol(curwin);
|
||||
@@ -5334,7 +5334,7 @@ static void nv_g_dollar_cmd(cmdarg_T *cap)
|
||||
// if it fails, let the cursor still move to the last char
|
||||
cursor_down(cap->count1 - 1, false);
|
||||
}
|
||||
i = curwin->w_leftcol + curwin->w_width_inner - col_off - 1;
|
||||
i = curwin->w_leftcol + curwin->w_view_width - col_off - 1;
|
||||
coladvance(curwin, (colnr_T)i);
|
||||
|
||||
// if the character doesn't fit move one back
|
||||
@@ -5342,7 +5342,7 @@ static void nv_g_dollar_cmd(cmdarg_T *cap)
|
||||
colnr_T vcol;
|
||||
|
||||
getvvcol(curwin, &curwin->w_cursor, NULL, NULL, &vcol);
|
||||
if (vcol >= curwin->w_leftcol + curwin->w_width_inner - col_off) {
|
||||
if (vcol >= curwin->w_leftcol + curwin->w_view_width - col_off) {
|
||||
curwin->w_cursor.col--;
|
||||
}
|
||||
}
|
||||
|
@@ -5766,7 +5766,7 @@ static void get_op_vcol(oparg_T *oap, colnr_T redo_VIsual_vcol, bool initial)
|
||||
colnr_T end;
|
||||
|
||||
if (VIsual_mode != Ctrl_V
|
||||
|| (!initial && oap->end.col < curwin->w_width_inner)) {
|
||||
|| (!initial && oap->end.col < curwin->w_view_width)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -2807,7 +2807,7 @@ static const char *check_num_option_bounds(OptIndex opt_idx, OptInt *newval, cha
|
||||
}
|
||||
break;
|
||||
case kOptScroll:
|
||||
if ((*newval <= 0 || (*newval > curwin->w_height_inner && curwin->w_height_inner > 0))
|
||||
if ((*newval <= 0 || (*newval > curwin->w_view_height && curwin->w_view_height > 0))
|
||||
&& full_screen) {
|
||||
if (*newval != 0) {
|
||||
errmsg = e_scroll;
|
||||
|
@@ -207,16 +207,16 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco
|
||||
// When "size" is 0, no new screen line is started.
|
||||
if (size > 0 && wp->w_p_wrap && (*sbr != NUL || wp->w_p_bri)) {
|
||||
int col_off_prev = win_col_off(wp);
|
||||
int width2 = wp->w_width_inner - col_off_prev + win_col_off2(wp);
|
||||
int width2 = wp->w_view_width - col_off_prev + win_col_off2(wp);
|
||||
colnr_T wcol = vcol + col_off_prev;
|
||||
colnr_T max_head_vcol = csarg->max_head_vcol;
|
||||
int added = 0;
|
||||
|
||||
// cells taken by 'showbreak'/'breakindent' before current char
|
||||
int head_prev = 0;
|
||||
if (wcol >= wp->w_width_inner) {
|
||||
wcol -= wp->w_width_inner;
|
||||
col_off_prev = wp->w_width_inner - width2;
|
||||
if (wcol >= wp->w_view_width) {
|
||||
wcol -= wp->w_view_width;
|
||||
col_off_prev = wp->w_view_width - width2;
|
||||
if (wcol >= width2 && width2 > 0) {
|
||||
wcol %= width2;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco
|
||||
wcol += col_off_prev;
|
||||
}
|
||||
|
||||
if (wcol + size > wp->w_width_inner) {
|
||||
if (wcol + size > wp->w_view_width) {
|
||||
// cells taken by 'showbreak'/'breakindent' halfway current char
|
||||
int head_mid = csarg->indent_width;
|
||||
if (head_mid == INT_MIN) {
|
||||
@@ -259,7 +259,7 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco
|
||||
}
|
||||
if (head_mid > 0) {
|
||||
// Calculate effective window width.
|
||||
int prev_rem = wp->w_width_inner - wcol;
|
||||
int prev_rem = wp->w_view_width - wcol;
|
||||
int width = width2 - head_mid;
|
||||
|
||||
if (width <= 0) {
|
||||
@@ -293,7 +293,7 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco
|
||||
bool need_lbr = false;
|
||||
// If 'linebreak' set check at a blank before a non-blank if the line
|
||||
// needs a break here.
|
||||
if (wp->w_p_lbr && wp->w_p_wrap && wp->w_width_inner != 0
|
||||
if (wp->w_p_lbr && wp->w_p_wrap && wp->w_view_width != 0
|
||||
&& vim_isbreak((uint8_t)cur[0]) && !vim_isbreak((uint8_t)cur[1])) {
|
||||
char *t = csarg->line;
|
||||
while (vim_isbreak((uint8_t)t[0])) {
|
||||
@@ -308,7 +308,7 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco
|
||||
// non-blank after a blank.
|
||||
int numberextra = win_col_off(wp);
|
||||
colnr_T col_adj = size - 1;
|
||||
colnr_T colmax = (colnr_T)(wp->w_width_inner - numberextra - col_adj);
|
||||
colnr_T colmax = (colnr_T)(wp->w_view_width - numberextra - col_adj);
|
||||
if (vcol >= colmax) {
|
||||
colmax += col_adj;
|
||||
int n = colmax + win_col_off2(wp);
|
||||
@@ -410,11 +410,11 @@ int charsize_nowrap(buf_T *buf, const char *cur, bool use_tabstop, colnr_T vcol,
|
||||
static bool in_win_border(win_T *wp, colnr_T vcol)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
if (wp->w_width_inner == 0) {
|
||||
if (wp->w_view_width == 0) {
|
||||
// there is no border
|
||||
return false;
|
||||
}
|
||||
int width1 = wp->w_width_inner - win_col_off(wp); // width of first line (after line number)
|
||||
int width1 = wp->w_view_width - win_col_off(wp); // width of first line (after line number)
|
||||
|
||||
if ((int)vcol < width1 - 1) {
|
||||
return false;
|
||||
@@ -765,7 +765,7 @@ int plines_win_nofill(win_T *wp, linenr_T lnum, bool limit_winheight)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (wp->w_width_inner == 0) {
|
||||
if (wp->w_view_width == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -775,8 +775,8 @@ int plines_win_nofill(win_T *wp, linenr_T lnum, bool limit_winheight)
|
||||
}
|
||||
|
||||
const int lines = plines_win_nofold(wp, lnum);
|
||||
if (limit_winheight && lines > wp->w_height_inner) {
|
||||
return wp->w_height_inner;
|
||||
if (limit_winheight && lines > wp->w_view_height) {
|
||||
return wp->w_view_height;
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
@@ -806,7 +806,7 @@ int plines_win_nofold(win_T *wp, linenr_T lnum)
|
||||
}
|
||||
|
||||
// Add column offset for 'number', 'relativenumber' and 'foldcolumn'.
|
||||
int width = wp->w_width_inner - win_col_off(wp);
|
||||
int width = wp->w_view_width - win_col_off(wp);
|
||||
if (width <= 0) {
|
||||
return 32000; // bigger than the number of screen lines
|
||||
}
|
||||
@@ -830,7 +830,7 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column)
|
||||
return lines + 1;
|
||||
}
|
||||
|
||||
if (wp->w_width_inner == 0) {
|
||||
if (wp->w_view_width == 0) {
|
||||
return lines + 1;
|
||||
}
|
||||
|
||||
@@ -865,7 +865,7 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column)
|
||||
}
|
||||
|
||||
// Add column offset for 'number', 'relativenumber', 'foldcolumn', etc.
|
||||
int width = wp->w_width_inner - win_col_off(wp);
|
||||
int width = wp->w_view_width - win_col_off(wp);
|
||||
if (width <= 0) {
|
||||
return 9999;
|
||||
}
|
||||
@@ -970,7 +970,7 @@ int64_t win_text_height(win_T *const wp, const linenr_T start_lnum, const int64_
|
||||
linenr_T *const end_lnum, int64_t *const end_vcol, int64_t *const fill,
|
||||
int64_t const max)
|
||||
{
|
||||
int width1 = wp->w_width_inner - win_col_off(wp);
|
||||
int width1 = wp->w_view_width - win_col_off(wp);
|
||||
int width2 = width1 + win_col_off2(wp);
|
||||
width1 = MAX(width1, 0);
|
||||
width2 = MAX(width2, 0);
|
||||
|
@@ -153,7 +153,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
|
||||
pum_is_drawn = true;
|
||||
validate_cursor_col(curwin);
|
||||
int above_row = 0;
|
||||
int below_row = MAX(cmdline_row, curwin->w_winrow + curwin->w_grid.rows);
|
||||
int below_row = MAX(cmdline_row, curwin->w_winrow + curwin->w_view_height);
|
||||
if (State & MODE_CMDLINE) {
|
||||
below_row = cmdline_row;
|
||||
}
|
||||
@@ -169,7 +169,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
|
||||
// anchor position: the start of the completed word
|
||||
pum_win_row = curwin->w_wrow;
|
||||
if (pum_rl) {
|
||||
cursor_col = curwin->w_width_inner - curwin->w_wcol - 1;
|
||||
cursor_col = curwin->w_view_width - curwin->w_wcol - 1;
|
||||
} else {
|
||||
cursor_col = curwin->w_wcol;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
|
||||
|
||||
int min_row = 0;
|
||||
int min_col = 0;
|
||||
int max_col = MAX(Columns, curwin->w_wincol + curwin->w_grid.cols);
|
||||
int max_col = MAX(Columns, curwin->w_wincol + curwin->w_view_width);
|
||||
if (State & MODE_CMDLINE) {
|
||||
max_col = Columns;
|
||||
}
|
||||
@@ -653,7 +653,7 @@ void pum_redraw(void)
|
||||
int attr = win_hl_attr(curwin, (int)hlf);
|
||||
attr = hl_combine_attr(win_hl_attr(curwin, HLF_PNI), attr);
|
||||
|
||||
grid_line_start(&pum_grid, row);
|
||||
screengrid_line_start(&pum_grid, row, 0);
|
||||
|
||||
// prepend a space if there is room
|
||||
if (extra_space) {
|
||||
@@ -922,7 +922,7 @@ static void pum_adjust_info_position(win_T *wp, int width)
|
||||
// when pum_above is SW otherwise is NW
|
||||
wp->w_config.anchor = pum_above ? kFloatAnchorSouth : 0;
|
||||
linenr_T count = wp->w_buffer->b_ml.ml_line_count;
|
||||
wp->w_width_inner = wp->w_config.width;
|
||||
wp->w_view_width = wp->w_config.width;
|
||||
wp->w_config.height = plines_m_win(wp, wp->w_topline, count, Rows);
|
||||
wp->w_config.row = pum_above ? pum_row + wp->w_config.height : pum_row;
|
||||
wp->w_config.hide = false;
|
||||
@@ -1327,11 +1327,11 @@ static void pum_position_at_mouse(int min_width)
|
||||
pum_win_row_offset = wp->w_winrow;
|
||||
pum_win_col_offset = wp->w_wincol;
|
||||
|
||||
if (wp->w_height_inner > 0 || wp->w_width_inner > 0) {
|
||||
if (wp->w_view_height > 0 || wp->w_view_width > 0) {
|
||||
// When the user has requested a different grid size, let the popupmenu extend to the size
|
||||
// of it.
|
||||
max_row = MAX(Rows - wp->w_winrow, wp->w_winrow + wp->w_grid.rows);
|
||||
max_col = MAX(Columns - wp->w_wincol, wp->w_wincol + wp->w_grid.cols);
|
||||
max_row = MAX(Rows - wp->w_winrow, wp->w_winrow + wp->w_view_height);
|
||||
max_col = MAX(Columns - wp->w_wincol, wp->w_wincol + wp->w_view_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1544,7 +1544,7 @@ void pum_make_popup(const char *path_name, int use_mouse_pos)
|
||||
// around there.
|
||||
mouse_row = curwin->w_grid.row_offset + curwin->w_wrow;
|
||||
mouse_col = curwin->w_grid.col_offset
|
||||
+ (curwin->w_p_rl ? curwin->w_width_inner - curwin->w_wcol - 1
|
||||
+ (curwin->w_p_rl ? curwin->w_view_width - curwin->w_wcol - 1
|
||||
: curwin->w_wcol);
|
||||
if (ui_has(kUIMultigrid)) {
|
||||
mouse_grid = curwin->w_grid.target->handle;
|
||||
@@ -1564,13 +1564,13 @@ void pum_make_popup(const char *path_name, int use_mouse_pos)
|
||||
void pum_ui_flush(void)
|
||||
{
|
||||
if (ui_has(kUIMultigrid) && pum_is_drawn && !pum_external && pum_grid.handle != 0
|
||||
&& pum_grid.composition_updated) {
|
||||
&& pum_grid.pending_comp_index_update) {
|
||||
const char *anchor = pum_above ? "SW" : "NW";
|
||||
int row_off = pum_above ? -pum_height : 0;
|
||||
ui_call_win_float_pos(pum_grid.handle, -1, cstr_as_string(anchor), pum_anchor_grid,
|
||||
pum_row - row_off - pum_win_row_offset, pum_left_col - pum_win_col_offset,
|
||||
false, pum_grid.zindex, (int)pum_grid.comp_index, pum_grid.comp_row,
|
||||
pum_grid.comp_col);
|
||||
pum_grid.composition_updated = false;
|
||||
pum_grid.pending_comp_index_update = false;
|
||||
}
|
||||
}
|
||||
|
@@ -2363,7 +2363,7 @@ void showmatch(int c)
|
||||
|
||||
bool col_visible = curwin->w_p_wrap
|
||||
|| (vcol >= curwin->w_leftcol
|
||||
&& vcol < curwin->w_leftcol + curwin->w_width_inner);
|
||||
&& vcol < curwin->w_leftcol + curwin->w_view_width);
|
||||
if (!col_visible) {
|
||||
return;
|
||||
}
|
||||
|
@@ -101,7 +101,7 @@ void win_redr_status(win_T *wp)
|
||||
attr = win_hl_attr(wp, HLF_C);
|
||||
fillchar = wp->w_p_fcs_chars.vert;
|
||||
}
|
||||
grid_line_start(&default_grid, W_ENDROW(wp));
|
||||
grid_line_start(&default_gridview, W_ENDROW(wp));
|
||||
grid_line_put_schar(W_ENDCOL(wp), fillchar, attr);
|
||||
grid_line_flush();
|
||||
}
|
||||
@@ -252,8 +252,7 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
|
||||
opt_scope = ((*wp->w_p_wbr != NUL) ? OPT_LOCAL : 0);
|
||||
row = -1; // row zero is first row of text
|
||||
col = 0;
|
||||
grid = &wp->w_grid;
|
||||
grid_adjust(&grid, &row, &col);
|
||||
grid = grid_adjust(&wp->w_grid, &row, &col);
|
||||
|
||||
if (row < 0) {
|
||||
goto theend;
|
||||
@@ -261,7 +260,7 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
|
||||
|
||||
fillchar = wp->w_p_fcs_chars.wbr;
|
||||
attr = (wp == curwin) ? win_hl_attr(wp, HLF_WBR) : win_hl_attr(wp, HLF_WBRNC);
|
||||
maxwidth = wp->w_width_inner;
|
||||
maxwidth = wp->w_view_width;
|
||||
stl_clear_click_defs(wp->w_winbar_click_defs, wp->w_winbar_click_defs_size);
|
||||
wp->w_winbar_click_defs = stl_alloc_click_defs(wp->w_winbar_click_defs, maxwidth,
|
||||
&wp->w_winbar_click_defs_size);
|
||||
@@ -294,8 +293,8 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
|
||||
col = MAX(ru_col - (Columns - maxwidth), (maxwidth + 1) / 2);
|
||||
maxwidth -= col;
|
||||
if (!in_status_line) {
|
||||
grid = &msg_grid_adj;
|
||||
row = Rows - 1;
|
||||
grid = grid_adjust(&msg_grid_adj, &row, &col);
|
||||
maxwidth--; // writing in last column may cause scrolling
|
||||
fillchar = schar_from_ascii(' ');
|
||||
attr = HL_ATTR(HLF_MSG);
|
||||
@@ -335,7 +334,7 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
|
||||
|
||||
// Draw each snippet with the specified highlighting.
|
||||
if (!draw_ruler) {
|
||||
grid_line_start(grid, row);
|
||||
screengrid_line_start(grid, row, 0);
|
||||
}
|
||||
|
||||
int curattr = attr;
|
||||
@@ -643,7 +642,7 @@ void draw_tabline(void)
|
||||
int col = 0;
|
||||
win_T *cwp;
|
||||
int wincount;
|
||||
grid_line_start(&default_grid, 0);
|
||||
grid_line_start(&default_gridview, 0);
|
||||
FOR_ALL_TABS(tp) {
|
||||
tabcount++;
|
||||
}
|
||||
|
@@ -659,9 +659,9 @@ void terminal_check_size(Terminal *term)
|
||||
}
|
||||
if (wp->w_buffer && wp->w_buffer->terminal == term) {
|
||||
const uint16_t win_width =
|
||||
(uint16_t)(MAX(0, wp->w_width_inner - win_col_off(wp)));
|
||||
(uint16_t)(MAX(0, wp->w_view_width - win_col_off(wp)));
|
||||
width = MAX(width, win_width);
|
||||
height = (uint16_t)MAX(height, wp->w_height_inner);
|
||||
height = (uint16_t)MAX(height, wp->w_view_height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2260,7 +2260,7 @@ static void adjust_topline(Terminal *term, buf_T *buf, int added)
|
||||
if (following || (wp == curwin && is_focused(term))) {
|
||||
// "Follow" the terminal output
|
||||
wp->w_cursor.lnum = ml_end;
|
||||
set_topline(wp, MAX(wp->w_cursor.lnum - wp->w_height_inner + 1, 1));
|
||||
set_topline(wp, MAX(wp->w_cursor.lnum - wp->w_view_height + 1, 1));
|
||||
} else {
|
||||
// Ensure valid cursor for each window displaying this terminal.
|
||||
wp->w_cursor.lnum = MIN(wp->w_cursor.lnum, ml_end);
|
||||
|
@@ -734,7 +734,7 @@ void check_auto_format(bool end_insert)
|
||||
|
||||
/// Find out textwidth to be used for formatting:
|
||||
/// if 'textwidth' option is set, use it
|
||||
/// else if 'wrapmargin' option is set, use curwin->w_width_inner-'wrapmargin'
|
||||
/// else if 'wrapmargin' option is set, use curwin->w_view_width-'wrapmargin'
|
||||
/// if invalid value, use 0.
|
||||
/// Set default to window width (maximum 79) for "gq" operator.
|
||||
///
|
||||
@@ -745,7 +745,7 @@ int comp_textwidth(bool ff)
|
||||
if (textwidth == 0 && curbuf->b_p_wm) {
|
||||
// The width is the window width minus 'wrapmargin' minus all the
|
||||
// things that add to the margin.
|
||||
textwidth = curwin->w_width_inner - (int)curbuf->b_p_wm;
|
||||
textwidth = curwin->w_view_width - (int)curbuf->b_p_wm;
|
||||
if (curbuf == cmdwin_buf) {
|
||||
textwidth -= 1;
|
||||
}
|
||||
@@ -758,7 +758,7 @@ int comp_textwidth(bool ff)
|
||||
}
|
||||
textwidth = MAX(textwidth, 0);
|
||||
if (ff && textwidth == 0) {
|
||||
textwidth = MIN(curwin->w_width_inner - 1, 79);
|
||||
textwidth = MIN(curwin->w_view_width - 1, 79);
|
||||
}
|
||||
return textwidth;
|
||||
}
|
||||
|
@@ -561,8 +561,11 @@ void ui_flush(void)
|
||||
if (pending_cursor_update) {
|
||||
ui_call_grid_cursor_goto(cursor_grid_handle, cursor_row, cursor_col);
|
||||
pending_cursor_update = false;
|
||||
// The cursor move might change the composition order, so flush again to update the windows that
|
||||
// changed
|
||||
// The cursor move might change the composition order,
|
||||
// so flush again to update the windows that changed
|
||||
// TODO(bfredl): refactor the flow of information so that win_ui_flush()
|
||||
// only is called once. (as order state is exposed, it should be owned
|
||||
// by nvim core, not the compositor)
|
||||
win_ui_flush(false);
|
||||
}
|
||||
if (pending_mode_info_update) {
|
||||
|
@@ -117,20 +117,20 @@ void ui_comp_layers_adjust(size_t layer_idx, bool raise)
|
||||
while (layer_idx < size - 1 && layer->zindex > layers.items[layer_idx + 1]->zindex) {
|
||||
layers.items[layer_idx] = layers.items[layer_idx + 1];
|
||||
layers.items[layer_idx]->comp_index = layer_idx;
|
||||
layers.items[layer_idx]->composition_updated = true;
|
||||
layers.items[layer_idx]->pending_comp_index_update = true;
|
||||
layer_idx++;
|
||||
}
|
||||
} else {
|
||||
while (layer_idx > 0 && layer->zindex < layers.items[layer_idx - 1]->zindex) {
|
||||
layers.items[layer_idx] = layers.items[layer_idx - 1];
|
||||
layers.items[layer_idx]->comp_index = layer_idx;
|
||||
layers.items[layer_idx]->composition_updated = true;
|
||||
layers.items[layer_idx]->pending_comp_index_update = true;
|
||||
layer_idx--;
|
||||
}
|
||||
}
|
||||
layers.items[layer_idx] = layer;
|
||||
layer->comp_index = layer_idx;
|
||||
layer->composition_updated = true;
|
||||
layer->pending_comp_index_update = true;
|
||||
}
|
||||
|
||||
/// Places `grid` at (col,row) position with (width * height) size.
|
||||
@@ -143,7 +143,7 @@ bool ui_comp_put_grid(ScreenGrid *grid, int row, int col, int height, int width,
|
||||
bool on_top)
|
||||
{
|
||||
bool moved;
|
||||
grid->composition_updated = true;
|
||||
grid->pending_comp_index_update = true;
|
||||
|
||||
grid->comp_height = height;
|
||||
grid->comp_width = width;
|
||||
@@ -197,14 +197,14 @@ bool ui_comp_put_grid(ScreenGrid *grid, int row, int col, int height, int width,
|
||||
for (size_t i = kv_size(layers) - 1; i > insert_at; i--) {
|
||||
kv_A(layers, i) = kv_A(layers, i - 1);
|
||||
kv_A(layers, i)->comp_index = i;
|
||||
kv_A(layers, i)->composition_updated = true;
|
||||
kv_A(layers, i)->pending_comp_index_update = true;
|
||||
}
|
||||
kv_A(layers, insert_at) = grid;
|
||||
|
||||
grid->comp_row = row;
|
||||
grid->comp_col = col;
|
||||
grid->comp_index = insert_at;
|
||||
grid->composition_updated = true;
|
||||
grid->pending_comp_index_update = true;
|
||||
}
|
||||
if (moved && valid && ui_comp_should_draw()) {
|
||||
compose_area(grid->comp_row, grid->comp_row + grid->rows,
|
||||
@@ -228,11 +228,11 @@ void ui_comp_remove_grid(ScreenGrid *grid)
|
||||
for (size_t i = grid->comp_index; i < kv_size(layers) - 1; i++) {
|
||||
kv_A(layers, i) = kv_A(layers, i + 1);
|
||||
kv_A(layers, i)->comp_index = i;
|
||||
kv_A(layers, i)->composition_updated = true;
|
||||
kv_A(layers, i)->pending_comp_index_update = true;
|
||||
}
|
||||
(void)kv_pop(layers);
|
||||
grid->comp_index = 0;
|
||||
grid->composition_updated = true;
|
||||
grid->pending_comp_index_update = true;
|
||||
|
||||
// recompose the area under the grid
|
||||
// inefficient when being overlapped: only draw up to grid->comp_index
|
||||
@@ -264,11 +264,11 @@ void ui_comp_raise_grid(ScreenGrid *grid, size_t new_index)
|
||||
for (size_t i = old_index; i < new_index; i++) {
|
||||
kv_A(layers, i) = kv_A(layers, i + 1);
|
||||
kv_A(layers, i)->comp_index = i;
|
||||
kv_A(layers, i)->composition_updated = true;
|
||||
kv_A(layers, i)->pending_comp_index_update = true;
|
||||
}
|
||||
kv_A(layers, new_index) = grid;
|
||||
grid->comp_index = new_index;
|
||||
grid->composition_updated = true;
|
||||
grid->pending_comp_index_update = true;
|
||||
for (size_t i = old_index; i < new_index; i++) {
|
||||
ScreenGrid *grid2 = kv_A(layers, i);
|
||||
int startcol = MAX(grid->comp_col, grid2->comp_col);
|
||||
@@ -608,7 +608,7 @@ bool ui_comp_set_screen_valid(bool valid)
|
||||
void ui_comp_msg_set_pos(Integer grid, Integer row, Boolean scrolled, String sep_char,
|
||||
Integer zindex, Integer compindex)
|
||||
{
|
||||
msg_grid.composition_updated = true;
|
||||
msg_grid.pending_comp_index_update = true;
|
||||
msg_grid.comp_row = (int)row;
|
||||
if (scrolled && row > 0) {
|
||||
msg_sep_row = (int)row - 1;
|
||||
|
@@ -2815,12 +2815,8 @@ static void do_intro_line(int row, char *mesg, bool colon)
|
||||
col = 0;
|
||||
}
|
||||
|
||||
ScreenGrid *grid = &default_grid;
|
||||
if (!colon && ui_has(kUIMultigrid)) {
|
||||
grid = &firstwin->w_grid;
|
||||
}
|
||||
grid_line_start((!colon && ui_has(kUIMultigrid)) ? &firstwin->w_grid : &default_gridview, row);
|
||||
|
||||
grid_line_start(grid, row);
|
||||
// Split up in parts to highlight <> items differently.
|
||||
for (char *p = mesg; *p != NUL; p += l) {
|
||||
for (l = 0;
|
||||
|
@@ -831,10 +831,9 @@ void ui_ext_win_position(win_T *wp, bool validate)
|
||||
if (win->w_pos_changed && win->w_grid_alloc.chars != NULL && win_valid(win)) {
|
||||
ui_ext_win_position(win, validate);
|
||||
}
|
||||
grid = &win->w_grid;
|
||||
int row_off = 0;
|
||||
int col_off = 0;
|
||||
grid_adjust(&grid, &row_off, &col_off);
|
||||
grid = grid_adjust(&win->w_grid, &row_off, &col_off);
|
||||
row += row_off;
|
||||
col += col_off;
|
||||
if (c.bufpos.lnum >= 0) {
|
||||
@@ -4127,12 +4126,12 @@ void win_init_size(void)
|
||||
{
|
||||
firstwin->w_height = (int)ROWS_AVAIL;
|
||||
firstwin->w_prev_height = (int)ROWS_AVAIL;
|
||||
firstwin->w_height_inner = firstwin->w_height - firstwin->w_winbar_height;
|
||||
firstwin->w_view_height = firstwin->w_height - firstwin->w_winbar_height;
|
||||
firstwin->w_height_outer = firstwin->w_height;
|
||||
firstwin->w_winrow_off = firstwin->w_winbar_height;
|
||||
topframe->fr_height = (int)ROWS_AVAIL;
|
||||
firstwin->w_width = Columns;
|
||||
firstwin->w_width_inner = firstwin->w_width;
|
||||
firstwin->w_view_width = firstwin->w_width;
|
||||
firstwin->w_width_outer = firstwin->w_width;
|
||||
topframe->fr_width = Columns;
|
||||
}
|
||||
@@ -6409,11 +6408,11 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
|
||||
// Has no effect when the window is less than two lines.
|
||||
void set_fraction(win_T *wp)
|
||||
{
|
||||
if (wp->w_height_inner > 1) {
|
||||
if (wp->w_view_height > 1) {
|
||||
// When cursor is in the first line the percentage is computed as if
|
||||
// it's halfway that line. Thus with two lines it is 25%, with three
|
||||
// lines 17%, etc. Similarly for the last line: 75%, 83%, etc.
|
||||
wp->w_fraction = (wp->w_wrow * FRACTION_MULT + FRACTION_MULT / 2) / wp->w_height_inner;
|
||||
wp->w_fraction = (wp->w_wrow * FRACTION_MULT + FRACTION_MULT / 2) / wp->w_view_height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6488,13 +6487,13 @@ static void win_fix_cursor(bool normal)
|
||||
|
||||
if (skip_win_fix_cursor
|
||||
|| !wp->w_do_win_fix_cursor
|
||||
|| wp->w_buffer->b_ml.ml_line_count < wp->w_height_inner) {
|
||||
|| wp->w_buffer->b_ml.ml_line_count < wp->w_view_height) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp->w_do_win_fix_cursor = false;
|
||||
// Determine valid cursor range.
|
||||
int so = MIN(wp->w_height_inner / 2, get_scrolloff_value(wp));
|
||||
int so = MIN(wp->w_view_height / 2, get_scrolloff_value(wp));
|
||||
linenr_T lnum = wp->w_cursor.lnum;
|
||||
|
||||
wp->w_cursor.lnum = wp->w_topline;
|
||||
@@ -6511,7 +6510,7 @@ static void win_fix_cursor(bool normal)
|
||||
if (lnum > bot && (wp->w_botline - wp->w_buffer->b_ml.ml_line_count) != 1) {
|
||||
nlnum = bot;
|
||||
} else if (lnum < top && wp->w_topline != 1) {
|
||||
nlnum = (so == wp->w_height_inner / 2) ? bot : top;
|
||||
nlnum = (so == wp->w_view_height / 2) ? bot : top;
|
||||
}
|
||||
|
||||
if (nlnum != 0) { // Cursor is invalid for current scroll position.
|
||||
@@ -6546,7 +6545,7 @@ void win_new_height(win_T *wp, int height)
|
||||
|
||||
void scroll_to_fraction(win_T *wp, int prev_height)
|
||||
{
|
||||
int height = wp->w_height_inner;
|
||||
int height = wp->w_view_height;
|
||||
|
||||
// Don't change w_topline in any of these cases:
|
||||
// - window height is 0
|
||||
@@ -6570,8 +6569,8 @@ void scroll_to_fraction(win_T *wp, int prev_height)
|
||||
// Make sure the whole cursor line is visible, if possible.
|
||||
const int rows = plines_win(wp, lnum, false);
|
||||
|
||||
if (sline > wp->w_height_inner - rows) {
|
||||
sline = wp->w_height_inner - rows;
|
||||
if (sline > wp->w_view_height - rows) {
|
||||
sline = wp->w_view_height - rows;
|
||||
wp->w_wrow -= rows - line_size;
|
||||
}
|
||||
}
|
||||
@@ -6581,12 +6580,12 @@ void scroll_to_fraction(win_T *wp, int prev_height)
|
||||
// Make cursor line the first line in the window. If not enough
|
||||
// room use w_skipcol;
|
||||
wp->w_wrow = line_size;
|
||||
if (wp->w_wrow >= wp->w_height_inner
|
||||
&& (wp->w_width_inner - win_col_off(wp)) > 0) {
|
||||
wp->w_skipcol += wp->w_width_inner - win_col_off(wp);
|
||||
if (wp->w_wrow >= wp->w_view_height
|
||||
&& (wp->w_view_width - win_col_off(wp)) > 0) {
|
||||
wp->w_skipcol += wp->w_view_width - win_col_off(wp);
|
||||
wp->w_wrow--;
|
||||
while (wp->w_wrow >= wp->w_height_inner) {
|
||||
wp->w_skipcol += wp->w_width_inner - win_col_off(wp)
|
||||
while (wp->w_wrow >= wp->w_view_height) {
|
||||
wp->w_skipcol += wp->w_view_width - win_col_off(wp)
|
||||
+ win_col_off2(wp);
|
||||
wp->w_wrow--;
|
||||
}
|
||||
@@ -6643,7 +6642,7 @@ void win_set_inner_size(win_T *wp, bool valid_cursor)
|
||||
width = wp->w_width;
|
||||
}
|
||||
|
||||
int prev_height = wp->w_height_inner;
|
||||
int prev_height = wp->w_view_height;
|
||||
int height = wp->w_height_request;
|
||||
if (height == 0) {
|
||||
height = MAX(0, wp->w_height - wp->w_winbar_height);
|
||||
@@ -6656,14 +6655,14 @@ void win_set_inner_size(win_T *wp, bool valid_cursor)
|
||||
// call win_new_height() recursively.
|
||||
validate_cursor(curwin);
|
||||
}
|
||||
if (wp->w_height_inner != prev_height) {
|
||||
if (wp->w_view_height != prev_height) {
|
||||
return; // Recursive call already changed the size, bail out.
|
||||
}
|
||||
if (wp->w_wrow != wp->w_prev_fraction_row) {
|
||||
set_fraction(wp);
|
||||
}
|
||||
}
|
||||
wp->w_height_inner = height;
|
||||
wp->w_view_height = height;
|
||||
win_comp_scroll(wp);
|
||||
|
||||
// There is no point in adjusting the scroll position when exiting. Some
|
||||
@@ -6675,8 +6674,8 @@ void win_set_inner_size(win_T *wp, bool valid_cursor)
|
||||
redraw_later(wp, UPD_SOME_VALID);
|
||||
}
|
||||
|
||||
if (width != wp->w_width_inner) {
|
||||
wp->w_width_inner = width;
|
||||
if (width != wp->w_view_width) {
|
||||
wp->w_view_width = width;
|
||||
wp->w_lines_valid = 0;
|
||||
if (valid_cursor) {
|
||||
changed_line_abv_curs_win(wp);
|
||||
@@ -6692,8 +6691,8 @@ void win_set_inner_size(win_T *wp, bool valid_cursor)
|
||||
terminal_check_size(wp->w_buffer->terminal);
|
||||
}
|
||||
|
||||
wp->w_height_outer = (wp->w_height_inner + win_border_height(wp) + wp->w_winbar_height);
|
||||
wp->w_width_outer = (wp->w_width_inner + win_border_width(wp));
|
||||
wp->w_height_outer = (wp->w_view_height + win_border_height(wp) + wp->w_winbar_height);
|
||||
wp->w_width_outer = (wp->w_view_width + win_border_width(wp));
|
||||
wp->w_winrow_off = wp->w_border_adj[0] + wp->w_winbar_height;
|
||||
wp->w_wincol_off = wp->w_border_adj[3];
|
||||
|
||||
@@ -6717,7 +6716,7 @@ void win_new_width(win_T *wp, int width)
|
||||
|
||||
OptInt win_default_scroll(win_T *wp)
|
||||
{
|
||||
return MAX(wp->w_height_inner / 2, 1);
|
||||
return MAX(wp->w_view_height / 2, 1);
|
||||
}
|
||||
|
||||
void win_comp_scroll(win_T *wp)
|
||||
@@ -6770,7 +6769,7 @@ void command_height(void)
|
||||
|
||||
// Clear the cmdheight area.
|
||||
if (msg_scrolled == 0 && full_screen) {
|
||||
ScreenGrid *grid = &default_grid;
|
||||
GridView *grid = &default_gridview;
|
||||
if (!ui_has(kUIMessages)) {
|
||||
msg_grid_validate();
|
||||
grid = &msg_grid_adj;
|
||||
@@ -6944,7 +6943,7 @@ int set_winbar_win(win_T *wp, bool make_room, bool valid_cursor)
|
||||
: ((*p_wbr != NUL || *wp->w_p_wbr != NUL) ? 1 : 0);
|
||||
|
||||
if (wp->w_winbar_height != winbar_height) {
|
||||
if (winbar_height == 1 && wp->w_height_inner <= 1) {
|
||||
if (winbar_height == 1 && wp->w_view_height <= 1) {
|
||||
if (wp->w_floating) {
|
||||
emsg(_(e_noroom));
|
||||
return NOTDONE;
|
||||
@@ -7468,7 +7467,7 @@ void win_get_tabwin(handle_T id, int *tabnr, int *winnr)
|
||||
void win_ui_flush(bool validate)
|
||||
{
|
||||
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
||||
if ((wp->w_pos_changed || wp->w_grid_alloc.composition_updated)
|
||||
if ((wp->w_pos_changed || wp->w_grid_alloc.pending_comp_index_update)
|
||||
&& wp->w_grid_alloc.chars != NULL) {
|
||||
if (tp == curtab) {
|
||||
ui_ext_win_position(wp, validate);
|
||||
@@ -7476,7 +7475,7 @@ void win_ui_flush(bool validate)
|
||||
ui_call_win_hide(wp->w_grid_alloc.handle);
|
||||
wp->w_pos_changed = false;
|
||||
}
|
||||
wp->w_grid_alloc.composition_updated = false;
|
||||
wp->w_grid_alloc.pending_comp_index_update = false;
|
||||
}
|
||||
if (tp == curtab) {
|
||||
ui_ext_win_viewport(wp);
|
||||
|
@@ -243,12 +243,7 @@ void win_config_float(win_T *wp, WinConfig fconfig)
|
||||
if (parent) {
|
||||
row += parent->w_winrow;
|
||||
col += parent->w_wincol;
|
||||
ScreenGrid *grid = &parent->w_grid;
|
||||
int row_off = 0;
|
||||
int col_off = 0;
|
||||
grid_adjust(&grid, &row_off, &col_off);
|
||||
row += row_off;
|
||||
col += col_off;
|
||||
grid_adjust(&parent->w_grid, &row, &col);
|
||||
if (wp->w_config.bufpos.lnum >= 0) {
|
||||
pos_T pos = { MIN(wp->w_config.bufpos.lnum + 1, parent->w_buffer->b_ml.ml_line_count),
|
||||
wp->w_config.bufpos.col, 0 };
|
||||
|
Reference in New Issue
Block a user