diff options
| author | Brandon Coleman <metrix1978@gmail.com> | 2014-05-28 16:35:14 -0500 |
|---|---|---|
| committer | Brandon Coleman <metrix1978@gmail.com> | 2014-06-12 01:20:36 -0500 |
| commit | 7f21665673686c653389ff4e86a2ce8e17804178 (patch) | |
| tree | bffd897b743ce4b1cf79ecbd4ca988821768c3a7 /src | |
| parent | 7cdbca77899b8bb09c7a0a4c874c06021543c986 (diff) | |
| download | rneovim-7f21665673686c653389ff4e86a2ce8e17804178.tar.gz rneovim-7f21665673686c653389ff4e86a2ce8e17804178.tar.bz2 rneovim-7f21665673686c653389ff4e86a2ce8e17804178.zip | |
move/remove W_* macros
move W_ENDCOL to screen.c
remove the rest of the W_* macros
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/buffer_defs.h | 9 | ||||
| -rw-r--r-- | src/nvim/charset.c | 12 | ||||
| -rw-r--r-- | src/nvim/cursor.c | 6 | ||||
| -rw-r--r-- | src/nvim/edit.c | 16 | ||||
| -rw-r--r-- | src/nvim/eval.c | 2 | ||||
| -rw-r--r-- | src/nvim/ex_cmds.c | 2 | ||||
| -rw-r--r-- | src/nvim/ex_docmd.c | 6 | ||||
| -rw-r--r-- | src/nvim/ex_getln.c | 4 | ||||
| -rw-r--r-- | src/nvim/getchar.c | 6 | ||||
| -rw-r--r-- | src/nvim/misc1.c | 4 | ||||
| -rw-r--r-- | src/nvim/misc2.c | 1 | ||||
| -rw-r--r-- | src/nvim/move.c | 22 | ||||
| -rw-r--r-- | src/nvim/normal.c | 18 | ||||
| -rw-r--r-- | src/nvim/popupmnu.c | 8 | ||||
| -rw-r--r-- | src/nvim/quickfix.c | 2 | ||||
| -rw-r--r-- | src/nvim/screen.c | 205 | ||||
| -rw-r--r-- | src/nvim/search.c | 2 | ||||
| -rw-r--r-- | src/nvim/term.c | 8 | ||||
| -rw-r--r-- | src/nvim/ui.c | 12 | ||||
| -rw-r--r-- | src/nvim/vim.h | 6 | ||||
| -rw-r--r-- | 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_r |