mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
multigrid: Fix lint errors
This commit is contained in:
parent
8b47b56fc6
commit
ba6f9f60ad
@ -248,8 +248,8 @@ static void ui_set_option(UI *ui, bool init, String name, Object value,
|
||||
/// Sets the inner "width" and "height" of the window grid identified by
|
||||
/// "grid" handle. If the grid does not exist, set error.
|
||||
void nvim_ui_try_resize_grid(uint64_t channel_id, Integer grid, Integer width,
|
||||
Integer height, Error *error)
|
||||
FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY
|
||||
Integer height, Error *error)
|
||||
FUNC_API_SINCE(5) FUNC_API_REMOTE_ONLY
|
||||
{
|
||||
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
|
||||
api_set_error(error, kErrorTypeException,
|
||||
|
@ -1104,7 +1104,8 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he
|
||||
if (size + sbrlen + numberwidth > (colnr_T)wp->w_grid.Columns) {
|
||||
// Calculate effective window width.
|
||||
int width = (colnr_T)wp->w_grid.Columns - sbrlen - numberwidth;
|
||||
int prev_width = col ? ((colnr_T)wp->w_grid.Columns - (sbrlen + col)) : 0;
|
||||
int prev_width = col ? ((colnr_T)wp->w_grid.Columns - (sbrlen + col))
|
||||
: 0;
|
||||
if (width == 0) {
|
||||
width = (colnr_T)wp->w_grid.Columns;
|
||||
}
|
||||
|
@ -223,9 +223,10 @@ static int coladvance2(
|
||||
} else {
|
||||
int b = (int)wcol - (int)col;
|
||||
|
||||
/* The difference between wcol and col is used to set coladd. */
|
||||
if (b > 0 && b < (MAXCOL - 2 * curwin->w_grid.Columns))
|
||||
// The difference between wcol and col is used to set coladd.
|
||||
if (b > 0 && b < (MAXCOL - 2 * curwin->w_grid.Columns)) {
|
||||
pos->coladd = b;
|
||||
}
|
||||
|
||||
col += b;
|
||||
}
|
||||
|
@ -1495,7 +1495,7 @@ void edit_putchar(int c, int highlight)
|
||||
int attr;
|
||||
|
||||
if (default_grid.ScreenLines != NULL) {
|
||||
update_topline(); /* just in case w_topline isn't valid */
|
||||
update_topline(); // just in case w_topline isn't valid
|
||||
validate_cursor();
|
||||
if (highlight) {
|
||||
attr = HL_ATTR(HLF_8);
|
||||
@ -1518,8 +1518,9 @@ void edit_putchar(int c, int highlight)
|
||||
}
|
||||
} else {
|
||||
pc_col += curwin->w_wcol;
|
||||
if (grid_lefthalve(&curwin->w_grid, pc_row, pc_col))
|
||||
if (grid_lefthalve(&curwin->w_grid, pc_row, pc_col)) {
|
||||
pc_status = PC_STATUS_LEFT;
|
||||
}
|
||||
}
|
||||
|
||||
/* save the character to be able to put it back */
|
||||
@ -1568,7 +1569,7 @@ void display_dollar(colnr_T col)
|
||||
curwin->w_cursor.col -= utf_head_off(p, p + col);
|
||||
curs_columns(false); // Recompute w_wrow and w_wcol
|
||||
if (curwin->w_wcol < curwin->w_grid.Columns) {
|
||||
edit_putchar('$', FALSE);
|
||||
edit_putchar('$', false);
|
||||
dollar_vcol = curwin->w_virtcol;
|
||||
}
|
||||
curwin->w_cursor.col = save_col;
|
||||
@ -5842,8 +5843,9 @@ comp_textwidth (
|
||||
/* The width is the window width minus 'wrapmargin' minus all the
|
||||
* things that add to the margin. */
|
||||
textwidth = curwin->w_grid.Columns - curbuf->b_p_wm;
|
||||
if (cmdwin_type != 0)
|
||||
if (cmdwin_type != 0) {
|
||||
textwidth -= 1;
|
||||
}
|
||||
textwidth -= curwin->w_p_fdc;
|
||||
|
||||
if (signcolumn_on(curwin)) {
|
||||
@ -5857,8 +5859,9 @@ comp_textwidth (
|
||||
textwidth = 0;
|
||||
if (ff && textwidth == 0) {
|
||||
textwidth = curwin->w_grid.Columns - 1;
|
||||
if (textwidth > 79)
|
||||
if (textwidth > 79) {
|
||||
textwidth = 79;
|
||||
}
|
||||
}
|
||||
return textwidth;
|
||||
}
|
||||
|
@ -256,10 +256,12 @@ void ex_align(exarg_T *eap)
|
||||
*/
|
||||
if (width <= 0)
|
||||
width = curbuf->b_p_tw;
|
||||
if (width == 0 && curbuf->b_p_wm > 0)
|
||||
if (width == 0 && curbuf->b_p_wm > 0) {
|
||||
width = curwin->w_grid.Columns - curbuf->b_p_wm;
|
||||
if (width <= 0)
|
||||
}
|
||||
if (width <= 0) {
|
||||
width = 80;
|
||||
}
|
||||
}
|
||||
|
||||
if (u_save((linenr_T)(eap->line1 - 1), (linenr_T)(eap->line2 + 1)) == FAIL)
|
||||
|
@ -9194,10 +9194,10 @@ static int ses_winsizes(FILE *fd, int restore_size, win_T *tab_firstwin)
|
||||
/* restore height when not full height */
|
||||
if (wp->w_height + wp->w_status_height < topframe->fr_height
|
||||
&& (fprintf(fd,
|
||||
"exe '%dresize ' . ((&lines * %" PRId64
|
||||
" + %" PRId64 ") / %" PRId64 ")",
|
||||
n, (int64_t)wp->w_grid.Rows,
|
||||
(int64_t)(Rows / 2), (int64_t)Rows) < 0
|
||||
"exe '%dresize ' . ((&lines * %" PRId64
|
||||
" + %" PRId64 ") / %" PRId64 ")",
|
||||
n, (int64_t)wp->w_grid.Rows,
|
||||
(int64_t)(Rows / 2), (int64_t)Rows) < 0
|
||||
|| put_eol(fd) == FAIL))
|
||||
return FAIL;
|
||||
|
||||
|
@ -2129,7 +2129,7 @@ static int vgetorpeek(int advance)
|
||||
col = curwin->w_cursor.col - 1;
|
||||
}
|
||||
} else if (curwin->w_p_wrap && curwin->w_wrow) {
|
||||
--curwin->w_wrow;
|
||||
curwin->w_wrow--;
|
||||
curwin->w_wcol = curwin->w_grid.Columns - 1;
|
||||
col = curwin->w_cursor.col - 1;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ typedef off_t off_T;
|
||||
EXTERN ScreenGrid default_grid INIT(= { 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0,
|
||||
0, 0, 0 });
|
||||
|
||||
#define DEFAULT_GRID_HANDLE 1 /* handle for the default_grid */
|
||||
#define DEFAULT_GRID_HANDLE 1 // handle for the default_grid
|
||||
|
||||
/*
|
||||
* When vgetc() is called, it sets mod_mask to the set of modifiers that are
|
||||
|
@ -582,7 +582,8 @@ static void prt_header(prt_settings_T *const psettings, const int pagenum,
|
||||
*/
|
||||
static void prt_message(char_u *s)
|
||||
{
|
||||
grid_fill(&default_grid, (int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0);
|
||||
grid_fill(&default_grid, (int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ',
|
||||
0);
|
||||
grid_puts(&default_grid, s, (int)Rows - 1, 0, HL_ATTR(HLF_R));
|
||||
ui_flush();
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ int get_breakindent_win(win_T *wp, char_u *line)
|
||||
static char_u *prev_line = NULL; // cached pointer to line.
|
||||
static varnumber_T prev_tick = 0; // Changedtick of cached value.
|
||||
int bri = 0;
|
||||
/* window width minus window margin space, i.e. what rests for text */
|
||||
// window width minus window margin space, i.e. what rests for text
|
||||
const int eff_wwidth = wp->w_grid.Columns
|
||||
- ((wp->w_p_nu || wp->w_p_rnu)
|
||||
&& (vim_strchr(p_cpo, CPO_NUMCOL) == NULL)
|
||||
|
@ -1546,10 +1546,8 @@ void msg_prt_line(char_u *s, int list)
|
||||
msg_clr_eos();
|
||||
}
|
||||
|
||||
/*
|
||||
* Use grid_puts() to output one multi-byte character.
|
||||
* Return the pointer "s" advanced to the next character.
|
||||
*/
|
||||
// Use grid_puts() to output one multi-byte character.
|
||||
// Return the pointer "s" advanced to the next character.
|
||||
static char_u *screen_puts_mbyte(char_u *s, int l, int attr)
|
||||
{
|
||||
int cw;
|
||||
@ -2097,7 +2095,8 @@ static void t_puts(int *t_col, const char_u *t_s, const char_u *s, int attr)
|
||||
{
|
||||
// Output postponed text.
|
||||
msg_didout = true; // Remember that line is not empty.
|
||||
grid_puts_len(&default_grid, (char_u *)t_s, (int)(s - t_s), msg_row, msg_col, attr);
|
||||
grid_puts_len(&default_grid, (char_u *)t_s, (int)(s - t_s), msg_row, msg_col,
|
||||
attr);
|
||||
msg_col += *t_col;
|
||||
*t_col = 0;
|
||||
/* If the string starts with a composing character don't increment the
|
||||
@ -2314,7 +2313,7 @@ static int do_more_prompt(int typed_char)
|
||||
|
||||
if (toscroll == -1
|
||||
&& grid_ins_lines(&default_grid, 0, 1, (int)Rows,
|
||||
0, (int)Columns) == OK) {
|
||||
0, (int)Columns) == OK) {
|
||||
grid_fill(&default_grid, 0, 1, 0, (int)Columns, ' ', ' ', 0);
|
||||
// display line at top
|
||||
(void)disp_sb_line(0, mp);
|
||||
@ -2335,17 +2334,17 @@ static int do_more_prompt(int typed_char)
|
||||
msg_scroll_up();
|
||||
inc_msg_scrolled();
|
||||
grid_fill(&default_grid, (int)Rows - 2, (int)Rows - 1, 0,
|
||||
(int)Columns, ' ', ' ', 0);
|
||||
(int)Columns, ' ', ' ', 0);
|
||||
mp_last = disp_sb_line((int)Rows - 2, mp_last);
|
||||
--toscroll;
|
||||
}
|
||||
}
|
||||
|
||||
if (toscroll <= 0) {
|
||||
/* displayed the requested text, more prompt again */
|
||||
// displayed the requested text, more prompt again
|
||||
grid_fill(&default_grid, (int)Rows - 1, (int)Rows, 0,
|
||||
(int)Columns, ' ', ' ', 0);
|
||||
msg_moremsg(FALSE);
|
||||
(int)Columns, ' ', ' ', 0);
|
||||
msg_moremsg(false);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2356,8 +2355,9 @@ static int do_more_prompt(int typed_char)
|
||||
break;
|
||||
}
|
||||
|
||||
/* clear the --more-- message */
|
||||
grid_fill(&default_grid, (int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0);
|
||||
// clear the --more-- message
|
||||
grid_fill(&default_grid, (int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ',
|
||||
0);
|
||||
State = oldState;
|
||||
setmouse();
|
||||
if (quit_more) {
|
||||
@ -2477,8 +2477,8 @@ void msg_moremsg(int full)
|
||||
grid_puts(&default_grid, s, (int)Rows - 1, 0, attr);
|
||||
if (full) {
|
||||
grid_puts(&default_grid, (char_u *)
|
||||
_(" SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "),
|
||||
(int)Rows - 1, vim_strsize(s), attr);
|
||||
_(" SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "),
|
||||
(int)Rows - 1, vim_strsize(s), attr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2527,13 +2527,13 @@ void msg_clr_eos(void)
|
||||
*/
|
||||
void msg_clr_eos_force(void)
|
||||
{
|
||||
if (cmdmsg_rl) {
|
||||
grid_fill(&default_grid, msg_row, msg_row + 1, 0, msg_col + 1, ' ', ' ', 0);
|
||||
grid_fill(&default_grid, msg_row + 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0);
|
||||
} else {
|
||||
grid_fill(&default_grid, msg_row, msg_row + 1, msg_col, (int)Columns, ' ', ' ', 0);
|
||||
grid_fill(&default_grid, msg_row + 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0);
|
||||
}
|
||||
int msg_startcol = (cmdmsg_rl) ? 0 : msg_col;
|
||||
int msg_endcol = (cmdmsg_rl) ? msg_col + 1 : (int)Columns;
|
||||
|
||||
grid_fill(&default_grid, msg_row, msg_row + 1, msg_startcol, msg_endcol, ' ',
|
||||
' ', 0);
|
||||
grid_fill(&default_grid, msg_row + 1, (int)Rows, 0, (int)Columns, ' ', ' ',
|
||||
0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1318,8 +1318,9 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column)
|
||||
if (!wp->w_p_wrap)
|
||||
return lines + 1;
|
||||
|
||||
if (wp->w_grid.Columns == 0)
|
||||
if (wp->w_grid.Columns == 0) {
|
||||
return lines + 1;
|
||||
}
|
||||
|
||||
char_u *line = ml_get_buf(wp->w_buffer, lnum, false);
|
||||
char_u *s = line;
|
||||
|
@ -112,7 +112,7 @@ retnomove:
|
||||
if (row >= 0 && row < Rows && col >= 0 && col <= Columns
|
||||
&& default_grid.ScreenLines != NULL) {
|
||||
mouse_char = default_grid.ScreenLines[default_grid.LineOffset[row]
|
||||
+ (unsigned)col][0];
|
||||
+ (unsigned)col][0];
|
||||
} else {
|
||||
mouse_char = ' ';
|
||||
}
|
||||
|
150
src/nvim/move.c
150
src/nvim/move.c
@ -83,8 +83,9 @@ static void comp_botline(win_T *wp)
|
||||
redraw_for_cursorline(wp);
|
||||
wp->w_valid |= (VALID_CROW|VALID_CHEIGHT);
|
||||
}
|
||||
if (done + n > wp->w_grid.Rows)
|
||||
if (done + n > wp->w_grid.Rows) {
|
||||
break;
|
||||
}
|
||||
done += n;
|
||||
lnum = last;
|
||||
}
|
||||
@ -204,8 +205,9 @@ void update_topline(void)
|
||||
|
||||
if (check_topline) {
|
||||
int halfheight = curwin->w_grid.Rows / 2 - 1;
|
||||
if (halfheight < 2)
|
||||
if (halfheight < 2) {
|
||||
halfheight = 2;
|
||||
}
|
||||
long n;
|
||||
if (hasAnyFolding(curwin)) {
|
||||
/* Count the number of logical lines between the cursor and
|
||||
@ -292,20 +294,22 @@ void update_topline(void)
|
||||
* botline - p_so (approximation of how much will be
|
||||
* scrolled). */
|
||||
for (linenr_T lnum = curwin->w_cursor.lnum;
|
||||
lnum >= curwin->w_botline - p_so; --lnum) {
|
||||
++line_count;
|
||||
/* stop at end of file or when we know we are far off */
|
||||
if (lnum <= 0 || line_count > curwin->w_grid.Rows + 1)
|
||||
lnum >= curwin->w_botline - p_so; lnum--) {
|
||||
line_count++;
|
||||
// stop at end of file or when we know we are far off
|
||||
if (lnum <= 0 || line_count > curwin->w_grid.Rows + 1) {
|
||||
break;
|
||||
}
|
||||
(void)hasFolding(lnum, &lnum, NULL);
|
||||
}
|
||||
} else
|
||||
line_count = curwin->w_cursor.lnum - curwin->w_botline
|
||||
+ 1 + p_so;
|
||||
if (line_count <= curwin->w_grid.Rows + 1)
|
||||
if (line_count <= curwin->w_grid.Rows + 1) {
|
||||
scroll_cursor_bot(scrolljump_value(), false);
|
||||
else
|
||||
} else {
|
||||
scroll_cursor_halfway(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -666,16 +670,17 @@ void validate_cursor_col(void)
|
||||
col += off;
|
||||
int width = curwin->w_grid.Columns - off + curwin_col_off2();
|
||||
|
||||
/* long line wrapping, adjust curwin->w_wrow */
|
||||
if (curwin->w_p_wrap
|
||||
&& col >= (colnr_T)curwin->w_grid.Columns
|
||||
&& width > 0)
|
||||
/* use same formula as what is used in curs_columns() */
|
||||
// long line wrapping, adjust curwin->w_wrow
|
||||
if (curwin->w_p_wrap && col >= (colnr_T)curwin->w_grid.Columns
|
||||
&& width > 0) {
|
||||
// use same formula as what is used in curs_columns()
|
||||
col -= ((col - curwin->w_grid.Columns) / width + 1) * width;
|
||||
if (col > (int)curwin->w_leftcol)
|
||||
}
|
||||
if (col > (int)curwin->w_leftcol) {
|
||||
col -= curwin->w_leftcol;
|
||||
else
|
||||
} else {
|
||||
col = 0;
|
||||
}
|
||||
curwin->w_wcol = col;
|
||||
|
||||
curwin->w_valid |= VALID_WCOL;
|
||||
@ -766,7 +771,7 @@ void curs_columns(
|
||||
|
||||
int textwidth = curwin->w_grid.Columns - extra;
|
||||
if (textwidth <= 0) {
|
||||
/* No room for text, put cursor in last char of window. */
|
||||
// No room for text, put cursor in last char of window.
|
||||
curwin->w_wcol = curwin->w_grid.Columns - 1;
|
||||
curwin->w_wrow = curwin->w_grid.Rows - 1;
|
||||
} else if (curwin->w_p_wrap
|
||||
@ -774,9 +779,9 @@ void curs_columns(
|
||||
) {
|
||||
width = textwidth + curwin_col_off2();
|
||||
|
||||
/* long line wrapping, adjust curwin->w_wrow */
|
||||
// long line wrapping, adjust curwin->w_wrow
|
||||
if (curwin->w_wcol >= curwin->w_grid.Columns) {
|
||||
/* this same formula is used in validate_cursor_col() */
|
||||
// this same formula is used in validate_cursor_col()
|
||||
n = (curwin->w_wcol - curwin->w_grid.Columns) / width + 1;
|
||||
curwin->w_wcol -= n * width;
|
||||
curwin->w_wrow += n;
|
||||
@ -851,9 +856,8 @@ void curs_columns(
|
||||
|| ((prev_skipcol > 0
|
||||
|| curwin->w_wrow + p_so >= curwin->w_grid.Rows)
|
||||
&& (p_lines =
|
||||
plines_win_nofill
|
||||
(curwin, curwin->w_cursor.lnum, false))
|
||||
- 1 >= curwin->w_grid.Rows))
|
||||
plines_win_nofill(curwin, curwin->w_cursor.lnum, false)) - 1
|
||||
>= curwin->w_grid.Rows))
|
||||
&& curwin->w_grid.Rows != 0
|
||||
&& curwin->w_cursor.lnum == curwin->w_topline
|
||||
&& width > 0
|
||||
@ -879,19 +883,22 @@ void curs_columns(
|
||||
}
|
||||
else
|
||||
n = p_lines;
|
||||
if ((colnr_T)n >= curwin->w_grid.Rows + curwin->w_skipcol / width)
|
||||
if ((colnr_T)n >= curwin->w_grid.Rows + curwin->w_skipcol / width) {
|
||||
extra += 2;
|
||||
}
|
||||
|
||||
if (extra == 3 || p_lines < p_so * 2) {
|
||||
/* not enough room for 'scrolloff', put cursor in the middle */
|
||||
// not enough room for 'scrolloff', put cursor in the middle
|
||||
n = curwin->w_virtcol / width;
|
||||
if (n > curwin->w_grid.Rows / 2)
|
||||
if (n > curwin->w_grid.Rows / 2) {
|
||||
n -= curwin->w_grid.Rows / 2;
|
||||
else
|
||||
} else {
|
||||
n = 0;
|
||||
/* don't skip more than necessary */
|
||||
if (n > p_lines - curwin->w_grid.Rows + 1)
|
||||
}
|
||||
// don't skip more than necessary
|
||||
if (n > p_lines - curwin->w_grid.Rows + 1) {
|
||||
n = p_lines - curwin->w_grid.Rows + 1;
|
||||
}
|
||||
curwin->w_skipcol = n * width;
|
||||
} else if (extra == 1) {
|
||||
/* less then 'scrolloff' lines above, decrease skipcol */
|
||||
@ -904,17 +911,19 @@ void curs_columns(
|
||||
curwin->w_skipcol -= extra * width;
|
||||
}
|
||||
} else if (extra == 2) {
|
||||
/* less then 'scrolloff' lines below, increase skipcol */
|
||||
// less then 'scrolloff' lines below, increase skipcol
|
||||
endcol = (n - curwin->w_grid.Rows + 1) * width;
|
||||
while (endcol > curwin->w_virtcol)
|
||||
while (endcol > curwin->w_virtcol) {
|
||||
endcol -= width;
|
||||
if (endcol > curwin->w_skipcol)
|
||||
}
|
||||
if (endcol > curwin->w_skipcol) {
|
||||
curwin->w_skipcol = endcol;
|
||||
}
|
||||
}
|
||||
|
||||
curwin->w_wrow -= curwin->w_skipcol / width;
|
||||
if (curwin->w_wrow >= curwin->w_grid.Rows) {
|
||||
/* small window, make sure cursor is in it */
|
||||
// small window, make sure cursor is in it
|
||||
extra = curwin->w_wrow - curwin->w_grid.Rows + 1;
|
||||
curwin->w_skipcol += extra * width;
|
||||
curwin->w_wrow -= extra;
|
||||
@ -958,8 +967,8 @@ scrolldown (
|
||||
while (line_count-- > 0) {
|
||||
if (curwin->w_topfill < diff_check(curwin, curwin->w_topline)
|
||||
&& curwin->w_topfill < curwin->w_grid.Rows - 1) {
|
||||
++curwin->w_topfill;
|
||||
++done;
|
||||
curwin->w_topfill++;
|
||||
done++;
|
||||
} else {
|
||||
if (curwin->w_topline == 1)
|
||||
break;
|
||||
@ -1091,8 +1100,9 @@ check_topfill (
|
||||
wp->w_topfill = 0;
|
||||
} else {
|
||||
wp->w_topfill = wp->w_grid.Rows - n;
|
||||
if (wp->w_topfill < 0)
|
||||
if (wp->w_topfill < 0) {
|
||||
wp->w_topfill = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1105,12 +1115,13 @@ check_topfill (
|
||||
static void max_topfill(void)
|
||||
{
|
||||
int n = plines_nofill(curwin->w_topline);
|
||||
if (n >= curwin->w_grid.Rows)
|
||||
if (n >= curwin->w_grid.Rows) {
|
||||
curwin->w_topfill = 0;
|
||||
else {
|
||||
} else {
|
||||
curwin->w_topfill = diff_check_fill(curwin, curwin->w_topline);
|
||||
if (curwin->w_topfill + n > curwin->w_grid.Rows)
|
||||
if (curwin->w_topfill + n > curwin->w_grid.Rows) {
|
||||
curwin->w_topfill = curwin->w_grid.Rows - n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1340,10 +1351,12 @@ void scroll_cursor_top(int min_scroll, int always)
|
||||
else
|
||||
used += plines(bot);
|
||||
}
|
||||
if (used > curwin->w_grid.Rows)
|
||||
if (used > curwin->w_grid.Rows) {
|
||||
break;
|
||||
if (top < curwin->w_topline)
|
||||
}
|
||||
if (top < curwin->w_topline) {
|
||||
scrolled += i;
|
||||
}
|
||||
|
||||
/*
|
||||
* If scrolling is needed, scroll at least 'sj' lines.
|
||||
@ -1397,9 +1410,9 @@ void scroll_cursor_top(int min_scroll, int always)
|
||||
void set_empty_rows(win_T *wp, int used)
|
||||
{
|
||||
wp->w_filler_rows = 0;
|
||||
if (used == 0)
|
||||
wp->w_empty_rows = 0; /* single line that doesn't fit */
|
||||
else {
|
||||
if (used == 0) {
|
||||
wp->w_empty_rows = 0; // single line that doesn't fit
|
||||
} else {
|
||||
wp->w_empty_rows = wp->w_grid.Rows - used;
|
||||
if (wp->w_botline <= wp->w_buffer->b_ml.ml_line_count) {
|
||||
wp->w_filler_rows = diff_check_fill(wp, wp->w_botline);
|
||||
@ -1443,8 +1456,9 @@ void scroll_cursor_bot(int min_scroll, int set_topbot)
|
||||
curwin->w_topline = loff.lnum) {
|
||||
loff.lnum = curwin->w_topline;
|
||||
topline_back(&loff);
|
||||
if (loff.height == MAXCOL || used + loff.height > curwin->w_grid.Rows)
|
||||
if (loff.height == MAXCOL || used + loff.height > curwin->w_grid.Rows) {
|
||||
break;
|
||||
}
|
||||
used += loff.height;
|
||||
curwin->w_topfill = loff.fill;
|
||||
}
|
||||
@ -1501,12 +1515,14 @@ void scroll_cursor_bot(int min_scroll, int set_topbot)
|
||||
|
||||
/* Add one line above */
|
||||
topline_back(&loff);
|
||||
if (loff.height == MAXCOL)
|
||||
if (loff.height == MAXCOL) {
|
||||
used = MAXCOL;
|
||||
else
|
||||
} else {
|
||||
used += loff.height;
|
||||
if (used > curwin->w_grid.Rows)
|
||||
}
|
||||
if (used > curwin->w_grid.Rows) {
|
||||
break;
|
||||
}
|
||||
if (loff.lnum >= curwin->w_botline
|
||||
&& (loff.lnum > curwin->w_botline
|
||||
|| loff.fill <= fill_below_window)
|
||||
@ -1523,8 +1539,9 @@ void scroll_cursor_bot(int min_scroll, int set_topbot)
|
||||
/* Add one line below */
|
||||
botline_forw(&boff);
|
||||
used += boff.height;
|
||||
if (used > curwin->w_grid.Rows)
|
||||
if (used > curwin->w_grid.Rows) {
|
||||
break;
|
||||
}
|
||||
if (extra < (
|
||||
mouse_dragging > 0 ? mouse_dragging - 1 :
|
||||
p_so) || scrolled < min_scroll) {
|
||||
@ -1545,14 +1562,14 @@ void scroll_cursor_bot(int min_scroll, int set_topbot)
|
||||
}
|
||||
|
||||
linenr_T line_count;
|
||||
/* curwin->w_empty_rows is larger, no need to scroll */
|
||||
if (scrolled <= 0)
|
||||
// curwin->w_empty_rows is larger, no need to scroll
|
||||
if (scrolled <= 0) {
|
||||
line_count = 0;
|
||||
/* more than a screenfull, don't scroll but redraw */
|
||||
else if (used > curwin->w_grid.Rows)
|
||||
// more than a screenfull, don't scroll but redraw
|
||||
} else if (used > curwin->w_grid.Rows) {
|
||||
line_count = used;
|
||||
/* scroll minimal number of lines */
|
||||
else {
|
||||
// scroll minimal number of lines
|
||||
} else {
|
||||
line_count = 0;
|
||||
boff.fill = curwin->w_topfill;
|
||||
boff.lnum = curwin->w_topline - 1;
|
||||
@ -1570,10 +1587,11 @@ void scroll_cursor_bot(int min_scroll, int 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 >= curwin->w_grid.Rows && line_count > min_scroll)
|
||||
if (line_count >= curwin->w_grid.Rows && line_count > min_scroll) {
|
||||
scroll_cursor_halfway(false);
|
||||
else
|
||||
} else {
|
||||
scrollup(line_count, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* If topline didn't change we need to restore w_botline and w_empty_rows
|
||||
@ -1612,8 +1630,9 @@ void scroll_cursor_halfway(int atend)
|
||||
if (boff.lnum < curbuf->b_ml.ml_line_count) {
|
||||
botline_forw(&boff);
|
||||
used += boff.height;
|
||||
if (used > curwin->w_grid.Rows)
|
||||
if (used > curwin->w_grid.Rows) {
|
||||
break;
|
||||
}
|
||||
below += boff.height;
|
||||
} else {
|
||||
++below; /* count a "~" line */
|
||||
@ -1628,8 +1647,9 @@ void scroll_cursor_halfway(int atend)
|
||||
used = MAXCOL;
|
||||
else
|
||||
used += loff.height;
|
||||
if (used > curwin->w_grid.Rows)
|
||||
if (used > curwin->w_grid.Rows) {
|
||||
break;
|
||||
}
|
||||
above += loff.height;
|
||||
topline = loff.lnum;
|
||||
topfill = loff.fill;
|
||||
@ -1638,8 +1658,9 @@ void scroll_cursor_halfway(int atend)
|
||||
if (!hasFolding(topline, &curwin->w_topline, NULL))
|
||||
curwin->w_topline = topline;
|
||||
curwin->w_topfill = topfill;
|
||||
if (old_topline > curwin->w_topline + curwin->w_grid.Rows)
|
||||
if (old_topline > curwin->w_topline + curwin->w_grid.Rows) {
|
||||
curwin->w_botfill = false;
|
||||
}
|
||||
check_topfill(curwin, false);
|
||||
curwin->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE|VALID_BOTLINE_AP);
|
||||
curwin->w_valid |= VALID_TOPLINE;
|
||||
@ -1667,8 +1688,9 @@ void cursor_correct(void)
|
||||
if (curwin->w_topline == 1) {
|
||||
above_wanted = 0;
|
||||
int max_off = curwin->w_grid.Rows / 2;
|
||||
if (below_wanted > max_off)
|
||||
if (below_wanted > max_off) {
|
||||
below_wanted = max_off;
|
||||
}
|
||||
}
|
||||
validate_botline();
|
||||
if (curwin->w_botline == curbuf->b_ml.ml_line_count + 1
|
||||
@ -1676,8 +1698,9 @@ void cursor_correct(void)
|
||||
) {
|
||||
below_wanted = 0;
|
||||
int max_off = (curwin->w_grid.Rows - 1) / 2;
|
||||
if (above_wanted > max_off)
|
||||
if (above_wanted > max_off) {
|
||||
above_wanted = max_off;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1993,9 +2016,10 @@ void halfpage(bool flag, linenr_T Prenum)
|
||||
long scrolled = 0;
|
||||
int i;
|
||||
|
||||
if (Prenum)
|
||||
curwin->w_p_scr = (Prenum > curwin->w_grid.Rows) ?
|
||||
curwin->w_grid.Rows : Prenum;
|
||||
if (Prenum) {
|
||||
curwin->w_p_scr = (Prenum > curwin->w_grid.Rows) ? curwin->w_grid.Rows
|
||||
: Prenum;
|
||||
}
|
||||
assert(curwin->w_p_scr <= INT_MAX);
|
||||
int n = curwin->w_p_scr <= curwin->w_grid.Rows ? (int)curwin->w_p_scr
|
||||
: curwin->w_grid.Rows;
|
||||
|
@ -3478,7 +3478,7 @@ static void display_showcmd(void)
|
||||
* spaces
|
||||
*/
|
||||
grid_puts(&default_grid, (char_u *)" " + len, (int)Rows - 1,
|
||||
sc_col + len, 0);
|
||||
sc_col + len, 0);
|
||||
|
||||
setcursor(); /* put cursor back where it belongs */
|
||||
}
|
||||
@ -3914,10 +3914,8 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist)
|
||||
}
|
||||
|
||||
if (curwin->w_grid.Columns != 0) {
|
||||
/*
|
||||
* Instead of sticking at the last character of the buffer line we
|
||||
* try to stick in the last column of the screen.
|
||||
*/
|
||||
// Instead of sticking at the last character of the buffer line we
|
||||
// try to stick in the last column of the screen.
|
||||
if (curwin->w_curswant == MAXCOL) {
|
||||
atend = true;
|
||||
validate_virtcol();
|
||||
@ -4271,7 +4269,7 @@ dozet:
|
||||
}
|
||||
break;
|
||||
|
||||
/* "zL" - scroll screen left half-page */
|
||||
// "zL" - scroll screen left half-page
|
||||
case 'L': cap->count1 *= curwin->w_grid.Columns / 2;
|
||||
FALLTHROUGH;
|
||||
|
||||
@ -4309,10 +4307,11 @@ dozet:
|
||||
else
|
||||
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col);
|
||||
n = curwin->w_grid.Columns - curwin_col_off();
|
||||
if (col + l_p_siso < n)
|
||||
if (col + l_p_siso < n) {
|
||||
col = 0;
|
||||
else
|
||||
} else {
|
||||
col = col + l_p_siso - n + 1;
|
||||
}
|
||||
if (curwin->w_leftcol != col) {
|
||||
curwin->w_leftcol = col;
|
||||
redraw_later(NOT_VALID);
|
||||
@ -5017,11 +5016,11 @@ static void nv_scroll(cmdarg_T *cap)
|
||||
/* Don't count filler lines above the window. */
|
||||
used -= diff_check_fill(curwin, curwin->w_topline)
|
||||
- curwin->w_topfill;
|
||||
validate_botline(); /* make sure w_empty_rows is valid */
|
||||
validate_botline(); // make sure w_empty_rows is valid
|
||||
half = (curwin->w_grid.Rows - curwin->w_empty_rows + 1) / 2;
|
||||
for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; ++n) {
|
||||
/* Count half he number of filler lines to be "below this
|
||||
* line" and half to be "above the next line". */
|
||||
for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; n++) {
|
||||
// Count half he number of filler lines to be "below this
|
||||
// line" and half to be "above the next line".
|
||||
if (n > 0 && used + diff_check_fill(curwin, curwin->w_topline
|
||||
+ n) / 2 >= half) {
|
||||
--n;
|
||||
@ -5033,9 +5032,10 @@ static void nv_scroll(cmdarg_T *cap)
|
||||
if (hasFolding(curwin->w_topline + n, NULL, &lnum))
|
||||
n = lnum - curwin->w_topline;
|
||||
}
|
||||
if (n > 0 && used > curwin->w_grid.Rows)
|
||||
--n;
|
||||
} else { /* (cap->cmdchar == 'H') */
|
||||
if (n > 0 && used > curwin->w_grid.Rows) {
|
||||
n--;
|
||||
}
|
||||
} else { // (cap->cmdchar == 'H')
|
||||
n = cap->count1 - 1;
|
||||
if (hasAnyFolding(curwin)) {
|
||||
/* Count a fold for one screen line. */
|
||||
@ -6762,10 +6762,11 @@ static void nv_g_cmd(cmdarg_T *cap)
|
||||
/* Go to the middle of the screen line. When 'number' or
|
||||
* 'relativenumber' is on and lines are wrapping the middle can be more
|
||||
* to the left. */
|
||||
if (cap->nchar == 'm')
|
||||
if (cap->nchar == 'm') {
|
||||
i += (curwin->w_grid.Columns - curwin_col_off()
|
||||
+ ((curwin->w_p_wrap && i > 0)
|
||||
? curwin_col_off2() : 0)) / 2;
|
||||
}
|
||||
coladvance((colnr_T)i);
|
||||
if (flag) {
|
||||
do
|
||||
|
@ -423,8 +423,8 @@ void pum_redraw(void)
|
||||
size++;
|
||||
}
|
||||
}
|
||||
grid_puts_len(&default_grid, rt, (int)STRLEN(rt), row, col - size + 1,
|
||||
attr);
|
||||
grid_puts_len(&default_grid, rt, (int)STRLEN(rt), row,
|
||||
col - size + 1, attr);
|
||||
xfree(rt_start);
|
||||
xfree(st);
|
||||
col -= width;
|
||||
@ -440,7 +440,8 @@ void pum_redraw(void)
|
||||
|
||||
// Display two spaces for a Tab.
|
||||
if (curwin->w_p_rl) {
|
||||
grid_puts_len(&default_grid, (char_u *)" ", 2, row, col - 1, attr);
|
||||
grid_puts_len(&default_grid, (char_u *)" ", 2, row, col - 1,
|
||||
attr);
|
||||
col -= 2;
|
||||
} else {
|
||||
grid_puts_len(&default_grid, (char_u *)" ", 2, row, col, attr);
|
||||
@ -475,32 +476,33 @@ void pum_redraw(void)
|
||||
|
||||
if (curwin->w_p_rl) {
|
||||
grid_fill(&default_grid, row, row + 1, pum_col - pum_base_width - n + 1,
|
||||
col + 1, ' ', ' ', attr);
|
||||
col + 1, ' ', ' ', attr);
|
||||
col = pum_col - pum_base_width - n + 1;
|
||||
} else {
|
||||
grid_fill(&default_grid, row, row + 1, col, pum_col + pum_base_width + n,
|
||||
' ', ' ', attr);
|
||||
grid_fill(&default_grid, row, row + 1, col,
|
||||
pum_col + pum_base_width + n, ' ', ' ', attr);
|
||||
col = pum_col + pum_base_width + n;
|
||||
}
|
||||
totwidth = pum_base_width + n;
|
||||
}
|
||||
|
||||
if (curwin->w_p_rl) {
|
||||
grid_fill(&default_grid, row, row + 1, pum_col - pum_width + 1, col + 1, ' ', ' ',
|
||||
attr);
|
||||
grid_fill(&default_grid, row, row + 1, pum_col - pum_width + 1, col + 1,
|
||||
' ', ' ', attr);
|
||||
} else {
|
||||
grid_fill(&default_grid, row, row + 1, col, pum_col + pum_width, ' ', ' ', attr);
|
||||
grid_fill(&default_grid, row, row + 1, col, pum_col + pum_width, ' ', ' ',
|
||||
attr);
|
||||
}
|
||||
|
||||
if (pum_scrollbar > 0) {
|
||||
if (curwin->w_p_rl) {
|
||||
grid_putchar(&default_grid, ' ', row, pum_col - pum_width,
|
||||
i >= thumb_pos && i < thumb_pos + thumb_heigth
|
||||
? attr_thumb : attr_scroll);
|
||||
i >= thumb_pos && i < thumb_pos + thumb_heigth
|
||||
? attr_thumb : attr_scroll);
|
||||
} else {
|
||||
grid_putchar(&default_grid, ' ', row, pum_col + pum_width,
|
||||
i >= thumb_pos && i < thumb_pos + thumb_heigth
|
||||
? attr_thumb : attr_scroll);
|
||||
i >= thumb_pos && i < thumb_pos + thumb_heigth
|
||||
? attr_thumb : attr_scroll);
|
||||
}
|
||||
}
|
||||
grid_puts_line_flush(&default_grid, false);
|
||||
|
@ -686,15 +686,15 @@ static void win_update(win_T *wp)
|
||||
wp->w_lines_valid = 0;
|
||||
}
|
||||
|
||||
/* Window is zero-height: nothing to draw. */
|
||||
// Window is zero-height: nothing to draw.
|
||||
if (wp->w_grid.Rows == 0) {
|
||||
wp->w_redr_type = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Window is zero-width: Only need to draw the separator. */
|
||||
// Window is zero-width: Only need to draw the separator.
|
||||
if (wp->w_grid.Columns == 0) {
|
||||
/* draw the vertical separator right of this window */
|
||||
// draw the vertical separator right of this window
|
||||
draw_vsep_win(wp, 0);
|
||||
wp->w_redr_type = 0;
|
||||
return;
|
||||
@ -882,15 +882,16 @@ static void win_update(win_T *wp)
|
||||
/* count the number of lines we are off, counting a sequence
|
||||
* of folded lines as one */
|
||||
j = 0;
|
||||
for (ln = wp->w_topline; ln < wp->w_lines[0].wl_lnum; ++ln) {
|
||||
++j;
|
||||
if (j >= wp->w_grid.Rows - 2)
|
||||
for (ln = wp->w_topline; ln < wp->w_lines[0].wl_lnum; ln++) {
|
||||
j++;
|
||||
if (j >= wp->w_grid.Rows - 2) {
|
||||
break;
|
||||
}
|
||||
(void)hasFoldingWin(wp, ln, NULL, &ln, true, NULL);
|
||||
}
|
||||
} else
|
||||
j = wp->w_lines[0].wl_lnum - wp->w_topline;
|
||||
if (j < wp->w_grid.Rows - 2) { /* not too far off */
|
||||
if (j < wp->w_grid.Rows - 2) { // not too far off
|
||||
i = plines_m_win(wp, wp->w_topline, wp->w_lines[0].wl_lnum - 1);
|
||||
/* insert extra lines for previously invisible filler lines */
|
||||
if (wp->w_lines[0].wl_lnum != wp->w_topline)
|
||||
@ -909,12 +910,15 @@ 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 += j) > wp->w_grid.Rows)
|
||||
if ((wp->w_lines_valid += j) > wp->w_grid.Rows) {
|
||||
wp->w_lines_valid = wp->w_grid.Rows;
|
||||
for (idx = wp->w_lines_valid; idx - j >= 0; idx--)
|
||||
}
|
||||
for (idx = wp->w_lines_valid; idx - j >= 0; idx--) {
|
||||
wp->w_lines[idx] = wp->w_lines[idx - j];
|
||||
while (idx >= 0)
|
||||
wp->w_lines[idx--].wl_valid = FALSE;
|
||||
}
|
||||
while (idx >= 0) {
|
||||
wp->w_lines[idx--].wl_valid = false;
|
||||
}
|
||||
}
|
||||
} else
|
||||
mid_start = 0; /* redraw all lines */
|
||||
@ -1159,7 +1163,7 @@ static void win_update(win_T *wp)
|
||||
}
|
||||
srow += mid_start;
|
||||
mid_end = wp->w_grid.Rows;
|
||||
for (; idx < wp->w_lines_valid; ++idx) { /* find end */
|
||||
for (; idx < wp->w_lines_valid; idx++) { // find end
|
||||
if (wp->w_lines[idx].wl_valid
|
||||
&& wp->w_lines[idx].wl_lnum >= to + 1) {
|
||||
/* Only update until first row of this line */
|
||||
@ -1200,7 +1204,7 @@ static void win_update(win_T *wp)
|
||||
/* 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) {
|
||||
didline = TRUE;
|
||||
didline = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1299,7 +1303,7 @@ static void win_update(win_T *wp)
|
||||
}
|
||||
j++;
|
||||
if (new_rows > wp->w_grid.Rows - row - 2) {
|
||||
/* it's getting too much, must redraw the rest */
|
||||
// it's getting too much, must redraw the rest
|
||||
new_rows = 9999;
|
||||
break;
|
||||
}
|
||||
@ -1365,10 +1369,12 @@ static void win_update(win_T *wp)
|
||||
/* move entries in w_lines[] downwards */
|
||||
j -= i;
|
||||
wp->w_lines_valid += j;
|
||||
if (wp->w_lines_valid > wp->w_grid.Rows)
|
||||
if (wp->w_lines_valid > wp->w_grid.Rows) {
|
||||
wp->w_lines_valid = wp->w_grid.Rows;
|
||||
for (i = wp->w_lines_valid; i - j >= idx; --i)
|
||||
}
|
||||
for (i = wp->w_lines_valid; i - j >= idx; i--) {
|
||||
wp->w_lines[i] = wp->w_lines[i - j];
|
||||
}
|
||||
|
||||
/* The w_lines[] entries for inserted lines are
|
||||
* now invalid, but wl_size may be used above.
|
||||
@ -1448,8 +1454,9 @@ static void win_update(win_T *wp)
|
||||
|
||||
// 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_grid.Rows) { // past end of screen
|
||||
break;
|
||||
}
|
||||
lnum = wp->w_lines[idx - 1].wl_lastlnum + 1;
|
||||
did_update = DID_NONE;
|
||||
}
|
||||
@ -1489,7 +1496,7 @@ static void win_update(win_T *wp)
|
||||
*/
|
||||
wp->w_botline = lnum + 1;
|
||||
} else if (diff_check_fill(wp, lnum) >= wp->w_grid.Rows - srow) {
|
||||
/* Window ends in filler lines. */
|
||||
// Window ends in filler lines.
|
||||
wp->w_botline = lnum;
|
||||
wp->w_filler_rows = wp->w_grid.Rows - srow;
|
||||
} else if (dy_flags & DY_TRUNCATE) { // 'display' has "truncate"
|
||||
@ -1524,8 +1531,9 @@ static void win_update(win_T *wp)
|
||||
i = '-';
|
||||
else
|
||||
i = fill_diff;
|
||||
if (row + j > wp->w_grid.Rows)
|
||||
if (row + j > wp->w_grid.Rows) {
|
||||
j = wp->w_grid.Rows - row;
|
||||
}
|
||||
win_draw_end(wp, i, i, row, row + (int)j, HLF_DED);
|
||||
row += j;
|
||||
}
|
||||
@ -1613,9 +1621,10 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
|
||||
n = fdc;
|
||||
|
||||
if (n > 0) {
|
||||
/* draw the fold column at the right */
|
||||
if (n > wp->w_grid.Columns)
|
||||
// draw the fold column at the right
|
||||
if (n > wp->w_grid.Columns) {
|
||||
n = wp->w_grid.Columns;
|
||||
}
|
||||
grid_fill(&wp->w_grid, row, endrow, wp->w_grid.Columns - n,
|
||||
wp->w_grid.Columns, ' ', ' ', win_hl_attr(wp, HLF_FC));
|
||||
}
|
||||
@ -1623,7 +1632,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
|
||||
if (signcolumn_on(wp)) {
|
||||
int nn = n + win_signcol_width(wp);
|
||||
|
||||
/* draw the sign column left of the fold column */
|
||||
// draw the sign column left of the fold column
|
||||
if (nn > wp->w_grid.Columns) {
|
||||
nn = wp->w_grid.Columns;
|
||||
}
|
||||
@ -1641,17 +1650,19 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
|
||||
if (cmdwin_type != 0 && wp == curwin) {
|
||||
/* draw the cmdline character in the leftmost column */
|
||||
n = 1;
|
||||
if (n > wp->w_grid.Columns)
|
||||
if (n > wp->w_grid.Columns) {
|
||||
n = wp->w_grid.Columns;
|
||||
}
|
||||
grid_fill(&wp->w_grid, row, endrow, 0, n, cmdwin_type, ' ',
|
||||
win_hl_attr(wp, HLF_AT));
|
||||
}
|
||||
if (fdc > 0) {
|
||||
int nn = n + fdc;
|
||||
|
||||
/* draw the fold column at the left */
|
||||
if (nn > wp->w_grid.Columns)
|
||||
// draw the fold column at the left
|
||||
if (nn > wp->w_grid.Columns) {
|
||||
nn = wp->w_grid.Columns;
|
||||
}
|
||||
grid_fill(&wp->w_grid, row, endrow, n, nn, ' ', ' ',
|
||||
win_hl_attr(wp, HLF_FC));
|
||||
n = nn;
|
||||
@ -1660,7 +1671,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
|
||||
if (signcolumn_on(wp)) {
|
||||
int nn = n + win_signcol_width(wp);
|
||||
|
||||
/* draw the sign column after the fold column */
|
||||
// draw the sign column after the fold column
|
||||
if (nn > wp->w_grid.Columns) {
|
||||
nn = wp->w_grid.Columns;
|
||||
}
|
||||
@ -1669,7 +1680,8 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
|
||||
n = nn;
|
||||
}
|
||||
|
||||
grid_fill(&wp->w_grid, row, endrow, FDC_OFF, wp->w_grid.Columns, c1, c2, attr);
|
||||
grid_fill(&wp->w_grid, row, endrow, FDC_OFF, wp->w_grid.Columns, c1, c2,
|
||||
attr);
|
||||
}
|
||||
set_empty_rows(wp, row);
|
||||
}
|
||||
@ -1798,7 +1810,8 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
|
||||
win_hl_attr(wp, HLF_FC));
|
||||
// reverse the fold column
|
||||
for (i = 0; i < fdc; i++) {
|
||||
schar_from_ascii(linebuf_char[off + wp->w_grid.Columns - i - 1 - col], buf[i]);
|
||||
schar_from_ascii(linebuf_char[off + wp->w_grid.Columns - i - 1 - col],
|
||||
buf[i]);
|
||||
}
|
||||
} else {
|
||||
copy_text_attr(off + col, buf, fdc, win_hl_attr(wp, HLF_FC));
|
||||
@ -1806,12 +1819,15 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
|
||||
col += fdc;
|
||||
}
|
||||
|
||||
# define RL_MEMSET(p, v, l) if (wp->w_p_rl) \
|
||||
for (ri = 0; ri < l; ++ri) \
|
||||
# define RL_MEMSET(p, v, l) if (wp->w_p_rl) { \
|
||||
for (ri = 0; ri < l; ri++) { \
|
||||
linebuf_attr[off + (wp->w_grid.Columns - (p) - (l)) + ri] = v; \
|
||||
else \
|
||||
for (ri = 0; ri < l; ++ri) \
|
||||
linebuf_attr[off + (p) + ri] = v
|
||||
} \
|
||||
} else { \
|
||||
for (ri = 0; ri < l; ri++) { \
|
||||
linebuf_attr[off + (p) + ri] = v; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Set all attributes of the 'number' or 'relativenumber' column and the
|
||||
* text */
|
||||
@ -1945,14 +1961,15 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
|
||||
>= (colnr_T)STRLEN(ml_get_buf(wp->w_buffer, lnume,
|
||||
FALSE))))))) {
|
||||
if (VIsual_mode == Ctrl_V) {
|
||||
/* Visual block mode: highlight the chars part of the block */
|
||||
// Visual block mode: highlight the chars part of the block
|
||||
if (wp->w_old_cursor_fcol + txtcol < (colnr_T)wp->w_grid.Columns) {
|
||||
if (wp->w_old_cursor_lcol != MAXCOL
|
||||
&& wp->w_old_cursor_lcol + txtcol
|
||||
< (colnr_T)wp->w_grid.Columns)
|
||||
< (colnr_T)wp->w_grid.Columns) {
|
||||
len = wp->w_old_cursor_lcol;
|
||||
else
|
||||
} else {
|
||||
len = wp->w_grid.Columns - txtcol;
|
||||
}
|
||||
RL_MEMSET(wp->w_old_cursor_fcol + txtcol, win_hl_attr(wp, HLF_V),
|
||||
len - (int)wp->w_old_cursor_fcol);
|
||||
}
|
||||
@ -2854,10 +2871,11 @@ win_line (
|
||||
c_extra = '-';
|
||||
else
|
||||
c_extra = fill_diff;
|
||||
if (wp->w_p_rl)
|
||||
if (wp->w_p_rl) {
|
||||
n_extra = col + 1;
|
||||
else
|
||||
} else {
|
||||
n_extra = grid->Columns - col;
|
||||
}
|
||||
char_attr = win_hl_attr(wp, HLF_DED);
|
||||
}
|
||||
if (*p_sbr != NUL && need_showbreak) {
|
||||
@ -3126,9 +3144,8 @@ win_line (
|
||||
|
||||
/* If a double-width char doesn't fit display a '>' in the
|
||||
* last column. */
|
||||
if ((
|
||||
wp->w_p_rl ? (col <= 0) :
|
||||
(col >= grid->Columns - 1))
|
||||
if ((wp->w_p_rl ? (col <= 0) :
|
||||
(col >= grid->Columns - 1))
|
||||
&& (*mb_char2cells)(mb_c) == 2) {
|
||||
c = '>';
|
||||
mb_c = c;
|
||||
@ -3268,9 +3285,8 @@ win_line (
|
||||
/* 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 ((
|
||||
wp->w_p_rl ? (col <= 0) :
|
||||
(col >= grid->Columns - 1))
|
||||
if ((wp->w_p_rl ? (col <= 0) :
|
||||
(col >= grid->Columns - 1))
|
||||
&& (*mb_char2cells)(mb_c) == 2) {
|
||||
c = '>';
|
||||
mb_c = c;
|
||||
@ -3601,9 +3617,7 @@ win_line (
|
||||
|| ((fromcol >= 0 || fromcol_prev >= 0)
|
||||
&& tocol > vcol
|
||||
&& VIsual_mode != Ctrl_V
|
||||
&& (
|
||||
wp->w_p_rl ? (col >= 0) :
|
||||
(col < grid->Columns))
|
||||
&& (wp->w_p_rl ? (col >= 0) : (col < grid->Columns))
|
||||
&& !(noinvcur
|
||||
&& lnum == wp->w_cursor.lnum
|
||||
&& (colnr_T)vcol == wp->w_virtcol)))
|
||||
@ -3668,14 +3682,11 @@ win_line (
|
||||
saved_attr2 = char_attr; // save current attr
|
||||
mb_utf8 = false; // don't draw as UTF-8
|
||||
} else if (VIsual_active
|
||||
&& (VIsual_mode == Ctrl_V
|
||||
|| VIsual_mode == 'v')
|
||||
&& (VIsual_mode == Ctrl_V || VIsual_mode == 'v')
|
||||
&& virtual_active()
|
||||
&& tocol != MAXCOL
|
||||
&& vcol < tocol
|
||||
&& (
|
||||
wp->w_p_rl ? (col >= 0) :
|
||||
(col < grid->Columns))) {
|
||||
&& (wp->w_p_rl ? (col >= 0) : (col < grid->Columns))) {
|
||||
c = ' ';
|
||||
ptr--; // put it back at the NUL
|
||||
}
|
||||
@ -3833,8 +3844,9 @@ win_line (
|
||||
if (col < 0)
|
||||
n = 1;
|
||||
} else {
|
||||
if (col >= grid->Columns)
|
||||
if (col >= grid->Columns) {
|
||||
n = -1;
|
||||
}
|
||||
}
|
||||
if (n != 0) {
|
||||
/* At the window boundary, highlight the last character
|
||||
@ -4023,7 +4035,7 @@ win_line (
|
||||
}
|
||||
}
|
||||
grid_put_linebuf(grid, row, 0, col, grid->Columns, wp->w_p_rl, wp,
|
||||
wp->w_hl_attr_normal, false);
|
||||
wp->w_hl_attr_normal, false);
|
||||
row++;
|
||||
|
||||
/*
|
||||
@ -4044,9 +4056,7 @@ win_line (
|
||||
if (lcs_ext
|
||||
&& !wp->w_p_wrap
|
||||
&& filler_todo <= 0
|
||||
&& (
|
||||
wp->w_p_rl ? col == 0 :
|
||||
col == grid->Columns - 1)
|
||||
&& (wp->w_p_rl ? col == 0 : col == grid->Columns - 1)
|
||||
&& (*ptr != NUL
|
||||
|| (wp->w_p_list && lcs_eol_one > 0)
|
||||
|| (n_extra && (c_extra != NUL || *p_extra != NUL)))) {
|
||||
@ -4225,9 +4235,7 @@ win_line (
|
||||
* 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 ((
|
||||
wp->w_p_rl ? (col < 0) :
|
||||
(col >= grid->Columns))
|
||||
if ((wp->w_p_rl ? (col < 0) : (col >= grid->Columns))
|
||||
&& (*ptr != NUL
|
||||
|| filler_todo > 0
|
||||
|| (wp->w_p_list && lcs_eol != NUL && p_extra != at_end_str)
|
||||
@ -4260,7 +4268,7 @@ win_line (
|
||||
}
|
||||
|
||||
boguscols = 0;
|
||||
++row;
|
||||
row++;
|
||||
|
||||
/* When not wrapping and finished diff lines, or when displayed
|
||||
* '$' and highlighting until last column, break here. */
|
||||
@ -4286,7 +4294,7 @@ win_line (
|
||||
col = 0;
|
||||
off = 0;
|
||||
if (wp->w_p_rl) {
|
||||
col = grid->Columns - 1; /* col is not used if breaking! */
|
||||
col = grid->Columns - 1; // col is not used if breaking!
|
||||
off += col;
|
||||
}
|
||||
|
||||
@ -4366,15 +4374,13 @@ static void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol,
|
||||
// 2: occupies two display cells
|
||||
int start_dirty = -1, end_dirty = 0;
|
||||
|
||||
if (grid == NULL) {
|
||||
grid = &default_grid;
|
||||
}
|
||||
|
||||
/* Check for illegal row and col, just in case. */
|
||||
if (row >= grid->Rows)
|
||||
// Check for illegal row and col, just in case
|
||||
if (row >= grid->Rows) {
|
||||
row = grid->Rows - 1;
|
||||
if (endcol > grid->Columns)
|
||||
}
|
||||
if (endcol > grid->Columns) {
|
||||
endcol = grid->Columns;
|
||||
}
|
||||
|
||||
// If UI is not externalized, merge the contents of global and window grids
|
||||
if (!ui_is_external(kUIMultigrid) && grid != &default_grid) {
|
||||
@ -4690,7 +4696,8 @@ win_redr_status_matches (
|
||||
if (matches == NULL) /* interrupted completion? */
|
||||
return;
|
||||
|
||||
buf = xmalloc(has_mbyte ? default_grid.Columns * MB_MAXBYTES + 1 : default_grid.Columns + 1);
|
||||
buf = xmalloc(has_mbyte ? default_grid.Columns * MB_MAXBYTES + 1
|
||||
: default_grid.Columns + 1);
|
||||
|
||||
if (match == -1) { /* don't show match but original text */
|
||||
match = 0;
|
||||
@ -4710,15 +4717,16 @@ win_redr_status_matches (
|
||||
clen += status_match_len(xp, L_MATCH(i)) + 2;
|
||||
if (first_match > 0)
|
||||
clen += 2;
|
||||
/* jumping right, put match at the left */
|
||||
// jumping right, put match at the left
|
||||
if ((long)clen > default_grid.Columns) {
|
||||
first_match = match;
|
||||
/* if showing the last match, we can add some on the left */
|
||||
clen = 2;
|
||||
for (i = match; i < num_matches; ++i) {
|
||||
clen += status_match_len(xp, L_MATCH(i)) + 2;
|
||||
if ((long)clen >= default_grid.Columns)
|
||||
if ((long)clen >= default_grid.Columns) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == num_matches)
|
||||
add_left = TRUE;
|
||||
@ -4727,9 +4735,10 @@ win_redr_status_matches (
|
||||
if (add_left)
|
||||
while (first_match > 0) {
|
||||
clen += status_match_len(xp, L_MATCH(first_match - 1)) + 2;
|
||||
if ((long)clen >= default_grid.Columns)
|
||||
if ((long)clen >= default_grid.Columns) {
|
||||
break;
|
||||
--first_match;
|
||||
}
|
||||
first_match--;
|
||||
}
|
||||
|
||||
fillchar = fillchar_status(&attr, curwin);
|
||||
@ -4744,7 +4753,8 @@ win_redr_status_matches (
|
||||
clen = len;
|
||||
|
||||
i = first_match;
|
||||
while ((long)(clen + status_match_len(xp, L_MATCH(i)) + 2) < default_grid.Columns) {
|
||||
while ((long)(clen + status_match_len(xp, L_MATCH(i)) + 2)
|
||||
< default_grid.Columns) {
|
||||
if (i == match) {
|
||||
selstart = buf + len;
|
||||
selstart_col = clen;
|
||||
@ -5109,12 +5119,13 @@ win_redr_custom (
|
||||
stl = p_ruf;
|
||||
}
|
||||
col = ru_col - (default_grid.Columns - wp->w_width);
|
||||
if (col < (wp->w_width + 1) / 2)
|
||||
if (col < (wp->w_width + 1) / 2) {
|
||||
col = (wp->w_width + 1) / 2;
|
||||
}
|
||||
maxwidth = wp->w_width - col;
|
||||
if (!wp->w_status_height) {
|
||||
row = default_grid.Rows - 1;
|
||||
--maxwidth; /* writing in last column may cause scrolling */
|
||||
maxwidth--; // writing in last column may cause scrolling
|
||||
fillchar = ' ';
|
||||
attr = 0;
|
||||
}
|
||||
@ -5186,7 +5197,8 @@ win_redr_custom (
|
||||
curattr = highlight_user[hltab[n].userhl - 1];
|
||||
}
|
||||
// Make sure to use an empty string instead of p, if p is beyond buf + len.
|
||||
grid_puts(&default_grid, p >= buf + len ? (char_u *)"" : p, row, col, curattr);
|
||||
grid_puts(&default_grid, p >= buf + len ? (char_u *)"" : p, row, col,
|
||||
curattr);
|
||||
|
||||
grid_puts_line_flush(&default_grid, false);
|
||||
|
||||
@ -5318,7 +5330,7 @@ void grid_putchar(ScreenGrid *grid, int c, int row, int col, int attr)
|
||||
/// get a single character directly from grid.ScreenLines into "bytes[]".
|
||||
/// Also return its attribute in *attrp;
|
||||
void grid_getbytes(ScreenGrid *grid, int row, int col, char_u *bytes,
|
||||
int *attrp)
|
||||
int *attrp)
|
||||
{
|
||||
unsigned off;
|
||||
|
||||
@ -5383,10 +5395,6 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row,
|
||||
int need_redraw;
|
||||
bool do_flush = false;
|
||||
|
||||
if (grid == NULL) {
|
||||
grid = &default_grid;
|
||||
}
|
||||
|
||||
// If UI is not externalized, keep working on the default grid
|
||||
if (!ui_is_external(kUIMultigrid) && grid != &default_grid) {
|
||||
row += grid->OffsetRow;
|
||||
@ -5536,7 +5544,7 @@ void grid_puts_line_flush(ScreenGrid *grid, bool set_cursor)
|
||||
ui_grid_cursor_goto(grid, put_dirty_row, put_dirty_last);
|
||||
}
|
||||
ui_line(grid, put_dirty_row, put_dirty_first, put_dirty_last,
|
||||
put_dirty_last, 0, false);
|
||||
put_dirty_last, 0, false);
|
||||
put_dirty_first = -1;
|
||||
put_dirty_last = 0;
|
||||
}
|
||||
@ -5843,14 +5851,10 @@ next_search_hl_pos(
|
||||
/// with character 'c1' in first column followed by 'c2' in the other columns.
|
||||
/// Use attributes 'attr'.
|
||||
void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
|
||||
int end_col, int c1, int c2, int attr)
|
||||
int end_col, int c1, int c2, int attr)
|
||||
{
|
||||
schar_T sc;
|
||||
|
||||
if (grid == NULL) {
|
||||
grid = &default_grid;
|
||||
}
|
||||
|
||||
// if grids are not externalized, keep working on the default_grid
|
||||
if (!ui_is_external(kUIMultigrid) && grid != &default_grid) {
|
||||
start_row += grid->OffsetRow;
|
||||
@ -5860,14 +5864,20 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
|
||||
grid = &default_grid;
|
||||
}
|
||||
|
||||
if (end_row > grid->Rows) // safety check
|
||||
// safety check
|
||||
if (end_row > grid->Rows) {
|
||||
end_row = grid->Rows;
|
||||
if (end_col > grid->Columns) // safety check
|
||||
}
|
||||
if (end_col > grid->Columns) {
|
||||
end_col = grid->Columns;
|
||||
}
|
||||
|
||||
// nothing to do
|
||||
if (grid->ScreenLines == NULL
|
||||
|| start_row >= end_row
|
||||
|| start_col >= end_col) /* nothing to do */
|
||||
|| start_col >= end_col) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int row = start_row; row < end_row; row++) {
|
||||
if (has_mbyte) {
|
||||
@ -5966,7 +5976,7 @@ void check_for_delay(int check_msg_scroll)
|
||||
*/
|
||||
int screen_valid(int doclear)
|
||||
{
|
||||
screenalloc(doclear); /* allocate screen buffers if size changed */
|
||||
screenalloc(doclear); // allocate screen buffers if size changed
|
||||
return default_grid.ScreenLines != NULL;
|
||||
}
|
||||
|
||||
@ -6244,11 +6254,11 @@ static void screenclear2(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/* blank out ScreenLines */
|
||||
for (i = 0; i < default_grid.Rows; ++i) {
|
||||
// blank out ScreenLines
|
||||
for (i = 0; i < default_grid.Rows; i++) {
|
||||
grid_clear_line(&default_grid, default_grid.LineOffset[i],
|
||||
(int)default_grid.Columns, true);
|
||||
default_grid.LineWraps[i] = FALSE;
|
||||
default_grid.LineWraps[i] = false;
|
||||
}
|
||||
|
||||
ui_call_grid_clear(1); // clear the display
|
||||
@ -6334,7 +6344,7 @@ static int win_do_lines(win_T *wp, int row, int line_count, int del)
|
||||
}
|
||||
|
||||
// No lines are being moved, just draw over the entire area
|
||||
if (row + line_count >= wp->w_height) {
|
||||
if (row + line_count >= wp->w_grid.Rows) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -6372,17 +6382,13 @@ static int win_do_lines(win_T *wp, int row, int line_count, int del)
|
||||
/// 'row', 'col' and 'end' are relative to the start of the region.
|
||||
///
|
||||
/// @return FAIL for failure, OK for success.
|
||||
int grid_ins_lines(ScreenGrid *grid, int row, int line_count, int end,
|
||||
int col, int width)
|
||||
int grid_ins_lines(ScreenGrid *grid, int row, int line_count, int end, int col,
|
||||
int width)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
unsigned temp;
|
||||
|
||||
if (grid == NULL) {
|
||||
grid = &default_grid;
|
||||
}
|
||||
|
||||
// If UI is not externalized, keep working on default grid
|
||||
if (!ui_is_external(kUIMultigrid) && grid != &default_grid) {
|
||||
row += grid->OffsetRow;
|
||||
@ -6431,17 +6437,13 @@ int grid_ins_lines(ScreenGrid *grid, int row, int line_count, int end,
|
||||
/// 'row' and 'end' are relative to the start of the region.
|
||||
///
|
||||
/// Return OK for success, FAIL if the lines are not deleted.
|
||||
int grid_del_lines(ScreenGrid *grid, int row, int line_count, int end,
|
||||
int col, int width)
|
||||
int grid_del_lines(ScreenGrid *grid, int row, int line_count, int end, int col,
|
||||
int width)
|
||||
{
|
||||
int j;
|
||||
int i;
|
||||
unsigned temp;
|
||||
|
||||
if (grid == NULL) {
|
||||
grid = &default_grid;
|
||||
}
|
||||
|
||||
// If UI is not externalized, keep working on default grid
|
||||
if (!ui_is_external(kUIMultigrid) && grid != &default_grid) {
|
||||
row += grid->OffsetRow;
|
||||
@ -6527,8 +6529,9 @@ int showmode(void)
|
||||
|
||||
/* if the cmdline is more than one line high, erase top lines */
|
||||
need_clear = clear_cmdline;
|
||||
if (clear_cmdline && cmdline_row < default_grid.Rows - 1)
|
||||
msg_clr_cmdline(); /* will reset clear_cmdline */
|
||||
if (clear_cmdline && cmdline_row < default_grid.Rows - 1) {
|
||||
msg_clr_cmdline(); // will reset clear_cmdline
|
||||
}
|
||||
|
||||
/* Position on the last line in the window, column 0 */
|
||||
msg_pos_mode();
|
||||
@ -6547,8 +6550,9 @@ int showmode(void)
|
||||
/* These messages can get long, avoid a wrap in a narrow
|
||||
* window. Prefer showing edit_submode_extra. */
|
||||
length = (default_grid.Rows - msg_row) * default_grid.Columns - 3;
|
||||
if (edit_submode_extra != NULL)
|
||||
if (edit_submode_extra != NULL) {
|
||||
length -= vim_strsize(edit_submode_extra);
|
||||
}
|
||||
if (length > 0) {
|
||||
if (edit_submode_pre != NULL)
|
||||
length -= vim_strsize(edit_submode_pre);
|
||||
@ -6821,7 +6825,7 @@ static void draw_tabline(void)
|
||||
break;
|
||||
}
|
||||
grid_puts_len(&default_grid, NameBuff, len, 0, col,
|
||||
hl_combine_attr(attr, win_hl_attr(cwp, HLF_T)));
|
||||
hl_combine_attr(attr, win_hl_attr(cwp, HLF_T)));
|
||||
col += len;
|
||||
}
|
||||
if (modified) {
|
||||
@ -6846,8 +6850,9 @@ static void draw_tabline(void)
|
||||
p += len - room;
|
||||
len = room;
|
||||
}
|
||||
if (len > default_grid.Columns - col - 1)
|
||||
if (len > default_grid.Columns - col - 1) {
|
||||
len = default_grid.Columns - col - 1;
|
||||
}
|
||||
|
||||
grid_puts_len(&default_grid, p, (int)STRLEN(p), 0, col, attr);
|
||||
col += len;
|
||||
@ -6870,11 +6875,13 @@ static void draw_tabline(void)
|
||||
c = '_';
|
||||
else
|
||||
c = ' ';
|
||||
grid_fill(&default_grid, 0, 1, col, (int)default_grid.Columns, c, c, attr_fill);
|
||||
grid_fill(&default_grid, 0, 1, col, (int)default_grid.Columns, c, c,
|
||||
attr_fill);
|
||||
|
||||
/* Put an "X" for closing the current tab if there are several. */
|
||||
if (first_tabpage->tp_next != NULL) {
|
||||
grid_putchar(&default_grid, 'X', 0, (int)default_grid.Columns - 1, attr_nosel);
|
||||
grid_putchar(&default_grid, 'X', 0, (int)default_grid.Columns - 1,
|
||||
attr_nosel);
|
||||
tab_page_click_defs[default_grid.Columns - 1] = (StlClickDefinition) {
|
||||
.type = kStlClickTabClose,
|
||||
.tabnr = 999,
|
||||
@ -7109,15 +7116,18 @@ static void win_redr_ruler(win_T *wp, int always)
|
||||
int i = (int)STRLEN(buffer);
|
||||
get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1);
|
||||
int o = i + vim_strsize(buffer + i + 1);
|
||||
if (wp->w_status_height == 0) /* can't use last char of screen */
|
||||
++o;
|
||||
if (wp->w_status_height == 0) { // can't use last char of screen
|
||||
o++;
|
||||
}
|
||||
int this_ru_col = ru_col - (default_grid.Columns - width);
|
||||
if (this_ru_col < 0)
|
||||
if (this_ru_col < 0) {
|
||||
this_ru_col = 0;
|
||||
/* Never use more than half the window/screen width, leave the other
|
||||
* half for the filename. */
|
||||
if (this_ru_col < (width + 1) / 2)
|
||||
}
|
||||
// Never use more than half the window/screen width, leave the other half
|
||||
// for the filename.
|
||||
if (this_ru_col < (width + 1) / 2) {
|
||||
this_ru_col = (width + 1) / 2;
|
||||
}
|
||||
if (this_ru_col + o < width) {
|
||||
// Need at least 3 chars left for get_rel_pos() + NUL.
|
||||
while (this_ru_col + o < width && RULER_BUF_LEN > i + 4) {
|
||||
@ -7139,10 +7149,9 @@ static void win_redr_ruler(win_T *wp, int always)
|
||||
grid_puts(&default_grid, buffer, row, this_ru_col + off, attr);
|
||||
i = redraw_cmdline;
|
||||
grid_fill(&default_grid, row, row + 1,
|
||||
this_ru_col + off + (int)STRLEN(buffer),
|
||||
off + width,
|
||||
fillchar, fillchar, attr);
|
||||
/* don't redraw the cmdline because of showing the ruler */
|
||||
this_ru_col + off + (int)STRLEN(buffer), off + width, fillchar,
|
||||
fillchar, attr);
|
||||
// don't redraw the cmdline because of showing the ruler
|
||||
redraw_cmdline = i;
|
||||
wp->w_ru_cursor = wp->w_cursor;
|
||||
wp->w_ru_virtcol = wp->w_virtcol;
|
||||
@ -7163,12 +7172,13 @@ int number_width(win_T *wp)
|
||||
int n;
|
||||
linenr_T lnum;
|
||||
|
||||
if (wp->w_p_rnu && !wp->w_p_nu)
|
||||
/* cursor line shows "0" */
|
||||
if (wp->w_p_rnu && !wp->w_p_nu) {
|
||||
// cursor line shows "0"
|
||||
lnum = wp->w_grid.Rows;
|
||||
else
|
||||
/* cursor line shows absolute line number */
|
||||
} else {
|
||||
// cursor line shows absolute line number
|
||||
lnum = wp->w_buffer->b_ml.ml_line_count;
|
||||
}
|
||||
|
||||
if (lnum == wp->w_nrwidth_line_count)
|
||||
return wp->w_nrwidth_width;
|
||||
|
@ -2166,9 +2166,10 @@ showmatch(
|
||||
if (!curwin->w_p_wrap) {
|
||||
getvcol(curwin, lpos, NULL, &vcol, NULL);
|
||||
}
|
||||
if (curwin->w_p_wrap || (vcol >= curwin->w_leftcol
|
||||
&& vcol < curwin->w_leftcol + curwin->w_grid.Columns)) {
|
||||
mpos = *lpos; /* save the pos, update_screen() may change it */
|
||||
if (curwin->w_p_wrap
|
||||
|| (vcol >= curwin->w_leftcol
|
||||
&& vcol < curwin->w_leftcol + curwin->w_grid.Columns)) {
|
||||
mpos = *lpos; // save the pos, update_screen() may change it
|
||||
save_cursor = curwin->w_cursor;
|
||||
save_so = p_so;
|
||||
save_siso = p_siso;
|
||||
|
@ -349,7 +349,8 @@ void ui_grid_cursor_goto(ScreenGrid *grid, int new_row, int new_col)
|
||||
{
|
||||
new_row += ui_is_external(kUIMultigrid) ? 0 : grid->OffsetRow;
|
||||
new_col += ui_is_external(kUIMultigrid) ? 0 : grid->OffsetColumn;
|
||||
int handle = ui_is_external(kUIMultigrid) ? grid->handle : DEFAULT_GRID_HANDLE;
|
||||
int handle = ui_is_external(kUIMultigrid) ? grid->handle
|
||||
: DEFAULT_GRID_HANDLE;
|
||||
|
||||
if (new_row == row && new_col == col && handle == cursor_grid_handle) {
|
||||
return;
|
||||
@ -451,7 +452,8 @@ void ui_grid_resize(GridHandle grid_handle, int width, int height, Error *error)
|
||||
|
||||
win_T *wp = get_win_by_grid_handle(grid_handle);
|
||||
if (wp == NULL) {
|
||||
api_set_error(error, kErrorTypeValidation, "No window with the given handle");
|
||||
api_set_error(error, kErrorTypeValidation,
|
||||
"No window with the given handle");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4230,7 +4230,7 @@ static void frame_comp_pos(frame_T *topfrp, int *row, int *col)
|
||||
wp->w_winrow = *row;
|
||||
wp->w_wincol = *col;
|
||||
redraw_win_later(wp, NOT_VALID);
|
||||
wp->w_redr_status = TRUE;
|
||||
wp->w_redr_status = true;
|
||||
wp->w_pos_changed = true;
|
||||
}
|
||||
*row += wp->w_height + wp->w_status_height;
|
||||
@ -4285,8 +4285,9 @@ void win_setheight_win(int height, win_T *win)
|
||||
* If there is extra space created between the last window and the command
|
||||
* line, clear it.
|
||||
*/
|
||||
if (full_screen && msg_scrolled == 0 && row < cmdline_row)
|
||||
if (full_screen && msg_scrolled == 0 && row < cmdline_row) {
|
||||
grid_fill(&default_grid, row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
|
||||
}
|
||||
cmdline_row = row;
|
||||
msg_row = row;
|
||||
msg_col = 0;
|
||||
@ -5086,10 +5087,11 @@ void command_height(void)
|
||||
/* Recompute window positions. */
|
||||
(void)win_comp_pos();
|
||||
|
||||
/* clear the lines added to cmdline */
|
||||
if (full_screen)
|
||||
grid_fill(&default_grid, cmdline_row, (int)Rows, 0,
|
||||
(int)Columns, ' ', ' ', 0);
|
||||
// clear the lines added to cmdline
|
||||
if (full_screen) {
|
||||
grid_fill(&default_grid, cmdline_row, (int)Rows, 0, (int)Columns, ' ',
|
||||
' ', 0);
|
||||
}
|
||||
msg_row = cmdline_row;
|
||||
redraw_cmdline = TRUE;
|
||||
return;
|
||||
@ -6073,7 +6075,7 @@ void win_ui_flush(void)
|
||||
}
|
||||
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||
if(wp->w_pos_changed && wp->w_grid.ScreenLines != NULL) {
|
||||
if (wp->w_pos_changed && wp->w_grid.ScreenLines != NULL) {
|
||||
ui_call_win_position(wp->handle, wp->w_grid.handle, wp->w_winrow,
|
||||
wp->w_wincol, wp->w_width, wp->w_height);
|
||||
wp->w_pos_changed = false;
|
||||
|
Loading…
Reference in New Issue
Block a user