Merge #774 'Move defines from vim.h to other header files'

This commit is contained in:
Justin M. Keyes
2014-06-12 20:13:52 -04:00
27 changed files with 323 additions and 332 deletions

View File

@@ -16,6 +16,53 @@
// for dict_T
#include "nvim/eval_defs.h"
/*
* Flags for w_valid.
* These are set when something in a window structure becomes invalid, except
* when the cursor is moved. Call check_cursor_moved() before testing one of
* the flags.
* These are reset when that thing has been updated and is valid again.
*
* Every function that invalidates one of these must call one of the
* invalidate_* functions.
*
* w_valid is supposed to be used only in screen.c. From other files, use the
* functions that set or reset the flags.
*
* VALID_BOTLINE VALID_BOTLINE_AP
* on on w_botline valid
* off on w_botline approximated
* off off w_botline not valid
* on off not possible
*/
#define VALID_WROW 0x01 /* w_wrow (window row) is valid */
#define VALID_WCOL 0x02 /* w_wcol (window col) is valid */
#define VALID_VIRTCOL 0x04 /* w_virtcol (file col) is valid */
#define VALID_CHEIGHT 0x08 /* w_cline_height and w_cline_folded valid */
#define VALID_CROW 0x10 /* w_cline_row is valid */
#define VALID_BOTLINE 0x20 /* w_botine and w_empty_rows are valid */
#define VALID_BOTLINE_AP 0x40 /* w_botine is approximated */
#define VALID_TOPLINE 0x80 /* w_topline is valid (for cursor position) */
/* flags for b_flags */
#define BF_RECOVERED 0x01 /* buffer has been recovered */
#define BF_CHECK_RO 0x02 /* need to check readonly when loading file
into buffer (set by ":e", may be reset by
":buf" */
#define BF_NEVERLOADED 0x04 /* file has never been loaded into buffer,
many variables still need to be set */
#define BF_NOTEDITED 0x08 /* Set when file name is changed after
starting to edit, reset when file is
written out. */
#define BF_NEW 0x10 /* file didn't exist when editing started */
#define BF_NEW_W 0x20 /* Warned for BF_NEW and file created */
#define BF_READERR 0x40 /* got errors while reading the file */
#define BF_DUMMY 0x80 /* dummy buffer, only used internally */
#define BF_PRESERVED 0x100 /* ":preserve" was used */
/* Mask to check for flags that prevent normal writing */
#define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR)
typedef struct window_S win_T;
typedef struct wininfo_S wininfo_T;
typedef struct frame_S frame_T;
@@ -902,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 ====
@@ -916,7 +960,7 @@ struct window_S {
* Recomputing is minimized by storing the result of computations.
* Use functions in screen.c to check if they are valid and to update.
* w_valid is a bitfield of flags, which indicate if specific values are
* valid or need to be recomputed. See screen.c for values.
* valid or need to be recomputed.
*/
int w_valid;
pos_T w_valid_cursor; /* last known position of w_cursor, used

View File

@@ -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;

View File

@@ -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();
/*

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -3,6 +3,26 @@
#include "nvim/ex_cmds.h"
/* Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. */
#define WILD_FREE 1
#define WILD_EXPAND_FREE 2
#define WILD_EXPAND_KEEP 3
#define WILD_NEXT 4
#define WILD_PREV 5
#define WILD_ALL 6
#define WILD_LONGEST 7
#define WILD_ALL_KEEP 8
#define WILD_LIST_NOTFOUND 1
#define WILD_HOME_REPLACE 2
#define WILD_USE_NL 4
#define WILD_NO_BEEP 8
#define WILD_ADD_SLASH 16
#define WILD_KEEP_ALL 32
#define WILD_SILENT 64
#define WILD_ESCAPE 128
#define WILD_ICASE 256
typedef char_u *(*CompleteListItemGetter)(expand_T *, int);
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@@ -1,6 +1,11 @@
#ifndef NVIM_FILE_SEARCH_H
#define NVIM_FILE_SEARCH_H
/* Flags for find_file_*() functions. */
#define FINDFILE_FILE 0 /* only files */
#define FINDFILE_DIR 1 /* only directories */
#define FINDFILE_BOTH 2 /* files and directories */
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "file_search.h.generated.h"
#endif

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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)

View File

@@ -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. */

View File

@@ -5,6 +5,21 @@
#include "nvim/types.h"
#include "nvim/garray.h"
/* Flags for expand_wildcards() */
#define EW_DIR 0x01 /* include directory names */
#define EW_FILE 0x02 /* include file names */
#define EW_NOTFOUND 0x04 /* include not found names */
#define EW_ADDSLASH 0x08 /* append slash to directory name */
#define EW_KEEPALL 0x10 /* keep all matches */
#define EW_SILENT 0x20 /* don't print "1 returned" from shell */
#define EW_EXEC 0x40 /* executable files */
#define EW_PATH 0x80 /* search in 'path' too */
#define EW_ICASE 0x100 /* ignore case */
#define EW_NOERROR 0x200 /* no error for bad regexp */
#define EW_NOTWILD 0x400 /* add match with literal name if exists */
/* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
* is used when executing commands and EW_SILENT for interactive expanding. */
/// Return value for the comparison of two files. Also @see path_full_compare.
typedef enum file_comparison {
kEqualFiles = 1, ///< Both exist and are the same file.

View File

@@ -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) {

View File

@@ -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 {

View File

@@ -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,10 +1611,10 @@ 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,
(int)W_ENDCOL(wp) - 3, (int)W_ENDCOL(wp),
'@', '@', hl_attr(HLF_AT));
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);
wp->w_botline = lnum;
} else {
@@ -1702,51 +1703,51 @@ 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,
W_ENDCOL(wp) - n, (int)W_ENDCOL(wp),
' ', ' ', hl_attr(HLF_FC));
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));
}
if (draw_signcolumn(wp)) {
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,
W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - n,
' ', ' ', hl_attr(HLF_SC));
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,
c2, c2, hl_attr(hl));
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_ENDCOL(wp) - 1 - FDC_OFF, W_ENDCOL(wp) - FDC_OFF,
c1, c2, hl_attr(hl));
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(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 {
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(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_WINCOL(wp), (int)W_WINCOL(wp) + n,
cmdwin_type, ' ', hl_attr(HLF_AT));
screen_fill(wp->w_winrow + row, wp->w_winrow + endrow,
wp->w_wincol, 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,
' ', ' ', hl_attr(HLF_FC));
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,
' ', ' ', hl_attr(HLF_FC));
n = nn;
}
@@ -1755,18 +1756,18 @@ 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,
' ', ' ', hl_attr(HLF_SC));
screen_fill(wp->w_winrow + row, wp->w_winrow + endrow,
wp->w_wincol + n, 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),
c1, c2, hl_attr(hl));
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, wp->w_width,
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,8 +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),
wp->w_p_rl);
SCREEN_LINE(screen_row, wp->w_wincol, col, -wp->w_width, wp->w_p_rl);
/* Pretend we have finished updating the window. Except when
* 'cursorcolumn' is set. */
if (wp->w_p_cuc)
@@ -3054,7 +3054,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 +3205,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 +3449,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 +3508,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 +3518,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 +3682,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 +3762,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 +3778,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 +3801,7 @@ 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, wp->w_width, wp->w_p_rl);
row++;
/*
@@ -3825,7 +3824,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 +4013,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,
wp->w_width, wp->w_p_rl);
boguscols = 0;
++row;
++screen_row;
@@ -4050,7 +4049,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 +4079,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 +4102,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 +4531,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 +4823,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 +4853,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,8 +4874,8 @@ 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),
attr);
screen_putchar(fillchar, wp->w_winrow + wp->w_height,
W_ENDCOL(wp), attr);
}
busy = FALSE;
}
@@ -5023,9 +5022,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 +5038,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 +5059,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 +6699,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 +6747,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 +6759,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),
' ', ' ', 0);
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 +6802,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 +6811,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,9 +6850,9 @@ 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),
' ', ' ', 0);
screen_fill(wp->w_winrow + row, wp->w_winrow + wp->w_height,
wp->w_wincol, (int)W_ENDCOL(wp),
' ', ' ', 0);
return OK;
}
@@ -6873,15 +6872,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 +7788,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 = ' ';

View File

@@ -1,6 +1,20 @@
#ifndef NVIM_SCREEN_H
#define NVIM_SCREEN_H
/*
* flags for update_screen()
* The higher the value, the higher the priority
*/
#define VALID 10 /* buffer not changed, or changes marked
with b_mod_* */
#define INVERTED 20 /* redisplay inverted part that changed */
#define INVERTED_ALL 25 /* redisplay whole inverted part */
#define REDRAW_TOP 30 /* display first w_upd_rows screen lines */
#define SOME_VALID 35 /* like NOT_VALID but may scroll */
#define NOT_VALID 40 /* buffer needs complete redraw */
#define CLEAR 50 /* screen messed up, clear it */
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "screen.h.generated.h"
#endif

View File

@@ -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;

View File

@@ -1,6 +1,17 @@
#ifndef NVIM_SEARCH_H
#define NVIM_SEARCH_H
/* Values for the find_pattern_in_path() function args 'type' and 'action': */
#define FIND_ANY 1
#define FIND_DEFINE 2
#define CHECK_PATH 3
#define ACTION_SHOW 1
#define ACTION_GOTO 2
#define ACTION_SPLIT 3
#define ACTION_SHOW_ALL 4
#define ACTION_EXPAND 5
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "search.h.generated.h"
#endif

View File

@@ -5,6 +5,19 @@
typedef int guicolor_T;
/*
* Terminal highlighting attribute bits.
* Attributes above HL_ALL are used for syntax highlighting.
*/
#define HL_NORMAL 0x00
#define HL_INVERSE 0x01
#define HL_BOLD 0x02
#define HL_ITALIC 0x04
#define HL_UNDERLINE 0x08
#define HL_UNDERCURL 0x10
#define HL_STANDOUT 0x20
#define HL_ALL 0x3f
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "syntax.h.generated.h"
#endif

View File

@@ -3,6 +3,12 @@
#include "nvim/regexp_defs.h"
# define SST_MIN_ENTRIES 150 /* minimal size for state stack array */
# define SST_MAX_ENTRIES 1000 /* maximal size for state stack array */
# define SST_FIX_STATES 7 /* size of sst_stack[]. */
# define SST_DIST 16 /* normal distance between entries */
# define SST_INVALID (synstate_T *)-1 /* invalid syn_state pointer */
/* struct passed to in_id_list() */
struct sp_syn {
int inc_tag; /* ":syn include" unique tag */

View File

@@ -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 */
}

View File

@@ -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;
}

View File

@@ -37,7 +37,7 @@ Error: configure did not run properly.Check auto/config.log.
#endif
/* user ID of root is usually zero, but not for everybody */
# define ROOT_UID 0
#define ROOT_UID 0
/* Can't use "PACKAGE" here, conflicts with a Perl include file. */
@@ -132,60 +132,6 @@ typedef uint32_t u8char_T;
# define textdomain(x) /* empty */
#endif
/*
* flags for update_screen()
* The higher the value, the higher the priority
*/
#define VALID 10 /* buffer not changed, or changes marked
with b_mod_* */
#define INVERTED 20 /* redisplay inverted part that changed */
#define INVERTED_ALL 25 /* redisplay whole inverted part */
#define REDRAW_TOP 30 /* display first w_upd_rows screen lines */
#define SOME_VALID 35 /* like NOT_VALID but may scroll */
#define NOT_VALID 40 /* buffer needs complete redraw */
#define CLEAR 50 /* screen messed up, clear it */
/*
* Flags for w_valid.
* These are set when something in a window structure becomes invalid, except
* when the cursor is moved. Call check_cursor_moved() before testing one of
* the flags.
* These are reset when that thing has been updated and is valid again.
*
* Every function that invalidates one of these must call one of the
* invalidate_* functions.
*
* w_valid is supposed to be used only in screen.c. From other files, use the
* functions that set or reset the flags.
*
* VALID_BOTLINE VALID_BOTLINE_AP
* on on w_botline valid
* off on w_botline approximated
* off off w_botline not valid
* on off not possible
*/
#define VALID_WROW 0x01 /* w_wrow (window row) is valid */
#define VALID_WCOL 0x02 /* w_wcol (window col) is valid */
#define VALID_VIRTCOL 0x04 /* w_virtcol (file col) is valid */
#define VALID_CHEIGHT 0x08 /* w_cline_height and w_cline_folded valid */
#define VALID_CROW 0x10 /* w_cline_row is valid */
#define VALID_BOTLINE 0x20 /* w_botine and w_empty_rows are valid */
#define VALID_BOTLINE_AP 0x40 /* w_botine is approximated */
#define VALID_TOPLINE 0x80 /* w_topline is valid (for cursor position) */
/*
* Terminal highlighting attribute bits.
* Attributes above HL_ALL are used for syntax highlighting.
*/
#define HL_NORMAL 0x00
#define HL_INVERSE 0x01
#define HL_BOLD 0x02
#define HL_ITALIC 0x04
#define HL_UNDERLINE 0x08
#define HL_UNDERCURL 0x10
#define HL_STANDOUT 0x20
#define HL_ALL 0x3f
/* special attribute addition: Put message in history */
#define MSG_HIST 0x1000
@@ -239,24 +185,6 @@ typedef uint32_t u8char_T;
#define FAIL 0
#define NOTDONE 2 /* not OK or FAIL but skipped */
/* flags for b_flags */
#define BF_RECOVERED 0x01 /* buffer has been recovered */
#define BF_CHECK_RO 0x02 /* need to check readonly when loading file
into buffer (set by ":e", may be reset by
":buf" */
#define BF_NEVERLOADED 0x04 /* file has never been loaded into buffer,
many variables still need to be set */
#define BF_NOTEDITED 0x08 /* Set when file name is changed after
starting to edit, reset when file is
written out. */
#define BF_NEW 0x10 /* file didn't exist when editing started */
#define BF_NEW_W 0x20 /* Warned for BF_NEW and file created */
#define BF_READERR 0x40 /* got errors while reading the file */
#define BF_DUMMY 0x80 /* dummy buffer, only used internally */
#define BF_PRESERVED 0x100 /* ":preserve" was used */
/* Mask to check for flags that prevent normal writing */
#define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR)
/*
* values for xp_context when doing command line completion
@@ -314,74 +242,10 @@ enum {
#define EXMODE_NORMAL 1
#define EXMODE_VIM 2
/* Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. */
#define WILD_FREE 1
#define WILD_EXPAND_FREE 2
#define WILD_EXPAND_KEEP 3
#define WILD_NEXT 4
#define WILD_PREV 5
#define WILD_ALL 6
#define WILD_LONGEST 7
#define WILD_ALL_KEEP 8
#define WILD_LIST_NOTFOUND 1
#define WILD_HOME_REPLACE 2
#define WILD_USE_NL 4
#define WILD_NO_BEEP 8
#define WILD_ADD_SLASH 16
#define WILD_KEEP_ALL 32
#define WILD_SILENT 64
#define WILD_ESCAPE 128
#define WILD_ICASE 256
/* Flags for expand_wildcards() */
#define EW_DIR 0x01 /* include directory names */
#define EW_FILE 0x02 /* include file names */
#define EW_NOTFOUND 0x04 /* include not found names */
#define EW_ADDSLASH 0x08 /* append slash to directory name */
#define EW_KEEPALL 0x10 /* keep all matches */
#define EW_SILENT 0x20 /* don't print "1 returned" from shell */
#define EW_EXEC 0x40 /* executable files */
#define EW_PATH 0x80 /* search in 'path' too */
#define EW_ICASE 0x100 /* ignore case */
#define EW_NOERROR 0x200 /* no error for bad regexp */
#define EW_NOTWILD 0x400 /* add match with literal name if exists */
/* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
* is used when executing commands and EW_SILENT for interactive expanding. */
/* Flags for find_file_*() functions. */
#define FINDFILE_FILE 0 /* only files */
#define FINDFILE_DIR 1 /* only directories */
#define FINDFILE_BOTH 2 /* files and directories */
# 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
#endif
/* Values for the find_pattern_in_path() function args 'type' and 'action': */
#define FIND_ANY 1
#define FIND_DEFINE 2
#define CHECK_PATH 3
#define ACTION_SHOW 1
#define ACTION_GOTO 2
#define ACTION_SPLIT 3
#define ACTION_SHOW_ALL 4
# define ACTION_EXPAND 5
# define SST_MIN_ENTRIES 150 /* minimal size for state stack array */
# define SST_MAX_ENTRIES 1000 /* maximal size for state stack array */
# define SST_FIX_STATES 7 /* size of sst_stack[]. */
# define SST_DIST 16 /* normal distance between entries */
# define SST_INVALID (synstate_T *)-1 /* invalid syn_state pointer */
# define HL_CONTAINED 0x01 /* not used on toplevel */
# define HL_TRANSP 0x02 /* has no highlighting */
# define HL_ONELINE 0x04 /* match within one line only */

View File

@@ -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;
}