From 7f21665673686c653389ff4e86a2ce8e17804178 Mon Sep 17 00:00:00 2001 From: Brandon Coleman Date: Wed, 28 May 2014 16:35:14 -0500 Subject: [PATCH] move/remove W_* macros move W_ENDCOL to screen.c remove the rest of the W_* macros --- src/nvim/buffer_defs.h | 9 +- src/nvim/charset.c | 12 +-- src/nvim/cursor.c | 6 +- src/nvim/edit.c | 16 ++-- src/nvim/eval.c | 2 +- src/nvim/ex_cmds.c | 2 +- src/nvim/ex_docmd.c | 6 +- src/nvim/ex_getln.c | 4 +- src/nvim/getchar.c | 6 +- src/nvim/misc1.c | 4 +- src/nvim/misc2.c | 1 + src/nvim/move.c | 22 ++--- src/nvim/normal.c | 18 ++-- src/nvim/popupmnu.c | 8 +- src/nvim/quickfix.c | 2 +- src/nvim/screen.c | 205 +++++++++++++++++++++-------------------- src/nvim/search.c | 2 +- src/nvim/term.c | 8 +- src/nvim/ui.c | 12 +-- src/nvim/vim.h | 6 -- src/nvim/window.c | 8 +- 21 files changed, 176 insertions(+), 183 deletions(-) diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 8bb76c0746..a505df5e93 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -949,12 +949,9 @@ struct window_S { int w_height; /* number of rows in window, excluding status/command line(s) */ int w_status_height; /* number of status lines (0 or 1) */ - int w_wincol; /* Leftmost column of window in screen. - use W_WINCOL() */ - int w_width; /* Width of window, excluding separation. - use W_WIDTH() */ - int w_vsep_width; /* Number of separator columns (0 or 1). - use W_VSEP_WIDTH() */ + int w_wincol; /* Leftmost column of window in screen. */ + int w_width; /* Width of window, excluding separation. */ + int w_vsep_width; /* Number of separator columns (0 or 1). */ /* * === start of cached values ==== diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 26ae17510a..948cb7e569 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1001,7 +1001,7 @@ int win_lbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp) // non-blank after a blank. numberextra = win_col_off(wp); col2 = col; - colmax = (colnr_T)(W_WIDTH(wp) - numberextra); + colmax = (colnr_T)(wp->w_width - numberextra); if (col >= colmax) { n = colmax + win_col_off2(wp); @@ -1049,15 +1049,15 @@ int win_lbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp) numberextra = win_col_off(wp); col += numberextra + mb_added; - if (col >= (colnr_T)W_WIDTH(wp)) { - col -= W_WIDTH(wp); - numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp)); + if (col >= (colnr_T)wp->w_width) { + col -= wp->w_width; + numberextra = wp->w_width - (numberextra - win_col_off2(wp)); if (numberextra > 0) { col = col % numberextra; } } - if ((col == 0) || (col + size > (colnr_T)W_WIDTH(wp))) { + if ((col == 0) || (col + size > (colnr_T)wp->w_width)) { added = vim_strsize(p_sbr); if (tab_corr) { size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts; @@ -1124,7 +1124,7 @@ int in_win_border(win_T *wp, colnr_T vcol) // there is no border return FALSE; } - width1 = W_WIDTH(wp) - win_col_off(wp); + width1 = wp->w_width - win_col_off(wp); if ((int)vcol < width1 - 1) { return FALSE; diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index 5049a51872..18e95f0741 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -113,7 +113,7 @@ static int coladvance2( --curwin->w_curswant; } } else { - int width = W_WIDTH(curwin) - win_col_off(curwin); + int width = curwin->w_width - win_col_off(curwin); if (finetune && curwin->w_p_wrap @@ -217,7 +217,7 @@ static int coladvance2( int b = (int)wcol - (int)col; /* The difference between wcol and col is used to set coladd. */ - if (b > 0 && b < (MAXCOL - 2 * W_WIDTH(curwin))) + if (b > 0 && b < (MAXCOL - 2 * curwin->w_width)) pos->coladd = b; col += b; @@ -395,7 +395,7 @@ bool leftcol_changed(void) bool retval = false; changed_cline_bef_curs(); - lastcol = curwin->w_leftcol + W_WIDTH(curwin) - curwin_col_off() - 1; + lastcol = curwin->w_leftcol + curwin->w_width - curwin_col_off() - 1; validate_virtcol(); /* diff --git a/src/nvim/edit.c b/src/nvim/edit.c index accd346d36..a802ae4942 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -544,7 +544,7 @@ edit ( validate_cursor_col(); if ((int)curwin->w_wcol < mincol - curbuf->b_p_ts - && curwin->w_wrow == W_WINROW(curwin) + && curwin->w_wrow == curwin->w_winrow + curwin->w_height - 1 - p_so && (curwin->w_cursor.lnum != curwin->w_topline || curwin->w_topfill > 0 @@ -1342,11 +1342,11 @@ void edit_putchar(int c, int highlight) attr = hl_attr(HLF_8); else attr = 0; - pc_row = W_WINROW(curwin) + curwin->w_wrow; - pc_col = W_WINCOL(curwin); + pc_row = curwin->w_winrow + curwin->w_wrow; + pc_col = curwin->w_wincol; pc_status = PC_STATUS_UNSET; if (curwin->w_p_rl) { - pc_col += W_WIDTH(curwin) - 1 - curwin->w_wcol; + pc_col += curwin->w_width - 1 - curwin->w_wcol; if (has_mbyte) { int fix_col = mb_fix_col(pc_col, pc_row); @@ -1408,7 +1408,7 @@ void display_dollar(colnr_T col) curwin->w_cursor.col -= (*mb_head_off)(p, p + col); } curs_columns(FALSE); /* recompute w_wrow and w_wcol */ - if (curwin->w_wcol < W_WIDTH(curwin)) { + if (curwin->w_wcol < curwin->w_width) { edit_putchar('$', FALSE); dollar_vcol = curwin->w_virtcol; } @@ -5493,7 +5493,7 @@ 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 W_WIDTH(curwin) - 'wrapmargin' + * else if 'wrapmargin' option is set, use curwin->w_width - 'wrapmargin' * if invalid value, use 0. * Set default to window width (maximum 79) for "gq" operator. */ @@ -5508,7 +5508,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 = W_WIDTH(curwin) - curbuf->b_p_wm; + textwidth = curwin->w_width - curbuf->b_p_wm; if (cmdwin_type != 0) textwidth -= 1; textwidth -= curwin->w_p_fdc; @@ -5523,7 +5523,7 @@ comp_textwidth ( if (textwidth < 0) textwidth = 0; if (ff && textwidth == 0) { - textwidth = W_WIDTH(curwin) - 1; + textwidth = curwin->w_width - 1; if (textwidth > 79) textwidth = 79; } diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 4a85761ec7..e6a16cc0bf 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -14682,7 +14682,7 @@ static void f_winrestview(typval_T *argvars, typval_T *rettv) check_cursor(); win_new_height(curwin, curwin->w_height); - win_new_width(curwin, W_WIDTH(curwin)); + win_new_width(curwin, curwin->w_width); changed_window_setting(); if (curwin->w_topline == 0) diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index f9250e8aa1..ce70f59c27 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -186,7 +186,7 @@ void ex_align(exarg_T *eap) if (width <= 0) width = curbuf->b_p_tw; if (width == 0 && curbuf->b_p_wm > 0) - width = W_WIDTH(curwin) - curbuf->b_p_wm; + width = curwin->w_width - curbuf->b_p_wm; if (width <= 0) width = 80; } diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index d95927cfd6..31243a12c4 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5908,7 +5908,7 @@ static void ex_resize(exarg_T *eap) n = atol((char *)eap->arg); if (cmdmod.split & WSP_VERT) { if (*eap->arg == '-' || *eap->arg == '+') - n += W_WIDTH(curwin); + n += curwin->w_width; else if (n == 0 && eap->arg[0] == NUL) /* default is very wide */ n = 9999; win_setwidth_win((int)n, wp); @@ -6393,9 +6393,9 @@ static void ex_sleep(exarg_T *eap) long len; if (cursor_valid()) { - n = W_WINROW(curwin) + curwin->w_wrow - msg_scrolled; + n = curwin->w_winrow + curwin->w_wrow - msg_scrolled; if (n >= 0) - windgoto((int)n, W_WINCOL(curwin) + curwin->w_wcol); + windgoto((int)n, curwin->w_wincol + curwin->w_wcol); } len = eap->line2; diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index abb1bb4f86..0b00e458ff 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -2513,8 +2513,8 @@ void compute_cmdrow(void) if (exmode_active || msg_scrolled != 0) cmdline_row = Rows - 1; else - cmdline_row = W_WINROW(lastwin) + lastwin->w_height - + W_STATUS_HEIGHT(lastwin); + cmdline_row = lastwin->w_winrow + lastwin->w_height + + lastwin->w_status_height; } static void cursorcmd(void) diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index c3ef6f0610..6b41dde827 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2168,8 +2168,8 @@ static int vgetorpeek(int advance) ++col; } curwin->w_wrow = curwin->w_cline_row - + curwin->w_wcol / W_WIDTH(curwin); - curwin->w_wcol %= W_WIDTH(curwin); + + curwin->w_wcol / curwin->w_width; + curwin->w_wcol %= curwin->w_width; curwin->w_wcol += curwin_col_off(); col = 0; /* no correction needed */ } else { @@ -2178,7 +2178,7 @@ static int vgetorpeek(int advance) } } else if (curwin->w_p_wrap && curwin->w_wrow) { --curwin->w_wrow; - curwin->w_wcol = W_WIDTH(curwin) - 1; + curwin->w_wcol = curwin->w_width - 1; col = curwin->w_cursor.col - 1; } if (has_mbyte && col > 0 && curwin->w_wcol > 0) { diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index e54936c347..cf9a65d2da 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -1280,7 +1280,7 @@ int plines_win_nofold(win_T *wp, linenr_T lnum) /* * Add column offset for 'number', 'relativenumber' and 'foldcolumn'. */ - width = W_WIDTH(wp) - win_col_off(wp); + width = wp->w_width - win_col_off(wp); if (width <= 0) return 32000; if (col <= width) @@ -1332,7 +1332,7 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column) /* * Add column offset for 'number', 'relativenumber', 'foldcolumn', etc. */ - width = W_WIDTH(wp) - win_col_off(wp); + width = wp->w_width - win_col_off(wp); if (width <= 0) return 9999; diff --git a/src/nvim/misc2.c b/src/nvim/misc2.c index 312154ee2b..adf0fa7120 100644 --- a/src/nvim/misc2.c +++ b/src/nvim/misc2.c @@ -151,6 +151,7 @@ int decl(pos_T *lp) } /* + * Return TRUE when 'shell' has "csh" in the tail. */ int csh_like_shell(void) diff --git a/src/nvim/move.c b/src/nvim/move.c index b150f06a95..d05dc5ca41 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -660,14 +660,14 @@ void validate_cursor_col(void) col = curwin->w_virtcol; off = curwin_col_off(); col += off; - width = W_WIDTH(curwin) - off + curwin_col_off2(); + width = curwin->w_width - off + curwin_col_off2(); /* long line wrapping, adjust curwin->w_wrow */ if (curwin->w_p_wrap - && col >= (colnr_T)W_WIDTH(curwin) + && col >= (colnr_T)curwin->w_width && width > 0) /* use same formula as what is used in curs_columns() */ - col -= ((col - W_WIDTH(curwin)) / width + 1) * width; + col -= ((col - curwin->w_width) / width + 1) * width; if (col > (int)curwin->w_leftcol) col -= curwin->w_leftcol; else @@ -769,10 +769,10 @@ curs_columns ( */ curwin->w_wrow = curwin->w_cline_row; - textwidth = W_WIDTH(curwin) - extra; + textwidth = curwin->w_width - extra; if (textwidth <= 0) { /* No room for text, put cursor in last char of window. */ - curwin->w_wcol = W_WIDTH(curwin) - 1; + curwin->w_wcol = curwin->w_width - 1; curwin->w_wrow = curwin->w_height - 1; } else if (curwin->w_p_wrap && curwin->w_width != 0 @@ -780,9 +780,9 @@ curs_columns ( width = textwidth + curwin_col_off2(); /* long line wrapping, adjust curwin->w_wrow */ - if (curwin->w_wcol >= W_WIDTH(curwin)) { + if (curwin->w_wcol >= curwin->w_width) { /* this same formula is used in validate_cursor_col() */ - n = (curwin->w_wcol - W_WIDTH(curwin)) / width + 1; + n = (curwin->w_wcol - curwin->w_width) / width + 1; curwin->w_wcol -= n * width; curwin->w_wrow += n; @@ -807,7 +807,7 @@ curs_columns ( * extra */ off_left = (int)startcol - (int)curwin->w_leftcol - p_siso; - off_right = (int)endcol - (int)(curwin->w_leftcol + W_WIDTH(curwin) + off_right = (int)endcol - (int)(curwin->w_leftcol + curwin->w_width - p_siso) + 1; if (off_left < 0 || off_right > 0) { if (off_left < 0) @@ -999,7 +999,7 @@ scrolldown ( validate_virtcol(); validate_cheight(); wrow += curwin->w_cline_height - 1 - - curwin->w_virtcol / W_WIDTH(curwin); + curwin->w_virtcol / curwin->w_width; } while (wrow >= curwin->w_height && curwin->w_cursor.lnum > 1) { if (hasFolding(curwin->w_cursor.lnum, &first, NULL)) { @@ -1156,7 +1156,7 @@ void scrolldown_clamp(void) validate_cheight(); validate_virtcol(); end_row += curwin->w_cline_height - 1 - - curwin->w_virtcol / W_WIDTH(curwin); + curwin->w_virtcol / curwin->w_width; } if (end_row < curwin->w_height - p_so) { if (can_fill) { @@ -1198,7 +1198,7 @@ void scrollup_clamp(void) && curwin->w_width != 0 ) { validate_virtcol(); - start_row -= curwin->w_virtcol / W_WIDTH(curwin); + start_row -= curwin->w_virtcol / curwin->w_width; } if (start_row >= p_so) { if (curwin->w_topfill > 0) diff --git a/src/nvim/normal.c b/src/nvim/normal.c index f7558109fa..f4f03f4ff8 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3394,8 +3394,8 @@ static int nv_screengo(oparg_T *oap, int dir, long dist) col_off1 = curwin_col_off(); col_off2 = col_off1 - curwin_col_off2(); - width1 = W_WIDTH(curwin) - col_off1; - width2 = W_WIDTH(curwin) - col_off2; + width1 = curwin->w_width - col_off1; + width2 = curwin->w_width - col_off2; if (curwin->w_width != 0) { /* @@ -3730,7 +3730,7 @@ dozet: /* "zH" - scroll screen right half-page */ case 'H': - cap->count1 *= W_WIDTH(curwin) / 2; + cap->count1 *= curwin->w_width / 2; /* FALLTHROUGH */ /* "zh" - scroll screen to the right */ @@ -3746,7 +3746,7 @@ dozet: break; /* "zL" - scroll screen left half-page */ - case 'L': cap->count1 *= W_WIDTH(curwin) / 2; + case 'L': cap->count1 *= curwin->w_width / 2; /* FALLTHROUGH */ /* "zl" - scroll screen to the left */ @@ -3782,7 +3782,7 @@ dozet: col = 0; /* like the cursor is in col 0 */ else getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col); - n = W_WIDTH(curwin) - curwin_col_off(); + n = curwin->w_width - curwin_col_off(); if ((long)col + p_siso < n) col = 0; else @@ -6170,7 +6170,7 @@ static void nv_g_cmd(cmdarg_T *cap) if (curwin->w_p_wrap && curwin->w_width != 0 ) { - int width1 = W_WIDTH(curwin) - curwin_col_off(); + int width1 = curwin->w_width - curwin_col_off(); int width2 = width1 + curwin_col_off2(); validate_virtcol(); @@ -6183,7 +6183,7 @@ static void nv_g_cmd(cmdarg_T *cap) * 'relativenumber' is on and lines are wrapping the middle can be more * to the left. */ if (cap->nchar == 'm') - i += (W_WIDTH(curwin) - curwin_col_off() + i += (curwin->w_width - curwin_col_off() + ((curwin->w_p_wrap && i > 0) ? curwin_col_off2() : 0)) / 2; coladvance((colnr_T)i); @@ -6233,7 +6233,7 @@ static void nv_g_cmd(cmdarg_T *cap) ) { curwin->w_curswant = MAXCOL; /* so we stay at the end */ if (cap->count1 == 1) { - int width1 = W_WIDTH(curwin) - col_off; + int width1 = curwin->w_width - col_off; int width2 = width1 + curwin_col_off2(); validate_virtcol(); @@ -6259,7 +6259,7 @@ static void nv_g_cmd(cmdarg_T *cap) } else if (nv_screengo(oap, FORWARD, cap->count1 - 1) == FAIL) clearopbeep(oap); } else { - i = curwin->w_leftcol + W_WIDTH(curwin) - col_off - 1; + i = curwin->w_leftcol + curwin->w_width - col_off - 1; coladvance((colnr_T)i); /* Make sure we stick in this column. */ diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 97db6efe37..b0ed3047ae 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -73,7 +73,7 @@ redo: validate_cursor_col(); pum_array = NULL; - row = curwin->w_wrow + W_WINROW(curwin); + row = curwin->w_wrow + curwin->w_winrow; if (firstwin->w_p_pvw) { top_clear = firstwin->w_height; @@ -189,9 +189,9 @@ redo: // Calculate column if (curwin->w_p_rl) { - col = W_WINCOL(curwin) + W_WIDTH(curwin) - curwin->w_wcol - 1; + col = curwin->w_wincol + curwin->w_width - curwin->w_wcol - 1; } else { - col = W_WINCOL(curwin) + curwin->w_wcol; + col = curwin->w_wincol + curwin->w_wcol; } // if there are more items than room we need a scrollbar @@ -299,7 +299,7 @@ void pum_redraw(void) // prepend a space if there is room if (curwin->w_p_rl) { - if (pum_col < W_WINCOL(curwin) + W_WIDTH(curwin) - 1) { + if (pum_col < curwin->w_wincol + curwin->w_width - 1) { screen_putchar(' ', row, pum_col + 1, attr); } } else if (pum_col > 0) { diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 775b6e717e..bfac62de3d 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2045,7 +2045,7 @@ void ex_copen(exarg_T *eap) win_goto(win); if (eap->addr_count != 0) { if (cmdmod.split & WSP_VERT) { - if (height != W_WIDTH(win)) { + if (height != win->w_width) { win_setwidth(height); } } else { diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 18b1797c36..77b06d703c 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -131,6 +131,7 @@ #define MB_FILLER_CHAR '<' /* character used when a double-width character * doesn't fit. */ +#define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) /* * The attributes that are actually active for writing to the screen. @@ -434,16 +435,16 @@ void update_screen(int type) type = CLEAR; FOR_ALL_WINDOWS(wp) { - if (W_WINROW(wp) < msg_scrolled) { - if (W_WINROW(wp) + wp->w_height > msg_scrolled + if (wp->w_winrow < msg_scrolled) { + if (wp->w_winrow + wp->w_height > msg_scrolled && wp->w_redr_type < REDRAW_TOP && wp->w_lines_valid > 0 && wp->w_topline == wp->w_lines[0].wl_lnum) { - wp->w_upd_rows = msg_scrolled - W_WINROW(wp); + wp->w_upd_rows = msg_scrolled - wp->w_winrow; wp->w_redr_type = REDRAW_TOP; } else { wp->w_redr_type = NOT_VALID; - if (W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp) + if (wp->w_winrow + wp->w_height + wp->w_status_height <= msg_scrolled) wp->w_redr_status = TRUE; } @@ -1610,8 +1611,8 @@ static void win_update(win_T *wp) /* * Last line isn't finished: Display "@@@" at the end. */ - screen_fill(W_WINROW(wp) + wp->w_height - 1, - W_WINROW(wp) + wp->w_height, + screen_fill(wp->w_winrow + wp->w_height - 1, + wp->w_winrow + wp->w_height, (int)W_ENDCOL(wp) - 3, (int)W_ENDCOL(wp), '@', '@', hl_attr(HLF_AT)); set_empty_rows(wp, srow); @@ -1702,9 +1703,9 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h if (n > 0) { /* draw the fold column at the right */ - if (n > W_WIDTH(wp)) - n = W_WIDTH(wp); - screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, + if (n > wp->w_width) + n = wp->w_width; + screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, W_ENDCOL(wp) - n, (int)W_ENDCOL(wp), ' ', ' ', hl_attr(HLF_FC)); } @@ -1713,19 +1714,19 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h int nn = n + 2; /* draw the sign column left of the fold column */ - if (nn > W_WIDTH(wp)) { - nn = W_WIDTH(wp); + if (nn > wp->w_width) { + nn = wp->w_width; } - screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, + screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - n, ' ', ' ', hl_attr(HLF_SC)); n = nn; } - screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp), W_ENDCOL(wp) - 1 - FDC_OFF, + screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, + wp->w_wincol, W_ENDCOL(wp) - 1 - FDC_OFF, c2, c2, hl_attr(hl)); - screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, + screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, W_ENDCOL(wp) - 1 - FDC_OFF, W_ENDCOL(wp) - FDC_OFF, c1, c2, hl_attr(hl)); } else { @@ -1734,18 +1735,18 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h n = 1; if (n > wp->w_width) n = wp->w_width; - screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp), (int)W_WINCOL(wp) + n, + screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, + wp->w_wincol, (int)wp->w_wincol + n, cmdwin_type, ' ', hl_attr(HLF_AT)); } if (wp->w_p_fdc > 0) { int nn = n + wp->w_p_fdc; /* draw the fold column at the left */ - if (nn > W_WIDTH(wp)) - nn = W_WIDTH(wp); - screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn, + if (nn > wp->w_width) + nn = wp->w_width; + screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, + wp->w_wincol + n, (int)wp->w_wincol + nn, ' ', ' ', hl_attr(HLF_FC)); n = nn; } @@ -1755,17 +1756,17 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h int nn = n + 2; /* draw the sign column after the fold column */ - if (nn > W_WIDTH(wp)) { - nn = W_WIDTH(wp); + if (nn > wp->w_width) { + nn = wp->w_width; } - screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn, + screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, + wp->w_wincol + n, (int)wp->w_wincol + nn, ' ', ' ', hl_attr(HLF_SC)); n = nn; } - screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp) + FDC_OFF, (int)W_ENDCOL(wp), + screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, + wp->w_wincol + FDC_OFF, (int)W_ENDCOL(wp), c1, c2, hl_attr(hl)); } set_empty_rows(wp, row); @@ -1824,18 +1825,18 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T * 2. Add the 'foldcolumn' */ fdc = wp->w_p_fdc; - if (fdc > W_WIDTH(wp) - col) - fdc = W_WIDTH(wp) - col; + if (fdc > wp->w_width - col) + fdc = wp->w_width - col; if (fdc > 0) { fill_foldcolumn(buf, wp, TRUE, lnum); if (wp->w_p_rl) { int i; - copy_text_attr(off + W_WIDTH(wp) - fdc - col, buf, fdc, + copy_text_attr(off + wp->w_width - fdc - col, buf, fdc, hl_attr(HLF_FC)); /* reverse the fold column */ for (i = 0; i < fdc; ++i) - ScreenLines[off + W_WIDTH(wp) - i - 1 - col] = buf[i]; + ScreenLines[off + wp->w_width - i - 1 - col] = buf[i]; } else copy_text_attr(off + col, buf, fdc, hl_attr(HLF_FC)); col += fdc; @@ -1843,18 +1844,18 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T # define RL_MEMSET(p, v, l) if (wp->w_p_rl) \ for (ri = 0; ri < l; ++ri) \ - ScreenAttrs[off + (W_WIDTH(wp) - (p) - (l)) + ri] = v; \ + ScreenAttrs[off + (wp->w_width - (p) - (l)) + ri] = v; \ else \ for (ri = 0; ri < l; ++ri) \ ScreenAttrs[off + (p) + ri] = v /* Set all attributes of the 'number' or 'relativenumber' column and the * text */ - RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col); + RL_MEMSET(col, hl_attr(HLF_FL), wp->w_width - col); /* If signs are being displayed, add two spaces. */ if (draw_signcolumn(wp)) { - len = W_WIDTH(wp) - col; + len = wp->w_width - col; if (len > 0) { if (len > 2) { len = 2; @@ -1868,7 +1869,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T * 3. Add the 'number' or 'relativenumber' column */ if (wp->w_p_nu || wp->w_p_rnu) { - len = W_WIDTH(wp) - col; + len = wp->w_width - col; if (len > 0) { int w = number_width(wp); long num; @@ -1894,7 +1895,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T sprintf((char *)buf, fmt, w, num); if (wp->w_p_rl) /* the line number isn't reversed */ - copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len, + copy_text_attr(off + wp->w_width - len - col, buf, len, hl_attr(HLF_FL)); else copy_text_attr(off + col, buf, len, hl_attr(HLF_FL)); @@ -1933,7 +1934,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T for (p = text; *p != NUL; ) { cells = (*mb_ptr2cells)(p); c_len = (*mb_ptr2len)(p); - if (col + cells > W_WIDTH(wp) + if (col + cells > wp->w_width - (wp->w_p_rl ? col : 0) ) break; @@ -1996,8 +1997,8 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T } } else { len = (int)STRLEN(text); - if (len > W_WIDTH(wp) - col) - len = W_WIDTH(wp) - col; + if (len > wp->w_width - col) + len = wp->w_width - col; if (len > 0) { if (wp->w_p_rl) STRNCPY(current_ScreenLine, text, len); @@ -2010,7 +2011,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T /* Fill the rest of the line with the fold filler */ if (wp->w_p_rl) col -= txtcol; - while (col < W_WIDTH(wp) + while (col < wp->w_width - (wp->w_p_rl ? txtcol : 0) ) { if (enc_utf8) { @@ -2053,19 +2054,19 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T FALSE))))))) { if (VIsual_mode == Ctrl_V) { /* Visual block mode: highlight the chars part of the block */ - if (wp->w_old_cursor_fcol + txtcol < (colnr_T)W_WIDTH(wp)) { + if (wp->w_old_cursor_fcol + txtcol < (colnr_T)wp->w_width) { if (wp->w_old_cursor_lcol != MAXCOL && wp->w_old_cursor_lcol + txtcol - < (colnr_T)W_WIDTH(wp)) + < (colnr_T)wp->w_width) len = wp->w_old_cursor_lcol; else - len = W_WIDTH(wp) - txtcol; + len = wp->w_width - txtcol; RL_MEMSET(wp->w_old_cursor_fcol + txtcol, hl_attr(HLF_V), len - (int)wp->w_old_cursor_fcol); } } else { /* Set all attributes of the text */ - RL_MEMSET(txtcol, hl_attr(HLF_V), W_WIDTH(wp) - txtcol); + RL_MEMSET(txtcol, hl_attr(HLF_V), wp->w_width - txtcol); } } } @@ -2077,13 +2078,13 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T txtcol -= wp->w_skipcol; else txtcol -= wp->w_leftcol; - if (txtcol >= 0 && txtcol < W_WIDTH(wp)) + if (txtcol >= 0 && txtcol < wp->w_width) ScreenAttrs[off + txtcol] = hl_combine_attr( ScreenAttrs[off + txtcol], hl_attr(HLF_CUC)); } - SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp), - (int)W_WIDTH(wp), FALSE); + SCREEN_LINE(row + wp->w_winrow, wp->w_wincol, (int)wp->w_width, + (int)wp->w_width, FALSE); /* * Update w_cline_height and w_cline_folded if the cursor line was @@ -2305,7 +2306,7 @@ win_line ( return startrow; row = startrow; - screen_row = row + W_WINROW(wp); + screen_row = row + wp->w_winrow; /* * To speed up the loop below, set extra_check when there is linebreak, @@ -2702,7 +2703,7 @@ win_line ( /* Rightleft window: process the text in the normal direction, but put * it in current_ScreenLine[] from right to left. Start at the * rightmost column of the window. */ - col = W_WIDTH(wp) - 1; + col = wp->w_width - 1; off += col; } @@ -2823,7 +2824,7 @@ win_line ( if (wp->w_p_rl) n_extra = col + 1; else - n_extra = W_WIDTH(wp) - col; + n_extra = wp->w_width - col; char_attr = hl_attr(HLF_DED); } if (*p_sbr != NUL && need_showbreak) { @@ -2861,7 +2862,7 @@ win_line ( && lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol && filler_todo <= 0 ) { - SCREEN_LINE(screen_row, W_WINCOL(wp), col, -(int)W_WIDTH(wp), + SCREEN_LINE(screen_row, wp->w_wincol, col, -(int)wp->w_width, wp->w_p_rl); /* Pretend we have finished updating the window. Except when * 'cursorcolumn' is set. */ @@ -3054,7 +3055,7 @@ win_line ( * last column. */ if (( wp->w_p_rl ? (col <= 0) : - (col >= W_WIDTH(wp) - 1)) + (col >= wp->w_width - 1)) && (*mb_char2cells)(mb_c) == 2) { c = '>'; mb_c = c; @@ -3205,7 +3206,7 @@ win_line ( * next line. */ if (( wp->w_p_rl ? (col <= 0) : - (col >= W_WIDTH(wp) - 1)) + (col >= wp->w_width - 1)) && (*mb_char2cells)(mb_c) == 2) { c = '>'; mb_c = c; @@ -3449,7 +3450,7 @@ win_line ( && VIsual_mode != Ctrl_V && ( wp->w_p_rl ? (col >= 0) : - (col < W_WIDTH(wp))) + (col < wp->w_width)) && !(noinvcur && lnum == wp->w_cursor.lnum && (colnr_T)vcol == wp->w_virtcol))) @@ -3508,7 +3509,7 @@ win_line ( && vcol < tocol && ( wp->w_p_rl ? (col >= 0) : - (col < W_WIDTH(wp)))) { + (col < wp->w_width))) { c = ' '; --ptr; /* put it back at the NUL */ } else if (( @@ -3518,7 +3519,7 @@ win_line ( wp->w_p_rl ? (col >= 0) : (col - boguscols - < W_WIDTH(wp)))) { + < wp->w_width))) { /* Highlight until the right side of the window */ c = ' '; --ptr; /* put it back at the NUL */ @@ -3682,7 +3683,7 @@ win_line ( if (col < 0) n = 1; } else { - if (col >= W_WIDTH(wp)) + if (col >= wp->w_width) n = -1; } if (n != 0) { @@ -3762,7 +3763,7 @@ win_line ( if (((wp->w_p_cuc && (int)wp->w_virtcol >= VCOL_HLC - eol_hl_off && (int)wp->w_virtcol < - W_WIDTH(wp) * (row - startrow + 1) + v + wp->w_width * (row - startrow + 1) + v && lnum != wp->w_cursor.lnum) || draw_color_col) && !wp->w_p_rl @@ -3778,7 +3779,7 @@ win_line ( if (rightmost_vcol < color_cols[i]) rightmost_vcol = color_cols[i]; - while (col < W_WIDTH(wp)) { + while (col < wp->w_width) { ScreenLines[off] = ' '; if (enc_utf8) ScreenLinesUC[off] = 0; @@ -3801,8 +3802,8 @@ win_line ( } } - SCREEN_LINE(screen_row, W_WINCOL(wp), col, - (int)W_WIDTH(wp), wp->w_p_rl); + SCREEN_LINE(screen_row, wp->w_wincol, col, + (int)wp->w_width, wp->w_p_rl); row++; /* @@ -3825,7 +3826,7 @@ win_line ( && filler_todo <= 0 && ( wp->w_p_rl ? col == 0 : - col == W_WIDTH(wp) - 1) + col == wp->w_width - 1) && (*ptr != NUL || (wp->w_p_list && lcs_eol_one > 0) || (n_extra && (c_extra != NUL || *p_extra != NUL)))) { @@ -4014,14 +4015,14 @@ win_line ( */ if (( wp->w_p_rl ? (col < 0) : - (col >= W_WIDTH(wp))) + (col >= wp->w_width)) && (*ptr != NUL || filler_todo > 0 || (wp->w_p_list && lcs_eol != NUL && p_extra != at_end_str) || (n_extra != 0 && (c_extra != NUL || *p_extra != NUL))) ) { - SCREEN_LINE(screen_row, W_WINCOL(wp), col - boguscols, - (int)W_WIDTH(wp), wp->w_p_rl); + SCREEN_LINE(screen_row, wp->w_wincol, col - boguscols, + (int)wp->w_width, wp->w_p_rl); boguscols = 0; ++row; ++screen_row; @@ -4050,7 +4051,7 @@ win_line ( if (screen_cur_row == screen_row - 1 && filler_todo <= 0 - && W_WIDTH(wp) == Columns) { + && wp->w_width == Columns) { /* Remember that the line wraps, used for modeless copy. */ LineWraps[screen_row - 1] = TRUE; @@ -4080,7 +4081,7 @@ win_line ( * then output the same character again to let the * terminal know about the wrap. If the terminal doesn't * auto-wrap, we overwrite the character. */ - if (screen_cur_col != W_WIDTH(wp)) + if (screen_cur_col != wp->w_width) screen_char(LineOffset[screen_row - 1] + (unsigned)Columns - 1, screen_row - 1, (int)(Columns - 1)); @@ -4103,7 +4104,7 @@ win_line ( col = 0; off = (unsigned)(current_ScreenLine - ScreenLines); if (wp->w_p_rl) { - col = W_WIDTH(wp) - 1; /* col is not used if breaking! */ + col = wp->w_width - 1; /* col is not used if breaking! */ off += col; } @@ -4532,7 +4533,7 @@ static void draw_vsep_win(win_T *wp, int row) if (wp->w_vsep_width) { /* draw the vertical separator right of this window */ c = fillchar_vsep(&hl); - screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, + screen_fill(wp->w_winrow + row, wp->w_winrow + wp->w_height, W_ENDCOL(wp), W_ENDCOL(wp) + 1, c, ' ', hl); } @@ -4824,9 +4825,9 @@ void win_redr_status(win_T *wp) len += 4; } - this_ru_col = ru_col - (Columns - W_WIDTH(wp)); - if (this_ru_col < (W_WIDTH(wp) + 1) / 2) - this_ru_col = (W_WIDTH(wp) + 1) / 2; + this_ru_col = ru_col - (Columns - wp->w_width); + if (this_ru_col < (wp->w_width + 1) / 2) + this_ru_col = (wp->w_width + 1) / 2; if (this_ru_col <= 1) { p = (char_u *)"<"; /* No room for file name! */ len = 1; @@ -4854,15 +4855,15 @@ void win_redr_status(win_T *wp) len = this_ru_col - 1; } - row = W_WINROW(wp) + wp->w_height; - screen_puts(p, row, W_WINCOL(wp), attr); - screen_fill(row, row + 1, len + W_WINCOL(wp), - this_ru_col + W_WINCOL(wp), fillchar, fillchar, attr); + row = wp->w_winrow + wp->w_height; + screen_puts(p, row, wp->w_wincol, attr); + screen_fill(row, row + 1, len + wp->w_wincol, + this_ru_col + wp->w_wincol, fillchar, fillchar, attr); if (get_keymap_str(wp, NameBuff, MAXPATHL) && (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1)) screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff) - - 1 + W_WINCOL(wp)), attr); + - 1 + wp->w_wincol), attr); win_redr_ruler(wp, TRUE); } @@ -4875,7 +4876,7 @@ void win_redr_status(win_T *wp) fillchar = fillchar_status(&attr, wp == curwin); else fillchar = fillchar_vsep(&attr); - screen_putchar(fillchar, W_WINROW(wp) + wp->w_height, W_ENDCOL(wp), + screen_putchar(fillchar, wp->w_winrow + wp->w_height, W_ENDCOL(wp), attr); } busy = FALSE; @@ -5023,9 +5024,9 @@ win_redr_custom ( maxwidth = Columns; use_sandbox = was_set_insecurely((char_u *)"tabline", 0); } else { - row = W_WINROW(wp) + wp->w_height; + row = wp->w_winrow + wp->w_height; fillchar = fillchar_status(&attr, wp == curwin); - maxwidth = W_WIDTH(wp); + maxwidth = wp->w_width; if (draw_ruler) { stl = p_ruf; @@ -5039,10 +5040,10 @@ win_redr_custom ( if (*stl++ != '(') stl = p_ruf; } - col = ru_col - (Columns - W_WIDTH(wp)); - if (col < (W_WIDTH(wp) + 1) / 2) - col = (W_WIDTH(wp) + 1) / 2; - maxwidth = W_WIDTH(wp) - col; + col = ru_col - (Columns - wp->w_width); + if (col < (wp->w_width + 1) / 2) + col = (wp->w_width + 1) / 2; + maxwidth = wp->w_width - col; if (!wp->w_status_height) { row = Rows - 1; --maxwidth; /* writing in last column may cause scrolling */ @@ -5060,7 +5061,7 @@ win_redr_custom ( *wp->w_p_stl == NUL ? 0 : OPT_LOCAL); } - col += W_WINCOL(wp); + col += wp->w_wincol; } if (maxwidth <= 0) @@ -6700,11 +6701,11 @@ void setcursor(void) { if (redrawing()) { validate_cursor(); - windgoto(W_WINROW(curwin) + curwin->w_wrow, - W_WINCOL(curwin) + ( + windgoto(curwin->w_winrow + curwin->w_wrow, + curwin->w_wincol + ( /* With 'rightleft' set and the cursor on a double-wide * character, position it on the leftmost column. */ - curwin->w_p_rl ? ((int)W_WIDTH(curwin) - curwin->w_wcol - ( + curwin->w_p_rl ? ((int)curwin->w_width - curwin->w_wcol - ( (has_mbyte && (*mb_ptr2cells)(get_cursor_pos_ptr()) == 2 && vim_isprintc(gchar_cursor())) ? 2 : @@ -6748,7 +6749,7 @@ int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) */ did_delete = FALSE; if (wp->w_next != NULL || wp->w_status_height) { - if (screen_del_lines(0, W_WINROW(wp) + wp->w_height - line_count, + if (screen_del_lines(0, wp->w_winrow + wp->w_height - line_count, line_count, (int)Rows, FALSE, NULL) == OK) did_delete = TRUE; else if (wp->w_next) @@ -6760,16 +6761,16 @@ int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) if (!did_delete) { wp->w_redr_status = TRUE; redraw_cmdline = TRUE; - nextrow = W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp); + nextrow = wp->w_winrow + wp->w_height + wp->w_status_height; lastrow = nextrow + line_count; if (lastrow > Rows) lastrow = Rows; screen_fill(nextrow - line_count, lastrow - line_count, - W_WINCOL(wp), (int)W_ENDCOL(wp), + wp->w_wincol, (int)W_ENDCOL(wp), ' ', ' ', 0); } - if (screen_ins_lines(0, W_WINROW(wp) + row, line_count, (int)Rows, NULL) + if (screen_ins_lines(0, wp->w_winrow + row, line_count, (int)Rows, NULL) == FAIL) { /* deletion will have messed up other windows */ if (did_delete) { @@ -6803,7 +6804,7 @@ int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) if (retval != MAYBE) return retval; - if (screen_del_lines(0, W_WINROW(wp) + row, line_count, + if (screen_del_lines(0, wp->w_winrow + row, line_count, (int)Rows, FALSE, NULL) == FAIL) return FAIL; @@ -6812,7 +6813,7 @@ int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) * correct place. If we can't do that, they have to be redrawn. */ if (wp->w_next || wp->w_status_height || cmdline_row < Rows - 1) { - if (screen_ins_lines(0, W_WINROW(wp) + wp->w_height - line_count, + if (screen_ins_lines(0, wp->w_winrow + wp->w_height - line_count, line_count, (int)Rows, NULL) == FAIL) { wp->w_redr_status = TRUE; win_rest_invalid(wp->w_next); @@ -6851,8 +6852,8 @@ static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int de * Delete all remaining lines */ if (row + line_count >= wp->w_height) { - screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, - W_WINCOL(wp), (int)W_ENDCOL(wp), + screen_fill(wp->w_winrow + row, wp->w_winrow + wp->w_height, + wp->w_wincol, (int)W_ENDCOL(wp), ' ', ' ', 0); return OK; } @@ -6873,15 +6874,15 @@ static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int de * scroll-up in the DJGPP version. */ if (scroll_region - || W_WIDTH(wp) != Columns + || wp->w_width != Columns ) { if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) scroll_region_set(wp, row); if (del) - retval = screen_del_lines(W_WINROW(wp) + row, 0, line_count, + retval = screen_del_lines(wp->w_winrow + row, 0, line_count, wp->w_height - row, FALSE, wp); else - retval = screen_ins_lines(W_WINROW(wp) + row, 0, line_count, + retval = screen_ins_lines(wp->w_winrow + row, 0, line_count, wp->w_height - row, wp); if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) scroll_region_reset(); @@ -7789,10 +7790,10 @@ static void win_redr_ruler(win_T *wp, int always) || empty_line != wp->w_ru_empty) { cursor_off(); if (wp->w_status_height) { - row = W_WINROW(wp) + wp->w_height; + row = wp->w_winrow + wp->w_height; fillchar = fillchar_status(&attr, wp == curwin); - off = W_WINCOL(wp); - width = W_WIDTH(wp); + off = wp->w_wincol; + width = wp->w_width; } else { row = Rows - 1; fillchar = ' '; diff --git a/src/nvim/search.c b/src/nvim/search.c index 08fdfa4b63..af43f356e0 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -2022,7 +2022,7 @@ 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 + W_WIDTH(curwin))) { + && vcol < curwin->w_leftcol + curwin->w_width)) { mpos = *lpos; /* save the pos, update_screen() may change it */ save_cursor = curwin->w_cursor; save_so = p_so; diff --git a/src/nvim/term.c b/src/nvim/term.c index 34cc90620b..664d8d962b 100644 --- a/src/nvim/term.c +++ b/src/nvim/term.c @@ -2874,11 +2874,11 @@ void term_cursor_shape(void) */ void scroll_region_set(win_T *wp, int off) { - OUT_STR(tgoto((char *)T_CS, W_WINROW(wp) + wp->w_height - 1, - W_WINROW(wp) + off)); + OUT_STR(tgoto((char *)T_CS, wp->w_winrow + wp->w_height - 1, + wp->w_winrow + off)); if (*T_CSV != NUL && wp->w_width != Columns) - OUT_STR(tgoto((char *)T_CSV, W_WINCOL(wp) + wp->w_width - 1, - W_WINCOL(wp))); + OUT_STR(tgoto((char *)T_CSV, wp->w_wincol + wp->w_width - 1, + wp->w_wincol)); screen_start(); /* don't know where cursor is now */ } diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 256d35f089..78b540e6a8 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -648,7 +648,7 @@ retnomove: || (!on_status_line && !on_sep_line && ( - wp->w_p_rl ? col < W_WIDTH(wp) - wp->w_p_fdc : + wp->w_p_rl ? col < wp->w_width - wp->w_p_fdc : col >= wp->w_p_fdc + (cmdwin_type == 0 && wp == curwin ? 0 : 1) @@ -717,8 +717,8 @@ retnomove: } - row -= W_WINROW(curwin); - col -= W_WINCOL(curwin); + row -= curwin->w_winrow; + col -= curwin->w_wincol; /* * When clicking beyond the end of the window, scroll the screen. @@ -787,7 +787,7 @@ retnomove: /* Check for position outside of the fold column. */ if ( - curwin->w_p_rl ? col < W_WIDTH(curwin) - curwin->w_p_fdc : + curwin->w_p_rl ? col < curwin->w_width - curwin->w_p_fdc : col >= curwin->w_p_fdc + (cmdwin_type == 0 ? 0 : 1) ) @@ -847,7 +847,7 @@ int mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump) int count; if (win->w_p_rl) - col = W_WIDTH(win) - 1 - col; + col = win->w_width - 1 - col; lnum = win->w_topline; @@ -879,7 +879,7 @@ int mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump) off = win_col_off(win) - win_col_off2(win); if (col < off) col = off; - col += row * (W_WIDTH(win) - off); + col += row * (win->w_width - off); /* add skip column (for long wrapping line) */ col += win->w_skipcol; } diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 412e3730ea..edae3f60d5 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -242,12 +242,6 @@ enum { #define EXMODE_NORMAL 1 #define EXMODE_VIM 2 -# define W_WINCOL(wp) (wp->w_wincol) -# define W_WIDTH(wp) (wp->w_width) -# define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) -# define W_VSEP_WIDTH(wp) (wp->w_vsep_width) -# define W_STATUS_HEIGHT(wp) (wp->w_status_height) -# define W_WINROW(wp) (wp->w_winrow) #ifdef NO_EXPANDPATH # define gen_expand_wildcards mch_expand_wildcards diff --git a/src/nvim/window.c b/src/nvim/window.c index 7134c5f6f3..16127186ff 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2096,7 +2096,7 @@ winframe_remove ( * updated. Can only be done after the sizes have been updated. */ if (frp2 == frp_close->fr_next) { int row = win->w_winrow; - int col = W_WINCOL(win); + int col = win->w_wincol; frame_comp_pos(frp2, &row, &col); } @@ -4525,11 +4525,11 @@ void win_new_height(win_T *wp, int height) */ wp->w_wrow = line_size; if (wp->w_wrow >= wp->w_height - && (W_WIDTH(wp) - win_col_off(wp)) > 0) { - wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp); + && (wp->w_width - win_col_off(wp)) > 0) { + wp->w_skipcol += wp->w_width - win_col_off(wp); --wp->w_wrow; while (wp->w_wrow >= wp->w_height) { - wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp) + wp->w_skipcol += wp->w_width - win_col_off(wp) + win_col_off2(wp); --wp->w_wrow; }