diff options
| author | Utkarsh Maheshwari <utkarshme96@gmail.com> | 2018-05-19 21:03:17 +0530 |
|---|---|---|
| committer | Björn Linse <bjorn.linse@gmail.com> | 2018-12-31 12:44:21 +0100 |
| commit | f102f50ebeca98365b308463c25eb2caffffba51 (patch) | |
| tree | 1521fac8bc7ca1bde148f4839bc3bf4e062edcb3 /src/nvim | |
| parent | c9b559a0308714ef8ad396eb340a4af580e44d74 (diff) | |
| download | rneovim-f102f50ebeca98365b308463c25eb2caffffba51.tar.gz rneovim-f102f50ebeca98365b308463c25eb2caffffba51.tar.bz2 rneovim-f102f50ebeca98365b308463c25eb2caffffba51.zip | |
multigrid: Change screen_* functions to grid_* functions
Diffstat (limited to 'src/nvim')
| -rw-r--r-- | src/nvim/api/ui_events.in.h | 2 | ||||
| -rw-r--r-- | src/nvim/buffer_defs.h | 2 | ||||
| -rw-r--r-- | src/nvim/edit.c | 27 | ||||
| -rw-r--r-- | src/nvim/globals.h | 3 | ||||
| -rw-r--r-- | src/nvim/hardcopy.c | 4 | ||||
| -rw-r--r-- | src/nvim/message.c | 50 | ||||
| -rw-r--r-- | src/nvim/normal.c | 9 | ||||
| -rw-r--r-- | src/nvim/popupmnu.c | 27 | ||||
| -rw-r--r-- | src/nvim/screen.c | 807 | ||||
| -rw-r--r-- | src/nvim/types.h | 10 | ||||
| -rw-r--r-- | src/nvim/ui.c | 34 | ||||
| -rw-r--r-- | src/nvim/ui.h | 2 | ||||
| -rw-r--r-- | src/nvim/version.c | 4 | ||||
| -rw-r--r-- | src/nvim/window.c | 24 |
14 files changed, 552 insertions, 453 deletions
diff --git a/src/nvim/api/ui_events.in.h b/src/nvim/api/ui_events.in.h index 10331fd5c2..5c48cb4804 100644 --- a/src/nvim/api/ui_events.in.h +++ b/src/nvim/api/ui_events.in.h @@ -81,6 +81,8 @@ void grid_line(Integer grid, Integer row, Integer col_start, Array data) void grid_scroll(Integer grid, Integer top, Integer bot, Integer left, Integer right, Integer rows, Integer cols) FUNC_API_SINCE(5) FUNC_API_REMOTE_IMPL; +void grid_destroy(Integer grid) + FUNC_API_SINCE(5) FUNC_API_REMOTE_ONLY; void popupmenu_show(Array items, Integer selected, Integer row, Integer col) FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index d270714611..01f3044332 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1183,6 +1183,8 @@ 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 + /* * w_fraction is the fractional row of the cursor within the window, from * 0 at the top row to FRACTION_MULT at the last row. diff --git a/src/nvim/edit.c b/src/nvim/edit.c index c04190eaba..14577d5abb 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -560,7 +560,7 @@ static int insert_check(VimState *state) if (curwin->w_wcol < s->mincol - curbuf->b_p_ts && curwin->w_wrow == curwin->w_winrow - + curwin->w_height - 1 - p_so + + curwin->w_grid.Rows - 1 - p_so && (curwin->w_cursor.lnum != curwin->w_topline || curwin->w_topfill > 0)) { if (curwin->w_topfill > 0) { @@ -1502,17 +1502,17 @@ void edit_putchar(int c, int highlight) } else { attr = 0; } - pc_row = curwin->w_winrow + curwin->w_wrow; - pc_col = curwin->w_wincol; + pc_row = curwin->w_wrow; + pc_col = 0; pc_status = PC_STATUS_UNSET; if (curwin->w_p_rl) { - pc_col += curwin->w_width - 1 - curwin->w_wcol; + pc_col += curwin->w_grid.Columns - 1 - curwin->w_wcol; if (has_mbyte) { int fix_col = mb_fix_col(pc_col, pc_row); if (fix_col != pc_col) { - screen_putchar(' ', pc_row, fix_col, attr); - --curwin->w_wcol; + grid_putchar(&curwin->w_grid, ' ', pc_row, fix_col, attr); + curwin->w_wcol--; pc_status = PC_STATUS_RIGHT; } } @@ -1524,10 +1524,10 @@ void edit_putchar(int c, int highlight) /* save the character to be able to put it back */ if (pc_status == PC_STATUS_UNSET) { - screen_getbytes(pc_row, pc_col, pc_bytes, &pc_attr); + grid_getbytes(&curwin->w_grid, pc_row, pc_col, pc_bytes, &pc_attr); pc_status = PC_STATUS_SET; } - screen_putchar(c, pc_row, pc_col, attr); + grid_putchar(&curwin->w_grid, c, pc_row, pc_col, attr); } } @@ -1543,7 +1543,8 @@ void edit_unputchar(void) if (pc_status == PC_STATUS_RIGHT || pc_status == PC_STATUS_LEFT) { redrawWinline(curwin, curwin->w_cursor.lnum, false); } else { - screen_puts(pc_bytes, pc_row - msg_scrolled, pc_col, pc_attr); + grid_puts(&curwin->w_grid, pc_bytes, pc_row - msg_scrolled, pc_col, + pc_attr); } } } @@ -1566,7 +1567,7 @@ void display_dollar(colnr_T col) char_u *p = get_cursor_line_ptr(); 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_width) { + if (curwin->w_wcol < curwin->w_grid.Columns) { edit_putchar('$', FALSE); dollar_vcol = curwin->w_virtcol; } @@ -5825,7 +5826,7 @@ static void check_auto_format( /* * 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 - 'wrapmargin' + * else if 'wrapmargin' option is set, use curwin->w_grid.Columns-'wrapmargin' * if invalid value, use 0. * Set default to window width (maximum 79) for "gq" operator. */ @@ -5840,7 +5841,7 @@ comp_textwidth ( 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 - curbuf->b_p_wm; + textwidth = curwin->w_grid.Columns - curbuf->b_p_wm; if (cmdwin_type != 0) textwidth -= 1; textwidth -= curwin->w_p_fdc; @@ -5855,7 +5856,7 @@ comp_textwidth ( if (textwidth < 0) textwidth = 0; if (ff && textwidth == 0) { - textwidth = curwin->w_width - 1; + textwidth = curwin->w_grid.Columns - 1; if (textwidth > 79) textwidth = 79; } diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 097c71928c..3462199476 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -161,7 +161,8 @@ EXTERN char_u *LineWraps INIT(= NULL); /* line wraps to next line */ EXTERN int screen_Rows INIT(= 0); /* actual size of ScreenLines[] */ EXTERN int screen_Columns INIT(= 0); /* actual size of ScreenLines[] */ -EXTERN ScreenGrid default_grid INIT(= { 0 }); +EXTERN ScreenGrid default_grid INIT(= { 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, + 0, 0, 0 }); /* * When vgetc() is called, it sets mod_mask to the set of modifiers that are diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index a8731d5bd7..f66592682b 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -582,8 +582,8 @@ static void prt_header(prt_settings_T *const psettings, const int pagenum, */ static void prt_message(char_u *s) { - screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); - screen_puts(s, (int)Rows - 1, 0, HL_ATTR(HLF_R)); + 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(); } diff --git a/src/nvim/message.c b/src/nvim/message.c index 6de81a8aaf..bb7c605428 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1547,7 +1547,7 @@ void msg_prt_line(char_u *s, int list) } /* - * Use screen_puts() to output one multi-byte 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) @@ -1563,7 +1563,7 @@ static char_u *screen_puts_mbyte(char_u *s, int l, int attr) return s; } - screen_puts_len(s, l, msg_row, msg_col, attr); + grid_puts_len(&default_grid, s, l, msg_row, msg_col, attr); if (cmdmsg_rl) { msg_col -= cw; if (msg_col == 0) { @@ -1888,17 +1888,17 @@ static void msg_scroll_up(void) { if (dy_flags & DY_MSGSEP) { if (msg_scrolled == 0) { - screen_fill(Rows-p_ch-1, Rows-p_ch, 0, (int)Columns, - fill_msgsep, fill_msgsep, HL_ATTR(HLF_MSGSEP)); + grid_fill(&default_grid, Rows-p_ch-1, Rows-p_ch, 0, (int)Columns, + fill_msgsep, fill_msgsep, HL_ATTR(HLF_MSGSEP)); } int nscroll = MIN(msg_scrollsize()+1, Rows); - screen_del_lines(Rows-nscroll, 1, Rows, 0, Columns); + grid_del_lines(&default_grid, Rows-nscroll, 1, Rows, 0, Columns); } else { - screen_del_lines(0, 1, (int)Rows, 0, Columns); + grid_del_lines(&default_grid, 0, 1, (int)Rows, 0, Columns); } // TODO(bfredl): when msgsep display is properly batched, this fill should be // eliminated. - screen_fill(Rows-1, Rows, 0, (int)Columns, ' ', ' ', 0); + grid_fill(&default_grid, Rows-1, Rows, 0, (int)Columns, ' ', ' ', 0); } /* @@ -2097,7 +2097,7 @@ 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. - screen_puts_len((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 @@ -2313,8 +2313,9 @@ static int do_more_prompt(int typed_char) } if (toscroll == -1 - && screen_ins_lines(0, 1, (int)Rows, 0, (int)Columns) == OK) { - screen_fill(0, 1, 0, (int)Columns, ' ', ' ', 0); + && grid_ins_lines(&default_grid, 0, 1, (int)Rows, + 0, (int)Columns) == OK) { + grid_fill(&default_grid, 0, 1, 0, (int)Columns, ' ', ' ', 0); // display line at top (void)disp_sb_line(0, mp); } else { @@ -2333,7 +2334,7 @@ static int do_more_prompt(int typed_char) /* scroll up, display line at bottom */ msg_scroll_up(); inc_msg_scrolled(); - screen_fill((int)Rows - 2, (int)Rows - 1, 0, + grid_fill(&default_grid, (int)Rows - 2, (int)Rows - 1, 0, (int)Columns, ' ', ' ', 0); mp_last = disp_sb_line((int)Rows - 2, mp_last); --toscroll; @@ -2342,7 +2343,7 @@ static int do_more_prompt(int typed_char) if (toscroll <= 0) { /* displayed the requested text, more prompt again */ - screen_fill((int)Rows - 1, (int)Rows, 0, + grid_fill(&default_grid, (int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); msg_moremsg(FALSE); continue; @@ -2356,7 +2357,7 @@ static int do_more_prompt(int typed_char) } /* clear the --more-- message */ - screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); + grid_fill(&default_grid, (int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); State = oldState; setmouse(); if (quit_more) { @@ -2452,8 +2453,8 @@ void mch_msg(char *str) */ static void msg_screen_putchar(int c, int attr) { - msg_didout = TRUE; /* remember that line is not empty */ - screen_putchar(c, msg_row, msg_col, attr); + msg_didout = true; // remember that line is not empty + grid_putchar(&default_grid, c, msg_row, msg_col, attr); if (cmdmsg_rl) { if (--msg_col == 0) { msg_col = Columns; @@ -2473,11 +2474,12 @@ void msg_moremsg(int full) char_u *s = (char_u *)_("-- More --"); attr = HL_ATTR(HLF_M); - screen_puts(s, (int)Rows - 1, 0, attr); - if (full) - screen_puts((char_u *) - _(" SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "), - (int)Rows - 1, vim_strsize(s), attr); + 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); + } } /* @@ -2526,11 +2528,11 @@ void msg_clr_eos(void) void msg_clr_eos_force(void) { if (cmdmsg_rl) { - screen_fill(msg_row, msg_row + 1, 0, msg_col + 1, ' ', ' ', 0); - screen_fill(msg_row + 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); + 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 { - screen_fill(msg_row, msg_row + 1, msg_col, (int)Columns, ' ', ' ', 0); - screen_fill(msg_row + 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); + 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); } } diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 38ee0936aa..4e6c3c4063 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3466,10 +3466,10 @@ static void display_showcmd(void) int len; len = (int)STRLEN(showcmd_buf); - if (len == 0) + if (len == 0) { showcmd_is_clear = true; - else { - screen_puts(showcmd_buf, (int)Rows - 1, sc_col, 0); + } else { + grid_puts(&default_grid, showcmd_buf, (int)Rows - 1, sc_col, 0); showcmd_is_clear = false; } @@ -3477,7 +3477,8 @@ static void display_showcmd(void) * clear the rest of an old message by outputting up to SHOWCMD_COLS * spaces */ - screen_puts((char_u *)" " + len, (int)Rows - 1, sc_col + len, 0); + grid_puts(&default_grid, (char_u *)" " + len, (int)Rows - 1, + sc_col + len, 0); setcursor(); /* put cursor back where it belongs */ } diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 68c8967b91..e9a0c7c6b4 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -351,10 +351,10 @@ void pum_redraw(void) // prepend a space if there is room if (curwin->w_p_rl) { if (pum_col < curwin->w_wincol + curwin->w_width - 1) { - screen_putchar(' ', row, pum_col + 1, attr); + grid_putchar(&default_grid, ' ', row, pum_col + 1, attr); } } else if (pum_col > 0) { - screen_putchar(' ', row, pum_col - 1, attr); + grid_putchar(&default_grid, ' ', row, pum_col - 1, attr); } // Display each entry, use two spaces for a Tab. @@ -416,12 +416,13 @@ void pum_redraw(void) size++; } } - screen_puts_len(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; } else { - screen_puts_len(st, (int)STRLEN(st), row, col, attr); + grid_puts_len(&default_grid, st, (int)STRLEN(st), row, col, attr); xfree(st); col += width; } @@ -432,10 +433,10 @@ void pum_redraw(void) // Display two spaces for a Tab. if (curwin->w_p_rl) { - screen_puts_len((char_u *)" ", 2, row, col - 1, attr); + grid_puts_len(&default_grid, (char_u *)" ", 2, row, col - 1, attr); col -= 2; } else { - screen_puts_len((char_u *)" ", 2, row, col, attr); + grid_puts_len(&default_grid, (char_u *)" ", 2, row, col, attr); col += 2; } totwidth += 2; @@ -466,11 +467,11 @@ void pum_redraw(void) } if (curwin->w_p_rl) { - screen_fill(row, row + 1, pum_col - pum_base_width - n + 1, + grid_fill(&default_grid, row, row + 1, pum_col - pum_base_width - n + 1, col + 1, ' ', ' ', attr); col = pum_col - pum_base_width - n + 1; } else { - screen_fill(row, row + 1, col, pum_col + pum_base_width + n, + grid_fill(&default_grid, row, row + 1, col, pum_col + pum_base_width + n, ' ', ' ', attr); col = pum_col + pum_base_width + n; } @@ -478,24 +479,24 @@ void pum_redraw(void) } if (curwin->w_p_rl) { - screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1, ' ', ' ', + grid_fill(&default_grid, row, row + 1, pum_col - pum_width + 1, col + 1, ' ', ' ', attr); } else { - screen_fill(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) { - screen_putchar(' ', row, pum_col - pum_width, + grid_putchar(&default_grid, ' ', row, pum_col - pum_width, i >= thumb_pos && i < thumb_pos + thumb_heigth ? attr_thumb : attr_scroll); } else { - screen_putchar(' ', row, pum_col + pum_width, + grid_putchar(&default_grid, ' ', row, pum_col + pum_width, i >= thumb_pos && i < thumb_pos + thumb_heigth ? attr_thumb : attr_scroll); } } - screen_puts_line_flush(false); + grid_puts_line_flush(&default_grid, false); row++; } } diff --git a/src/nvim/screen.c b/src/nvim/screen.c index fcb225084d..3aaca394f5 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -118,22 +118,14 @@ #define MB_FILLER_CHAR '<' /* character used when a double-width character * doesn't fit. */ -#define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) +#define W_ENDCOL(wp) (wp->w_width + wp->w_wincol) static match_T search_hl; /* used for 'hlsearch' highlight matching */ static foldinfo_T win_foldinfo; /* info for 'foldcolumn' */ -/* - * Buffer for one screen line (characters and attributes). - */ -static schar_T *current_ScreenLine; - StlClickDefinition *tab_page_click_defs = NULL; -int grid_Rows = 0; -int grid_Columns = 0; - long tab_page_click_defs_size = 0; // for line_putchar. Contains the state that needs to be remembered from @@ -145,6 +137,13 @@ typedef struct { } LineState; #define LINE_STATE(p) { p, 0, 0 } +/// The last handle that was assigned to a ScreenGrid. 1 is reserved for +/// the default_grid. +static int last_handle = 1; + +/// Whether to call "ui_call_grid_resize" in win_grid_alloc +static int send_grid_resize; + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "screen.c.generated.h" #endif @@ -304,12 +303,12 @@ void update_screen(int type) wp->w_redr_status = true; } } - } else if (msg_scrolled > Rows - 5) { // clearing is faster + } else if (msg_scrolled > default_grid.Rows - 5) { // clearing is faster type = CLEAR; } else if (type != CLEAR) { check_for_delay(false); - if (screen_ins_lines(0, msg_scrolled, (int)Rows, 0, (int)Columns) - == FAIL) { + if (grid_ins_lines(&default_grid, 0, msg_scrolled, (int)Rows, + 0, (int)Columns) == FAIL) { type = CLEAR; } FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { @@ -434,6 +433,7 @@ void update_screen(int type) win_redr_status(wp, true); // any popup menu will be redrawn below } } + send_grid_resize = false; end_search_hl(); // May need to redraw the popup menu. if (pum_drawn()) { @@ -502,7 +502,7 @@ void update_single_line(win_T *wp, linenr_T lnum) int j; // Don't do anything if the screen structures are (not yet) valid. - if (!screen_valid(true) || updating_screen) { + if (wp->w_grid.ScreenLines == NULL || updating_screen) { return; } updating_screen = true; @@ -673,19 +673,21 @@ static void win_update(win_T *wp) type = wp->w_redr_type; + win_grid_alloc(wp, false); + if (type >= NOT_VALID) { wp->w_redr_status = true; wp->w_lines_valid = 0; } /* Window is zero-height: nothing to draw. */ - if (wp->w_height == 0) { + if (wp->w_grid.Rows == 0) { wp->w_redr_type = 0; return; } /* Window is zero-width: Only need to draw the separator. */ - if (wp->w_width == 0) { + if (wp->w_grid.Columns == 0) { /* draw the vertical separator right of this window */ draw_vsep_win(wp, 0); wp->w_redr_type = 0; @@ -876,19 +878,19 @@ static void win_update(win_T *wp) j = 0; for (ln = wp->w_topline; ln < wp->w_lines[0].wl_lnum; ++ln) { ++j; - if (j >= wp->w_height - 2) + 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_height - 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) i += diff_check_fill(wp, wp->w_lines[0].wl_lnum) - wp->w_old_topfill; - if (i < wp->w_height - 2) { // less than a screen off + if (i < wp->w_grid.Rows - 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. @@ -901,8 +903,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 += j) > wp->w_height) - wp->w_lines_valid = wp->w_height; + 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--) wp->w_lines[idx] = wp->w_lines[idx - j]; while (idx >= 0) @@ -951,7 +953,7 @@ static void win_update(win_T *wp) row -= wp->w_topfill; if (row > 0) { if (win_del_lines(wp, 0, row) == OK) { - bot_start = wp->w_height - row; + bot_start = wp->w_grid.Rows - row; } else { mid_start = 0; // redraw all lines } @@ -970,7 +972,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_height) { + + (int)wp->w_lines[j].wl_size > wp->w_grid.Rows) { wp->w_lines_valid = idx + 1; break; } @@ -994,18 +996,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_height; + mid_end = wp->w_grid.Rows; } } else { /* Not VALID or INVERTED: redraw all lines. */ mid_start = 0; - mid_end = wp->w_height; + mid_end = wp->w_grid.Rows; } if (type == SOME_VALID) { /* SOME_VALID: redraw all lines. */ mid_start = 0; - mid_end = wp->w_height; + mid_end = wp->w_grid.Rows; type = NOT_VALID; } @@ -1150,7 +1152,7 @@ static void win_update(win_T *wp) ++lnum; } srow += mid_start; - mid_end = wp->w_height; + mid_end = wp->w_grid.Rows; for (; idx < wp->w_lines_valid; ++idx) { /* find end */ if (wp->w_lines[idx].wl_valid && wp->w_lines[idx].wl_lnum >= to + 1) { @@ -1191,7 +1193,7 @@ static void win_update(win_T *wp) for (;; ) { /* 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_height) { + if (row == wp->w_grid.Rows) { didline = TRUE; break; } @@ -1290,7 +1292,7 @@ static void win_update(win_T *wp) new_rows += plines_win(wp, l, true); } j++; - if (new_rows > wp->w_height - row - 2) { + if (new_rows > wp->w_grid.Rows - row - 2) { /* it's getting too much, must redraw the rest */ new_rows = 9999; break; @@ -1302,20 +1304,20 @@ 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_height - 2) { + if (row - xtra_rows >= wp->w_grid.Rows - 2) { mod_bot = MAXLNUM; } else { if (win_del_lines(wp, row, -xtra_rows) == FAIL) { mod_bot = MAXLNUM; } else { - bot_start = wp->w_height + xtra_rows; + bot_start = wp->w_grid.Rows + xtra_rows; } } } 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_height - 2) { + if (row + xtra_rows >= wp->w_grid.Rows - 2) { mod_bot = MAXLNUM; } else { if (win_ins_lines(wp, row + old_rows, xtra_rows) == FAIL) { @@ -1344,7 +1346,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_height) { + > wp->w_grid.Rows) { wp->w_lines_valid = j + 1; break; } @@ -1357,8 +1359,8 @@ 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_height) - wp->w_lines_valid = wp->w_height; + 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) wp->w_lines[i] = wp->w_lines[i - j]; @@ -1392,12 +1394,12 @@ static void win_update(win_T *wp) && wp->w_lines[idx].wl_lnum == lnum && lnum > wp->w_topline && !(dy_flags & (DY_LASTLINE | DY_TRUNCATE)) - && srow + wp->w_lines[idx].wl_size > wp->w_height + && srow + wp->w_lines[idx].wl_size > wp->w_grid.Rows && diff_check_fill(wp, lnum) == 0 ) { /* This line is not going to fit. Don't draw anything here, * will draw "@ " lines below. */ - row = wp->w_height + 1; + row = wp->w_grid.Rows + 1; } else { prepare_search_hl(wp, lnum); /* Let the syntax stuff know we skipped a few lines. */ @@ -1408,7 +1410,7 @@ static void win_update(win_T *wp) /* * Display one line. */ - row = win_line(wp, lnum, srow, wp->w_height, mod_top == 0, false); + row = win_line(wp, lnum, srow, wp->w_grid.Rows, mod_top == 0, false); wp->w_lines[idx].wl_folded = FALSE; wp->w_lines[idx].wl_lastlnum = lnum; @@ -1422,7 +1424,7 @@ static void win_update(win_T *wp) // Past end of the window or end of the screen. Note that after // resizing wp->w_height may be end up too big. That's a problem // elsewhere, but prevent a crash here. - if (row > wp->w_height || row + wp->w_winrow >= Rows) { + if (row > wp->w_grid.Rows || row + wp->w_winrow >= Rows) { // we may need the size of that too long line later on if (dollar_vcol == -1) { wp->w_lines[idx].wl_size = plines_win(wp, lnum, true); @@ -1443,7 +1445,7 @@ 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_height) /* 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; @@ -1483,31 +1485,28 @@ static void win_update(win_T *wp) * Don't overwrite it, it can be edited. */ wp->w_botline = lnum + 1; - } else if (diff_check_fill(wp, lnum) >= wp->w_height - srow) { + } else if (diff_check_fill(wp, lnum) >= wp->w_grid.Rows - srow) { /* Window ends in filler lines. */ wp->w_botline = lnum; - wp->w_filler_rows = wp->w_height - srow; + wp->w_filler_rows = wp->w_grid.Rows - srow; } else if (dy_flags & DY_TRUNCATE) { // 'display' has "truncate" - int scr_row = wp->w_winrow + wp->w_height - 1; + int scr_row = wp->w_grid.Rows - 1; // Last line isn't finished: Display "@@@" in the last screen line. - screen_puts_len((char_u *)"@@", 2, scr_row, wp->w_wincol, at_attr); + grid_puts_len(&wp->w_grid, (char_u *)"@@", 2, scr_row, 0, at_attr); - screen_fill(scr_row, scr_row + 1, - (int)wp->w_wincol + 2, (int)W_ENDCOL(wp), - '@', ' ', at_attr); + grid_fill(&wp->w_grid, scr_row, scr_row + 1, 2, (int)wp->w_grid.Columns, + '@', ' ', at_attr); set_empty_rows(wp, srow); wp->w_botline = lnum; } else if (dy_flags & DY_LASTLINE) { // 'display' has "lastline" // Last line isn't finished: Display "@@@" at the end. - screen_fill(wp->w_winrow + wp->w_height - 1, - wp->w_winrow + wp->w_height, - W_ENDCOL(wp) - 3, W_ENDCOL(wp), - '@', '@', at_attr); + grid_fill(&wp->w_grid, wp->w_height - 1, wp->w_height, + wp->w_grid.Columns - 3, wp->w_grid.Columns, '@', '@', at_attr); set_empty_rows(wp, srow); wp->w_botline = lnum; } else { - win_draw_end(wp, '@', ' ', srow, wp->w_height, HLF_AT); + win_draw_end(wp, '@', ' ', srow, wp->w_grid.Rows, HLF_AT); wp->w_botline = lnum; } } else { @@ -1522,8 +1521,8 @@ static void win_update(win_T *wp) i = '-'; else i = fill_diff; - if (row + j > wp->w_height) - j = wp->w_height - row; + 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; } @@ -1614,9 +1613,8 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h /* draw the fold column at the right */ if (n > wp->w_width) n = wp->w_width; - screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, - W_ENDCOL(wp) - n, W_ENDCOL(wp), - ' ', ' ', win_hl_attr(wp, HLF_FC)); + grid_fill(&wp->w_grid, row, endrow, wp->w_grid.Columns - n, + wp->w_grid.Columns, ' ', ' ', win_hl_attr(wp, HLF_FC)); } if (signcolumn_on(wp)) { @@ -1626,27 +1624,24 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h if (nn > wp->w_width) { nn = wp->w_width; } - screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, - W_ENDCOL(wp) - nn, W_ENDCOL(wp) - n, - ' ', ' ', win_hl_attr(wp, HLF_SC)); + grid_fill(&wp->w_grid, row, endrow, wp->w_grid.Columns - nn, + wp->w_grid.Columns - n, ' ', ' ', win_hl_attr(wp, HLF_SC)); n = nn; } - screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, - wp->w_wincol, W_ENDCOL(wp) - 1 - FDC_OFF, - c2, c2, attr); - screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, - W_ENDCOL(wp) - 1 - FDC_OFF, W_ENDCOL(wp) - FDC_OFF, - c1, c2, attr); + grid_fill(&wp->w_grid, row, endrow, 0, wp->w_grid.Columns - 1 - FDC_OFF, + c2, c2, attr); + grid_fill(&wp->w_grid, row, endrow, + wp->w_grid.Columns - 1 - FDC_OFF, wp->w_grid.Columns - FDC_OFF, + c1, c2, attr); } else { if (cmdwin_type != 0 && wp == curwin) { /* draw the cmdline character in the leftmost column */ n = 1; if (n > wp->w_width) n = wp->w_width; - screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, - wp->w_wincol, wp->w_wincol + n, - cmdwin_type, ' ', win_hl_attr(wp, HLF_AT)); + grid_fill(&wp->w_grid, row, endrow, 0, n, cmdwin_type, ' ', + win_hl_attr(wp, HLF_AT)); } if (fdc > 0) { int nn = n + fdc; @@ -1654,9 +1649,8 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h /* draw the fold column at the left */ if (nn > wp->w_width) nn = wp->w_width; - screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, - wp->w_wincol + n, wp->w_wincol + nn, - ' ', ' ', win_hl_attr(wp, HLF_FC)); + grid_fill(&wp->w_grid, row, endrow, n, nn, ' ', ' ', + win_hl_attr(wp, HLF_FC)); n = nn; } @@ -1667,15 +1661,12 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h if (nn > wp->w_width) { nn = wp->w_width; } |