aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-06-12 20:13:52 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-06-12 20:13:52 -0400
commit168575f3f73f79185db0abdb91be364c0d0f29f9 (patch)
treec9bbf386710d6c57021e03811b2483bcd574812f /src
parent284a38a065f6cedd37f8f7d75c1953884653503c (diff)
parent1ff8ed7b823623e9abd224f78fbce7e20ce66f5d (diff)
downloadrneovim-168575f3f73f79185db0abdb91be364c0d0f29f9.tar.gz
rneovim-168575f3f73f79185db0abdb91be364c0d0f29f9.tar.bz2
rneovim-168575f3f73f79185db0abdb91be364c0d0f29f9.zip
Merge #774 'Move defines from vim.h to other header files'
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer_defs.h58
-rw-r--r--src/nvim/charset.c12
-rw-r--r--src/nvim/cursor.c6
-rw-r--r--src/nvim/edit.c16
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/ex_cmds.c2
-rw-r--r--src/nvim/ex_docmd.c6
-rw-r--r--src/nvim/ex_getln.c4
-rw-r--r--src/nvim/ex_getln.h20
-rw-r--r--src/nvim/file_search.h5
-rw-r--r--src/nvim/getchar.c6
-rw-r--r--src/nvim/misc1.c4
-rw-r--r--src/nvim/move.c22
-rw-r--r--src/nvim/normal.c18
-rw-r--r--src/nvim/path.h15
-rw-r--r--src/nvim/popupmnu.c8
-rw-r--r--src/nvim/quickfix.c2
-rw-r--r--src/nvim/screen.c237
-rw-r--r--src/nvim/screen.h14
-rw-r--r--src/nvim/search.c2
-rw-r--r--src/nvim/search.h11
-rw-r--r--src/nvim/syntax.h13
-rw-r--r--src/nvim/syntax_defs.h6
-rw-r--r--src/nvim/term.c8
-rw-r--r--src/nvim/ui.c12
-rw-r--r--src/nvim/vim.h138
-rw-r--r--src/nvim/window.c8
27 files changed, 323 insertions, 332 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 0a24280b4a..a505df5e93 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -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
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/ex_getln.h b/src/nvim/ex_getln.h
index 6d88e94a78..6175c30924 100644
--- a/src/nvim/ex_getln.h
+++ b/src/nvim/ex_getln.h
@@ -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
diff --git a/src/nvim/file_search.h b/src/nvim/file_search.h
index 0b0b03c56a..833a1a05ff 100644
--- a/src/nvim/file_search.h
+++ b/src/nvim/file_search.h
@@ -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
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/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/path.h b/src/nvim/path.h
index 4ea1e978a6..9a994f3477 100644
--- a/src/nvim/path.h
+++ b/src/nvim/path.h
@@ -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.
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..0a10def170 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,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,
-