summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buffer.c8
-rw-r--r--src/charset.c5
-rw-r--r--src/diff.c2
-rw-r--r--src/edit.c12
-rw-r--r--src/evalfunc.c8
-rw-r--r--src/ex_cmds.c31
-rw-r--r--src/ex_getln.c8
-rw-r--r--src/fileio.c4
-rw-r--r--src/fold.c2
-rw-r--r--src/gui.c4
-rw-r--r--src/gui_beval.c4
-rw-r--r--src/if_perl.xs2
-rw-r--r--src/macros.h30
-rw-r--r--src/main.c5
-rw-r--r--src/mark.c17
-rw-r--r--src/misc1.c8
-rw-r--r--src/move.c2
-rw-r--r--src/normal.c71
-rw-r--r--src/ops.c22
-rw-r--r--src/option.c2
-rw-r--r--src/popupmnu.c2
-rw-r--r--src/regexp.c4
-rw-r--r--src/screen.c4
-rw-r--r--src/search.c79
-rw-r--r--src/spell.c4
-rw-r--r--src/tag.c2
-rw-r--r--src/ui.c6
-rw-r--r--src/undo.c6
-rw-r--r--src/version.c4
-rw-r--r--src/workshop.c2
30 files changed, 194 insertions, 166 deletions
diff --git a/src/buffer.c b/src/buffer.c
index c25cb2f1a..ca3be14a9 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -111,7 +111,7 @@ read_buffer(
{
/* Set or reset 'modified' before executing autocommands, so that
* it can be changed there. */
- if (!readonlymode && !bufempty())
+ if (!readonlymode && !BUFEMPTY())
changed();
else if (retval == OK)
unchanged(curbuf, FALSE);
@@ -1959,7 +1959,7 @@ buflist_new(
&& curbuf != NULL
&& curbuf->b_ffname == NULL
&& curbuf->b_nwindows <= 1
- && (curbuf->b_ml.ml_mfp == NULL || bufempty()))
+ && (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY()))
{
buf = curbuf;
#ifdef FEAT_AUTOCMD
@@ -2334,7 +2334,7 @@ buflist_getfile(
/* If 'switchbuf' contains "split", "vsplit" or "newtab" and the
* current buffer isn't empty: open new tab or window */
if (wp == NULL && (swb_flags & (SWB_VSPLIT | SWB_SPLIT | SWB_NEWTAB))
- && !bufempty())
+ && !BUFEMPTY())
{
if (swb_flags & SWB_NEWTAB)
tabpage_new();
@@ -5017,7 +5017,7 @@ do_arg_all(
#ifdef FEAT_WINDOWS
/* ":drop all" should re-use an empty window to avoid "--remote-tab"
* leaving an empty tab page when executed locally. */
- if (keep_tabs && bufempty() && curbuf->b_nwindows == 1
+ if (keep_tabs && BUFEMPTY() && curbuf->b_nwindows == 1
&& curbuf->b_ffname == NULL && !curbuf->b_changed)
use_firstwin = TRUE;
#endif
diff --git a/src/charset.c b/src/charset.c
index 984d7653e..1e1b8b1af 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1403,7 +1403,8 @@ getvcol(
&& (State & NORMAL)
&& !wp->w_p_list
&& !virtual_active()
- && !(VIsual_active && (*p_sel == 'e' || ltoreq(*pos, VIsual)))
+ && !(VIsual_active
+ && (*p_sel == 'e' || LTOREQ_POS(*pos, VIsual)))
)
*cursor = vcol + incr - 1; /* cursor at end */
else
@@ -1496,7 +1497,7 @@ getvcols(
{
colnr_T from1, from2, to1, to2;
- if (ltp(pos1, pos2))
+ if (LT_POSP(pos1, pos2))
{
getvvcol(wp, pos1, &from1, NULL, &to1);
getvvcol(wp, pos2, &from2, NULL, &to2);
diff --git a/src/diff.c b/src/diff.c
index 435269984..8c70e0cab 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -2333,7 +2333,7 @@ ex_diffgetput(exarg_T *eap)
end_skip = 0;
}
- buf_empty = bufempty();
+ buf_empty = BUFEMPTY();
added = 0;
for (i = 0; i < count; ++i)
{
diff --git a/src/edit.c b/src/edit.c
index 065b030f6..7082b9adc 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -408,7 +408,7 @@ edit(
* the "A" command, thus set State to avoid that. Also check that the
* line number is still valid (lines may have been deleted).
* Do not restore if v:char was set to a non-empty string. */
- if (!equalpos(curwin->w_cursor, save_cursor)
+ if (!EQUAL_POS(curwin->w_cursor, save_cursor)
# ifdef FEAT_EVAL
&& *get_vim_var_str(VV_CHAR) == NUL
# endif
@@ -1631,7 +1631,7 @@ ins_redraw(
# endif
)
# ifdef FEAT_AUTOCMD
- && !equalpos(last_cursormoved, curwin->w_cursor)
+ && !EQUAL_POS(last_cursormoved, curwin->w_cursor)
# endif
# ifdef FEAT_INS_EXPAND
&& !pum_visible()
@@ -4130,7 +4130,7 @@ expand_by_function(
}
curwin->w_cursor = pos; /* restore the cursor position */
validate_cursor();
- if (!equalpos(curwin->w_cursor, pos))
+ if (!EQUAL_POS(curwin->w_cursor, pos))
{
EMSG(_(e_compldel));
goto theend;
@@ -5408,7 +5408,7 @@ ins_complete(int c, int enable_pum)
}
curwin->w_cursor = pos; /* restore the cursor position */
validate_cursor();
- if (!equalpos(curwin->w_cursor, pos))
+ if (!EQUAL_POS(curwin->w_cursor, pos))
{
EMSG(_(e_compldel));
return FAIL;
@@ -8947,7 +8947,7 @@ ins_bs(
* can't backup past starting point unless 'backspace' > 1
* can backup to a previous line if 'backspace' == 0
*/
- if ( bufempty()
+ if ( BUFEMPTY()
|| (
#ifdef FEAT_RIGHTLEFT
!revins_on &&
@@ -9462,7 +9462,7 @@ ins_mousescroll(int dir)
}
# endif
- if (!equalpos(curwin->w_cursor, tpos))
+ if (!EQUAL_POS(curwin->w_cursor, tpos))
{
start_arrow(&tpos);
# ifdef FEAT_CINDENT
diff --git a/src/evalfunc.c b/src/evalfunc.c
index c30b57ba1..7e03d4d3e 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -9552,20 +9552,20 @@ do_searchpair(
save_cursor = curwin->w_cursor;
pos = curwin->w_cursor;
- clearpos(&firstpos);
- clearpos(&foundpos);
+ CLEAR_POS(&firstpos);
+ CLEAR_POS(&foundpos);
pat = pat3;
for (;;)
{
n = searchit(curwin, curbuf, &pos, dir, pat, 1L,
options, RE_SEARCH, lnum_stop, &tm);
- if (n == FAIL || (firstpos.lnum != 0 && equalpos(pos, firstpos)))
+ if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos)))
/* didn't find it or found the first match again: FAIL */
break;
if (firstpos.lnum == 0)
firstpos = pos;
- if (equalpos(pos, foundpos))
+ if (EQUAL_POS(pos, foundpos))
{
/* Found the same position again. Can happen with a pattern that
* has "\zs" at the end and searching backwards. Advance one
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index c38687d74..05575ef70 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -851,24 +851,41 @@ do_move(linenr_T line1, linenr_T line2, linenr_T dest)
* their final destination at the new text position -- webb
*/
last_line = curbuf->b_ml.ml_line_count;
- mark_adjust(line1, line2, last_line - line2, 0L);
- changed_lines(last_line - num_lines + 1, 0, last_line + 1, num_lines);
+ mark_adjust_nofold(line1, line2, last_line - line2, 0L);
if (dest >= line2)
{
- mark_adjust(line2 + 1, dest, -num_lines, 0L);
+ mark_adjust_nofold(line2 + 1, dest, -num_lines, 0L);
+#ifdef FEAT_FOLDING
+ win_T *win;
+ tabpage_T *tp;
+
+ FOR_ALL_TAB_WINDOWS(tp, win) {
+ if (win->w_buffer == curbuf)
+ foldSwapRange(&win->w_folds, line1, line2, dest + 1,
+ dest + num_lines);
+ }
+#endif
curbuf->b_op_start.lnum = dest - num_lines + 1;
curbuf->b_op_end.lnum = dest;
}
else
{
- mark_adjust(dest + 1, line1 - 1, num_lines, 0L);
+ mark_adjust_nofold(dest + 1, line1 - 1, num_lines, 0L);
+#ifdef FEAT_FOLDING
+ win_T *win;
+ tabpage_T *tp;
+
+ FOR_ALL_TAB_WINDOWS(tp, win) {
+ if (win->w_buffer == curbuf)
+ foldSwapRange(&win->w_folds, dest + 1, line1 - 1, line1, line2);
+ }
+#endif
curbuf->b_op_start.lnum = dest + 1;
curbuf->b_op_end.lnum = dest + num_lines;
}
curbuf->b_op_start.col = curbuf->b_op_end.col = 0;
- mark_adjust(last_line - num_lines + 1, last_line,
+ mark_adjust_nofold(last_line - num_lines + 1, last_line,
-(last_line - dest - extra), 0L);
- changed_lines(last_line - num_lines + 1, 0, last_line + 1, -extra);
/*
* Now we delete the original text -- webb
@@ -4211,7 +4228,7 @@ do_ecmd(
/* If autocommands change the cursor position or topline, we should
* keep it. Also when it moves within a line. */
- if (!equalpos(curwin->w_cursor, orig_pos))
+ if (!EQUAL_POS(curwin->w_cursor, orig_pos))
{
newlnum = curwin->w_cursor.lnum;
newcol = curwin->w_cursor.col;
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 918031914..d3fda24c8 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -234,7 +234,7 @@ getcmdline(
ccline.overstrike = FALSE; /* always start in insert mode */
#ifdef FEAT_SEARCH_EXTRA
- clearpos(&match_end);
+ CLEAR_POS(&match_end);
save_cursor = curwin->w_cursor; /* may be restored later */
search_start = curwin->w_cursor;
old_curswant = curwin->w_curswant;
@@ -1479,7 +1479,7 @@ getcmdline(
if (did_incsearch)
{
curwin->w_cursor = match_end;
- if (!equalpos(curwin->w_cursor, search_start))
+ if (!EQUAL_POS(curwin->w_cursor, search_start))
{
c = gchar_cursor();
/* If 'ignorecase' and 'smartcase' are set and the
@@ -1707,7 +1707,7 @@ getcmdline(
search_start = t;
(void)decl(&search_start);
}
- if (lt(t, search_start) && c == Ctrl_G)
+ if (LT_POS(t, search_start) && c == Ctrl_G)
{
/* wrap around */
search_start = t;
@@ -2007,7 +2007,7 @@ returncmd:
curwin->w_cursor = save_cursor;
else
{
- if (!equalpos(save_cursor, search_start))
+ if (!EQUAL_POS(save_cursor, search_start))
{
/* put the '" mark at the original position */
curwin->w_cursor = save_cursor;
diff --git a/src/fileio.c b/src/fileio.c
index 2001c0d9a..48955e01c 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -7118,7 +7118,7 @@ buf_reload(buf_T *buf, int orig_mode)
* the old contents. Can't use memory only, the file might be
* too big. Use a hidden buffer to move the buffer contents to.
*/
- if (bufempty() || saved == FAIL)
+ if (BUFEMPTY() || saved == FAIL)
savebuf = NULL;
else
{
@@ -7161,7 +7161,7 @@ buf_reload(buf_T *buf, int orig_mode)
{
/* Put the text back from the save buffer. First
* delete any lines that readfile() added. */
- while (!bufempty())
+ while (!BUFEMPTY())
if (ml_delete(buf->b_ml.ml_line_count, FALSE) == FAIL)
break;
(void)move_lines(savebuf, buf);
diff --git a/src/fold.c b/src/fold.c
index d75e93700..db8da63ed 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -1039,7 +1039,7 @@ foldAdjustVisual(void)
if (!VIsual_active || !hasAnyFolding(curwin))
return;
- if (ltoreq(VIsual, curwin->w_cursor))
+ if (LTOREQ_POS(VIsual, curwin->w_cursor))
{
start = &VIsual;
end = &curwin->w_cursor;
diff --git a/src/gui.c b/src/gui.c
index 203035f5d..36d6975ed 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -4476,7 +4476,7 @@ gui_do_scroll(void)
pum_redraw();
#endif
- return (wp == curwin && !equalpos(curwin->w_cursor, old_cursor));
+ return (wp == curwin && !EQUAL_POS(curwin->w_cursor, old_cursor));
}
@@ -5118,7 +5118,7 @@ gui_update_screen(void)
curwin->w_p_cole > 0
# endif
)
- && !equalpos(last_cursormoved, curwin->w_cursor))
+ && !EQUAL_POS(last_cursormoved, curwin->w_cursor))
{
# ifdef FEAT_AUTOCMD
if (has_cursormoved())
diff --git a/src/gui_beval.c b/src/gui_beval.c
index dd619450e..c06e75a09 100644
--- a/src/gui_beval.c
+++ b/src/gui_beval.c
@@ -84,7 +84,7 @@ general_beval_cb(BalloonEval *beval, int state UNUSED)
result = eval_to_string(bexpr, NULL, TRUE);
/* Remove one trailing newline, it is added when the result was a
- * list and it's hardly every useful. If the user really wants a
+ * list and it's hardly ever useful. If the user really wants a
* trailing newline he can add two and one remains. */
if (result != NULL)
{
@@ -366,7 +366,7 @@ get_beval_info(
if (VIsual_active)
{
- if (lt(VIsual, curwin->w_cursor))
+ if (LT_POS(VIsual, curwin->w_cursor))
{
spos = &VIsual;
epos = &curwin->w_cursor;
diff --git a/src/if_perl.xs b/src/if_perl.xs
index ecb9726e3..076c5c601 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -1288,7 +1288,7 @@ ex_perldo(exarg_T *eap)
linenr_T i;
buf_T *was_curbuf = curbuf;
- if (bufempty())
+ if (BUFEMPTY())
return;
if (perl_interp == NULL)
diff --git a/src/macros.h b/src/macros.h
index faa8ccc9c..559a4bef0 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -11,46 +11,46 @@
*/
/*
- * pchar(lp, c) - put character 'c' at position 'lp'
+ * PCHAR(lp, c) - put character 'c' at position 'lp'
*/
-#define pchar(lp, c) (*(ml_get_buf(curbuf, (lp).lnum, TRUE) + (lp).col) = (c))
+#define PCHAR(lp, c) (*(ml_get_buf(curbuf, (lp).lnum, TRUE) + (lp).col) = (c))
/*
* Position comparisons
*/
#ifdef FEAT_VIRTUALEDIT
-# define lt(a, b) (((a).lnum != (b).lnum) \
+# define LT_POS(a, b) (((a).lnum != (b).lnum) \
? (a).lnum < (b).lnum \
: (a).col != (b).col \
? (a).col < (b).col \
: (a).coladd < (b).coladd)
-# define ltp(a, b) (((a)->lnum != (b)->lnum) \
+# define LT_POSP(a, b) (((a)->lnum != (b)->lnum) \
? (a)->lnum < (b)->lnum \
: (a)->col != (b)->col \
? (a)->col < (b)->col \
: (a)->coladd < (b)->coladd)
-# define equalpos(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && ((a).coladd == (b).coladd))
-# define clearpos(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0;}
+# define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && ((a).coladd == (b).coladd))
+# define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0;}
#else
-# define lt(a, b) (((a).lnum != (b).lnum) \
+# define LT_POS(a, b) (((a).lnum != (b).lnum) \
? ((a).lnum < (b).lnum) : ((a).col < (b).col))
-# define ltp(a, b) (((a)->lnum != (b)->lnum) \
+# define LT_POSP(a, b) (((a)->lnum != (b)->lnum) \
? ((a)->lnum < (b)->lnum) : ((a)->col < (b)->col))
-# define equalpos(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col))
-# define clearpos(a) {(a)->lnum = 0; (a)->col = 0;}
+# define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col))
+# define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0;}
#endif
-#define ltoreq(a, b) (lt(a, b) || equalpos(a, b))
+#define LTOREQ_POS(a, b) (LT_POS(a, b) || EQUAL_POS(a, b))
/*
- * lineempty() - return TRUE if the line is empty
+ * LINEEMPTY() - return TRUE if the line is empty
*/
-#define lineempty(p) (*ml_get(p) == NUL)
+#define LINEEMPTY(p) (*ml_get(p) == NUL)
/*
- * bufempty() - return TRUE if the current buffer is empty
+ * BUFEMPTY() - return TRUE if the current buffer is empty
*/
-#define bufempty() (curbuf->b_ml.ml_line_count == 1 && *ml_get((linenr_T)1) == NUL)
+#define BUFEMPTY() (curbuf->b_ml.ml_line_count == 1 && *ml_get((linenr_T)1) == NUL)
/*
* toupper() and tolower() that use the current locale.
diff --git a/src/main.c b/src/main.c
index 2f8d291bf..f96bca99d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1144,7 +1144,7 @@ main_loop(
# endif
)
# ifdef FEAT_AUTOCMD
- && !equalpos(last_cursormoved, curwin->w_cursor)
+ && !EQUAL_POS(last_cursormoved, curwin->w_cursor)
# endif
)
{
@@ -3557,8 +3557,11 @@ set_progpath(char_u *argv0)
&& vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL)
val = buf;
}
+# endif
# endif
+
set_vim_var_string(VV_PROGPATH, val, -1);
+
# ifdef WIN32
vim_free(path);
# endif
diff --git a/src/mark.c b/src/mark.c
index 59ac01dc5..0265160ab 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -206,7 +206,7 @@ setpcmark(void)
checkpcmark(void)
{
if (curwin->w_prev_pcmark.lnum != 0
- && (equalpos(curwin->w_pcmark, curwin->w_cursor)
+ && (EQUAL_POS(curwin->w_pcmark, curwin->w_cursor)
|| curwin->w_pcmark.lnum == 0))
{
curwin->w_pcmark = curwin->w_prev_pcmark;
@@ -401,7 +401,7 @@ getmark_buf_fnum(
{
startp = &buf->b_visual.vi_start;
endp = &buf->b_visual.vi_end;
- if (((c == '<') == lt(*startp, *endp) || endp->lnum == 0)
+ if (((c == '<') == LT_POS(*startp, *endp) || endp->lnum == 0)
&& startp->lnum != 0)
posp = startp;
else
@@ -497,14 +497,14 @@ getnextmark(
{
if (dir == FORWARD)
{
- if ((result == NULL || lt(curbuf->b_namedm[i], *result))
- && lt(pos, curbuf->b_namedm[i]))
+ if ((result == NULL || LT_POS(curbuf->b_namedm[i], *result))
+ && LT_POS(pos, curbuf->b_namedm[i]))
result = &curbuf->b_namedm[i];
}
else
{
- if ((result == NULL || lt(*result, curbuf->b_namedm[i]))
- && lt(curbuf->b_namedm[i], pos))
+ if ((result == NULL || LT_POS(*result, curbuf->b_namedm[i]))
+ && LT_POS(curbuf->b_namedm[i], pos))
result = &curbuf->b_namedm[i];
}
}
@@ -1063,7 +1063,7 @@ mark_adjust(
one_adjust(&(curbuf->b_last_change.lnum));
/* last cursor position, if it was set */
- if (!equalpos(curbuf->b_last_cursor, initpos))
+ if (!EQUAL_POS(curbuf->b_last_cursor, initpos))
one_adjust(&(curbuf->b_last_cursor.lnum));
@@ -1838,7 +1838,8 @@ write_buffer_marks(buf_T *buf, FILE *fp_out)
for (i = 0; i < buf->b_changelistlen; ++i)
{
/* skip duplicates */
- if (i == 0 || !equalpos(buf->b_changelist[i - 1], buf->b_changelist[i]))
+ if (i == 0 || !EQUAL_POS(buf->b_changelist[i - 1],
+ buf->b_changelist[i]))
write_one_mark(fp_out, '+', &buf->b_changelist[i]);
}
#endif
diff --git a/src/misc1.c b/src/misc1.c
index c6b8d13b7..e862219ab 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -5272,7 +5272,8 @@ ind_find_start_CORS(void) /* XXX */
/* If comment_pos is before rs_pos the raw string is inside the comment.
* If rs_pos is before comment_pos the comment is inside the raw string. */
- if (comment_pos == NULL || (rs_pos != NULL && lt(*rs_pos, *comment_pos)))
+ if (comment_pos == NULL || (rs_pos != NULL
+ && LT_POS(*rs_pos, *comment_pos)))
return rs_pos;
return comment_pos;
}
@@ -7217,7 +7218,8 @@ get_c_indent(void)
comment_pos = &tryposCopy;
}
trypos = find_start_rawstring(curbuf->b_ind_maxcomment);
- if (trypos != NULL && (comment_pos == NULL || lt(*trypos, *comment_pos)))
+ if (trypos != NULL && (comment_pos == NULL
+ || LT_POS(*trypos, *comment_pos)))
{
amount = -1;
goto laterend;
@@ -9352,7 +9354,7 @@ get_lisp_indent(void)
{
paren = *pos;
pos = findmatch(NULL, '[');
- if (pos == NULL || ltp(pos, &paren))
+ if (pos == NULL || LT_POSP(pos, &paren))
pos = &paren;
}
if (pos != NULL)
diff --git a/src/move.c b/src/move.c
index c4f21a786..3d6d2ec8f 100644
--- a/src/move.c
+++ b/src/move.c
@@ -210,7 +210,7 @@ update_topline(void)
/*
* If the buffer is empty, always set topline to 1.
*/
- if (bufempty()) /* special case - file is empty */
+ if (BUFEMPTY()) /* special case - file is empty */
{
if (curwin->w_topline != 1)
redraw_later(NOT_VALID);
diff --git a/src/normal.c b/src/normal.c
index c8385f6a8..7701fcf5b 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1540,7 +1540,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
if (VIsual_select && VIsual_mode == 'V'
&& cap->oap->op_type != OP_DELETE)
{
- if (lt(VIsual, curwin->w_cursor))
+ if (LT_POS(VIsual, curwin->w_cursor))
{
VIsual.col = 0;
curwin->w_cursor.col =
@@ -1572,7 +1572,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
* Set oap->start to the first position of the operated text, oap->end
* to the end of the operated text. w_cursor is equal to oap->start.
*/
- if (lt(oap->start, curwin->w_cursor))
+ if (LT_POS(oap->start, curwin->w_cursor))
{
#ifdef FEAT_FOLDING
/* Include folded lines completely. */
@@ -1776,7 +1776,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
&& (!oap->inclusive
|| (oap->op_type == OP_YANK
&& gchar_pos(&oap->end) == NUL))
- && equalpos(oap->start, oap->end)
+ && EQUAL_POS(oap->start, oap->end)
#ifdef FEAT_VIRTUALEDIT
&& !(virtual_op && oap->start.coladd != oap->end.coladd)
#endif
@@ -2683,12 +2683,12 @@ do_mouse(
jump_flags = MOUSE_MAY_STOP_VIS;
else
{
- if ((lt(curwin->w_cursor, VIsual)
- && (lt(m_pos, curwin->w_cursor)
- || lt(VIsual, m_pos)))
- || (lt(VIsual, curwin->w_cursor)
- && (lt(m_pos, VIsual)
- || lt(curwin->w_cursor, m_pos))))
+ if ((LT_POS(curwin->w_cursor, VIsual)
+ && (LT_POS(m_pos, curwin->w_cursor)
+ || LT_POS(VIsual, m_pos)))
+ || (LT_POS(VIsual, curwin->w_cursor)
+ && (LT_POS(m_pos, VIsual)
+ || LT_POS(curwin->w_cursor, m_pos))))
{
jump_flags = MOUSE_MAY_STOP_VIS;
}
@@ -2754,7 +2754,7 @@ do_mouse(
* Remember the start and end of visual before moving the
* cursor.
*/
- if (lt(curwin->w_cursor, VIsual))
+ if (LT_POS(curwin->w_cursor, VIsual))
{
start_visual = curwin->w_cursor;
end_visual = VIsual;
@@ -2891,9 +2891,9 @@ do_mouse(
* If the click is after the end of visual, change the end. If
* the click is inside the visual, change the closest side.
*/
- if (lt(curwin->w_cursor, start_visual))
+ if (LT_POS(curwin->w_cursor, start_visual))
VIsual = end_visual;
- else if (lt(end_visual, curwin->w_cursor))
+ else if (LT_POS(end_visual, curwin->w_cursor))
VIsual = start_visual;
else
{
@@ -3097,7 +3097,7 @@ do_mouse(
if (oap != NULL
&& VIsual_mode == 'v'
&& !vim_iswordc(gchar_pos(&end_visual))
- && equalpos(curwin->w_cursor, VIsual)
+ && EQUAL_POS(curwin->w_cursor, VIsual)
&& (pos = findmatch(oap, NUL)) != NULL)
{
curwin->w_cursor = *pos;
@@ -3105,7 +3105,7 @@ do_mouse(
VIsual_mode = 'V';
else if (*p_sel == 'e')
{
- if (lt(curwin->w_cursor, VIsual))
+ if (LT_POS(curwin->w_cursor, VIsual))
++VIsual.col;
else
++curwin->w_cursor.col;
@@ -3117,7 +3117,7 @@ do_mouse(
{
/* When not found a match or when dragging: extend to include
* a word. */
- if (lt(curwin->w_cursor, orig_cursor))
+ if (LT_POS(curwin->w_cursor, orig_cursor))
{
find_start_of_word(&curwin->w_cursor);
find_end_of_word(&VIsual);
@@ -3745,7 +3745,7 @@ clear_showcmd(void)
if (VIsual_active && !char_avail())
{
- int cursor_bot = lt(VIsual, curwin->w_cursor);
+ int cursor_bot = LT_POS(VIsual, curwin->w_cursor);
long lines;
colnr_T leftcol, rightcol;
linenr_T top, bot;
@@ -4353,7 +4353,7 @@ find_decl(
curwin->w_cursor.col = 0;
/* Search forward for the identifier, ignore comment lines. */
- clearpos(&found_pos);
+ CLEAR_POS(&found_pos);
for (;;)
{
valid = FALSE;
@@ -4419,13 +4419,10 @@ find_decl(
* declarations this skips the function header without types. */
if (!valid)
{
- /* Braces needed due to macro expansion of clearpos. */
- clearpos(&found_pos);
+ CLEAR_POS(&found_pos);
}
else
- {
found_pos = curwin->w_cursor;
- }
/* Remove SEARCH_START from flags to avoid getting stuck at one
* position. */
searchflags &= ~SEARCH_START;
@@ -5834,7 +5831,7 @@ get_visual_text(
}
else
{
- if (lt(curwin->w_cursor, VIsual))
+ if (LT_POS(curwin->w_cursor, VIsual))
{
*pp = ml_get_pos(&curwin->w_cursor);
*lenp = VIsual.col - curwin->w_cursor.col + 1;
@@ -6020,7 +6017,7 @@ nv_right(cmdarg_T *cap)
* included, move to next line after that */
if ( cap->oap->op_type != OP_NOP
&& !cap->oap->inclusive
- && !lineempty(curwin->w_cursor.lnum))
+ && !LINEEMPTY(curwin->w_cursor.lnum))
cap->oap->inclusive = TRUE;
else
{
@@ -6042,7 +6039,7 @@ nv_right(cmdarg_T *cap)
}
else
{
- if (!lineempty(curwin->w_cursor.lnum))
+ if (!LINEEMPTY(curwin->w_cursor.lnum))
cap->oap->inclusive = TRUE;
}
break;
@@ -6121,7 +6118,7 @@ nv_left(cmdarg_T *cap)
* Don't adjust op_end now, otherwise it won't work. */
if ( (cap->oap->op_type == OP_DELETE
|| cap->oap->op_type == OP_CHANGE)
- && !lineempty(curwin->w_cursor.lnum))
+ && !LINEEMPTY(curwin->w_cursor.lnum))
{
char_u *cp = ml_get_cursor();
@@ -6333,7 +6330,7 @@ nv_search(cmdarg_T *cap)
}
(void)normal_search(cap, cap->cmdchar, cap->searchbuf,
- (cap->arg || !equalpos(save_cursor, curwin->w_cursor))
+ (cap->arg || !EQUAL_POS(save_cursor, curwin->w_cursor))
? 0 : SEARCH_MARK);
}
@@ -6347,7 +6344,7 @@ nv_next(cmdarg_T *cap)
pos_T old = curwin->w_cursor;
int i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg);
- if (i == 1 && equalpos(old, curwin->w_cursor))
+ if (i == 1 && EQUAL_POS(old, curwin->w_cursor))
{
/* Avoid getting stuck on the current cursor position, which can
* happen when an offset is given and the cursor is on the last char
@@ -6689,9 +6686,9 @@ nv_brackets(cmdarg_T *cap)
if (VIsual_active)
{
- start = ltoreq(VIsual, curwin->w_cursor)
+ start = LTOREQ_POS(VIsual, curwin->w_cursor)
? VIsual : curwin->w_cursor;
- end = equalpos(start,VIsual) ? curwin->w_cursor : VIsual;
+ end = EQUAL_POS(start,VIsual) ? curwin->w_cursor : VIsual;
curwin->w_cursor = (dir == BACKWARD ? start : end);
}
# ifdef FEAT_CLIPBOARD
@@ -7315,7 +7312,7 @@ n_swapchar(cmdarg_T *cap)
if (checkclearopq(cap->oap))
return;
- if (lineempty(curwin->w_cursor.lnum) && vim_strchr(p_ww, '~') == NULL)
+ if (LINEEMPTY(curwin->w_cursor.lnum) && vim_strchr(p_ww, '~') == NULL)
{
clearopbeep(cap->oap);
return;
@@ -7559,7 +7556,7 @@ nv_gomark(cmdarg_T *cap)
#ifdef FEAT_FOLDING
if (cap->oap->op_type == OP_NOP
&& pos != NULL
- && (pos == (pos_T *)-1 || !equalpos(old_cursor, *pos))
+ && (pos == (pos_T *)-1 || !EQUAL_POS(old_cursor, *pos))
&& (fdo_flags & FDO_MARK)
&& old_KeyTyped)
foldOpenCursor();
@@ -8763,7 +8760,7 @@ nv_wordcmd(cmdarg_T *cap)
/* Don't leave the cursor on the NUL past the end of line. Unless we
* didn't move it forward. */
- if (lt(startpos, curwin->w_cursor))
+ if (LT_POS(startpos, curwin->w_cursor))
adjust_cursor(cap->oap);
if (n == FAIL && cap->oap->op_type == OP_NOP)
@@ -8833,7 +8830,7 @@ nv_beginline(cmdarg_T *cap)
adjust_for_sel(cmdarg_T *cap)
{
if (VIsual_active && cap->oap->inclusive && *p_sel == 'e'
- && gchar_cursor() != NUL && lt(VIsual, curwin->w_cursor))
+ && gchar_cursor() != NUL && LT_POS(VIsual, curwin->w_cursor))
{
#ifdef FEAT_MBYTE
if (has_mbyte)
@@ -8855,9 +8852,9 @@ unadjust_for_sel(void)
{
pos_T *pp;
- if (*p_sel == 'e' && !equalpos(VIsual, curwin->w_cursor))
+ if (*p_sel == 'e' && !EQUAL_POS(VIsual, curwin->w_cursor))
{
- if (lt(VIsual, curwin->w_cursor))
+ if (LT_POS(VIsual, curwin->w_cursor))
pp = &curwin->w_cursor;
else
pp = &VIsual;
@@ -9071,8 +9068,8 @@ nv_edit(cmdarg_T *cap)
/* When the last char in the line was deleted then append. Detect this
* by checking if the cursor moved to before the Visual area. */
- if (*ml_get_cursor() != NUL && lt(curwin->w_cursor, old_pos)
- && lt(curwin->w_cursor, old_visual))
+ if (*ml_get_cursor() != NUL && LT_POS(curwin->w_cursor, old_pos)
+ && LT_POS(curwin->w_cursor, old_visual))
inc_cursor();
/* Insert to replace the deleted text with the pasted text. */
diff --git a/src/ops.c b/src/ops.c
index 757c11549..8b883aa30 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -2190,7 +2190,7 @@ op_replace(oparg_T *oap, int c)
else if (!oap->inclusive)
dec(&(oap->end));
- while (ltoreq(curwin->w_cursor, oap->end))
+ while (LTOREQ_POS(curwin->w_cursor, oap->end))
{
n = gchar_cursor();
if (n != NUL)
@@ -2229,7 +2229,7 @@ op_replace(oparg_T *oap, int c)
getvpos(&oap->end, end_vcol);
}
#endif
- pchar(curwin->w_cursor, c);
+ PCHAR(curwin->w_cursor, c);
}
}
#ifdef FEAT_VIRTUALEDIT
@@ -2248,7 +2248,7 @@ op_replace(oparg_T *oap, int c)
curwin->w_cursor.col -= (virtcols + 1);
for (; virtcols >= 0; virtcols--)
{
- pchar(curwin->w_cursor, c);
+ PCHAR(curwin->w_cursor, c);
if (inc(&curwin->w_cursor) == -1)
break;
}
@@ -2338,7 +2338,7 @@ op_tilde(oparg_T *oap)
did_change |= swapchars(oap->op_type, &pos,
pos.lnum == oap->end.lnum ? oap->end.col + 1:
(int)STRLEN(ml_get_pos(&pos)));
- if (ltoreq(oap->end, pos) || inc(&pos) == -1)
+ if (LTOREQ_POS(oap->end, pos) || inc(&pos) == -1)
break;
}
if (did_change)
@@ -2490,7 +2490,7 @@ swapchar(int op_type, pos_T *pos)
}
else
#endif
- pchar(*pos, nc);
+ PCHAR(*pos, nc);
return TRUE;
}
return FALSE;
@@ -2575,7 +2575,7 @@ op_insert(oparg_T *oap, long count1)
check_cursor_col();
/* Works just like an 'i'nsert on the next character. */
- if (!lineempty(curwin->w_cursor.lnum)
+ if (!LINEEMPTY(curwin->w_cursor.lnum)
&& oap->start_vcol != oap->end_vcol)
inc_cursor();
}
@@ -2588,7 +2588,7 @@ op_insert(oparg_T *oap, long count1)
* have been converted to a tab as well, the column of the cursor
* might have actually been reduced, so need to adjust here. */
if (t1.lnum == curbuf->b_op_start_orig.lnum
- && lt(curbuf->b_op_start_orig, t1))
+ && LT_POS(curbuf->b_op_start_orig, t1))
oap->start = curbuf->b_op_start_orig;
/* If user has moved off this line, we don't know what to do, so do
@@ -2735,7 +2735,7 @@ op_change(oparg_T *oap)
else if (op_delete(oap) == FAIL)
return FALSE;
- if ((l > curwin->w_cursor.col) && !lineempty(curwin->w_cursor.lnum)
+ if ((l > curwin->w_cursor.col) && !LINEEMPTY(curwin->w_cursor.lnum)
&& !virtual_op)
inc_cursor();
@@ -3519,7 +3519,7 @@ do_put(
++lnum;
/* In an empty buffer the empty line is going to be replaced, include
* it in the saved lines. */
- if ((bufempty() ? u_save(0, 2) : u_save(lnum - 1, lnum)) == FAIL)
+ if ((BUFEMPTY() ? u_save(0, 2) : u_save(lnum - 1, lnum)) == FAIL)
goto end;
#ifdef FEAT_FOLDING
if (dir == FORWARD)
@@ -4936,7 +4936,7 @@ format_lines(
&& prev_is_end_par
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
{
- if (do_second_indent && !lineempty(curwin->w_cursor.lnum + 1))
+ if (do_second_indent && !LINEEMPTY(curwin->w_cursor.lnum + 1))
{
#ifdef FEAT_COMMENTS
if (leader_len == 0 && next_leader_len == 0)
@@ -7237,7 +7237,7 @@ cursor_pos_info(dict_T *dict)
if (VIsual_active)
{
- if (lt(VIsual, curwin->w_cursor))
+ if (LT_POS(VIsual, curwin->w_cursor))
{
min_pos = VIsual;
max_pos = curwin->w_cursor;
diff --git a/src/option.c b/src/option.c
index 2e2f0f1a6..2c4b1c247 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4170,7 +4170,7 @@ set_init_3(void)
}
#endif
- if (bufempty())
+ if (BUFEMPTY())
{
int idx_ffs = findoption((char_u *)"ffs");
diff --git a/src/popupmnu.c b/src/popupmnu.c
index 307dbbedc..fc5e1c32b 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -590,7 +590,7 @@ pum_set_selected(int n, int repeat)
&& curbuf->b_p_bh[0] == 'w')
{
/* Already a "wipeout" buffer, make it empty. */
- while (!bufempty())
+ while (!BUFEMPTY())
ml_delete((linenr_T)1, FALSE);
}
else
diff --git a/src/regexp.c b/src/regexp.c
index 78d643174..b33c08b4d 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -4150,7 +4150,7 @@ reg_match_visual(void)
if (VIsual_active)
{
- if (lt(VIsual, wp->w_cursor))
+ if (LT_POS(VIsual, wp->w_cursor))
{
top = VIsual;
bot = wp->w_cursor;
@@ -4164,7 +4164,7 @@ reg_match_visual(void)
}
else
{
- if (lt(curbuf->b_visual.vi_start, curbuf->b_visual.vi_end))
+ if (LT_POS(curbuf->b_visual.vi_start, curbuf->b_visual.vi_end))
{
top = curbuf->b_visual.vi_start;
bot = curbuf->b_visual.vi_end;
diff --git a/src/screen.c b/src/screen.c
index 564eba397..306308b0a 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2714,7 +2714,7 @@ fold_line(
*/
if (VIsual_active && wp->w_buffer == curwin->w_buffer)
{
- if (ltoreq(curwin->w_cursor, VIsual))
+ if (LTOREQ_POS(curwin->w_cursor, VIsual))
{
/* Visual is after curwin->w_cursor */
top = &curwin->w_cursor;
@@ -3170,7 +3170,7 @@ win_line(
if (VIsual_active && wp->w_buffer == curwin->w_buffer)
{
/* Visual is after curwin->w_cursor */
- if (ltoreq(curwin->w_cursor, VIsual))
+ if (LTOREQ_POS(curwin->w_cursor, VIsual))
{
top = &curwin->w_cursor;
bot = &VIsual;
diff --git a/src/search.c b/src/search.c
index f4a5c6dcd..101bcff05 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2100,7 +2100,7 @@ findmatchlimit(
do_quotes = -1;
start_in_quotes = MAYBE;
- clearpos(&match_pos);
+ CLEAR_POS(&match_pos);
/* backward search: Check if this line contains a single-line comment */
if ((backwards && comment_dir)
@@ -2720,7 +2720,7 @@ findsent(int dir, long count)
if (decl(&pos) == -1)
break;
/* when going forward: Stop in front of empty line */
- if (lineempty(pos.lnum) && dir == FORWARD)
+ if (LINEEMPTY(pos.lnum) && dir == FORWARD)
{
incl(&pos);
goto found;
@@ -3082,7 +3082,7 @@ bck_word(long count, int bigword, int stop)
while (cls() == 0)
{
if (curwin->w_cursor.col == 0
- && lineempty(curwin->w_cursor.lnum))
+ && LINEEMPTY(curwin->w_cursor.lnum))
goto finished;
if (dec_cursor() == -1) /* hit start of file, stop here */
return OK;
@@ -3163,7 +3163,7 @@ end_word(
while (cls() == 0)
{
if (empty && curwin->w_cursor.col == 0
- && lineempty(curwin->w_cursor.lnum))
+ && LINEEMPTY(curwin->w_cursor.lnum))
goto finished;
if (inc_cursor() == -1) /* hit end of file, stop here */
return FAIL;
@@ -3223,7 +3223,7 @@ bckend_word(
*/
while (cls() == 0)
{
- if (curwin->w_cursor.col == 0 && lineempty(curwin->w_cursor.lnum))
+ if (curwin->w_cursor.col == 0 && LINEEMPTY(curwin->w_cursor.lnum))
break;
if ((i = dec_cursor()) == -1 || (eol && i == 1))
return OK;
@@ -3320,17 +3320,17 @@ current_word(
int include_white = FALSE;
cls_bigword = bigword;
- clearpos(&start_pos);
+ CLEAR_POS(&start_pos);
/* Correct cursor when 'selection' is exclusive */
- if (VIsual_active && *p_sel == 'e' && lt(VIsual, curwin->w_cursor))
+ if (VIsual_active && *p_sel == 'e' && LT_POS(VIsual, curwin->w_cursor))
dec_cursor();
/*
* When Visual mode is not active, or when the VIsual area is only one
* character, select the word and/or white space under the cursor.
*/
- if (!VIsual_active || equalpos(curwin->w_cursor, VIsual))
+ if (!VIsual_active || EQUAL_POS(curwin->w_cursor, VIsual))
{
/*
* Go to start of current word or white space.
@@ -3387,7 +3387,7 @@ current_word(
while (count > 0)
{
inclusive = TRUE;
- if (VIsual_active && lt(curwin->w_cursor, VIsual))
+ if (VIsual_active && LT_POS(curwin->w_cursor, VIsual))
{
/*
* In Visual mode, with cursor at start: move cursor back.
@@ -3463,7 +3463,7 @@ current_word(
if (VIsual_active)
{
- if (*p_sel == 'e' && inclusive && ltoreq(VIsual, curwin->w_cursor))
+ if (*p_sel == 'e' && inclusive && LTOREQ_POS(VIsual, curwin->w_cursor))
inc_cursor();
if (VIsual_mode == 'V')
{
@@ -3498,10 +3498,10 @@ current_sent(oparg_T *oap, long count, int include)
/*
* When the Visual area is bigger than one character: Extend it.
*/
- if (VIsual_active && !equalpos(start_pos, VIsual))
+ if (VIsual_active && !EQUAL_POS(start_pos, VIsual))
{
extend:
- if (lt(start_pos, VIsual))
+ if (LT_POS(start_pos, VIsual))
{
/*
* Cursor at start of Visual area.
@@ -3512,7 +3512,7 @@ extend:
*/
at_start_sent = TRUE;
decl(&pos);
- while (lt(pos, curwin->w_cursor))
+ while (LT_POS(pos, curwin->w_cursor))
{
c = gchar_pos(&pos);
if (!vim_iswhite(c))
@@ -3525,7 +3525,7 @@ extend:
if (!at_start_sent)
{
findsent(BACKWARD, 1L);
- if (equalpos(curwin->w_cursor, start_pos))
+ if (EQUAL_POS(curwin->w_cursor, start_pos))
at_start_sent = TRUE; /* exactly at start of sentence */
else
/* inside a sentence, go to its end (start of next) */
@@ -3554,10 +3554,11 @@ extend:
*/
incl(&pos);
at_start_sent = TRUE;
- if (!equalpos(pos, curwin->w_cursor)) /* not just before a sentence */
+ /* not just before a sentence */
+ if (!EQUAL_POS(pos, curwin->w_cursor))
{
at_start_sent = FALSE;
- while (lt(pos, curwin->w_cursor))
+ while (LT_POS(pos, curwin->w_cursor))
{
c = gchar_pos(&pos);
if (!vim_iswhite(c))
@@ -3588,7 +3589,7 @@ extend:
*/
while (c = gchar_pos(&pos), vim_iswhite(c)) /* vim_iswhite() is a macro */
incl(&pos);
- if (equalpos(pos, curwin->w_cursor))
+ if (EQUAL_POS(pos, curwin->w_cursor))
{
start_blank = TRUE;
find_first_blank(&start_pos); /* go back to first blank */
@@ -3633,7 +3634,7 @@ extend:
if (VIsual_active)
{
/* Avoid getting stuck with "is" on a single space before a sentence. */
- if (equalpos(start_pos, curwin->w_cursor))
+ if (EQUAL_POS(start_pos, curwin->w_cursor))
goto extend;
if (*p_sel == 'e')
++curwin->w_cursor.col;
@@ -3682,7 +3683,7 @@ current_block(
/*
* If we start on '(', '{', ')', '}', etc., use the whole block inclusive.
*/
- if (!VIsual_active || equalpos(VIsual, curwin->w_cursor))
+ if (!VIsual_active || EQUAL_POS(VIsual, curwin->w_cursor))
{
setpcmark();
if (what == '{') /* ignore indent */
@@ -3693,7 +3694,7 @@ current_block(
/* cursor on '(' or '{', move cursor just after it */
++curwin->w_cursor.col;
}
- else if (lt(VIsual, curwin->w_cursor))
+ else if (LT_POS(VIsual, curwin->w_cursor))
{
old_start = VIsual;
curwin->w_cursor = VIsual; /* cursor at low end of Visual */
@@ -3751,7 +3752,7 @@ current_block(
* In Visual mode, when the resulting area is not bigger than what we
* started with, extend it to the next block, and then exclude again.
*/
- if (!lt(start_pos, old_start) && !lt(old_end, curwin->w_cursor)
+ if (!LT_POS(start_pos, old_start) && !LT_POS(old_end, curwin->w_cursor)
&& VIsual_active)
{
curwin->w_cursor = old_start;
@@ -3792,7 +3793,7 @@ current_block(
oap->inclusive = FALSE;
if (sol)
incl(&curwin->w_cursor);
- else if (ltoreq(start_pos, curwin->w_cursor))
+ else if (LTOREQ_POS(start_pos, curwin->w_cursor))
/* Include the character under the cursor. */
oap->inclusive = TRUE;
else
@@ -3916,7 +3917,7 @@ current_tagblock(
/*
* If we start on "<aaa>" select that block.
*/
- if (!VIsual_active || equalpos(VIsual, curwin->w_cursor))
+ if (!VIsual_active || EQUAL_POS(VIsual, curwin->w_cursor))
{
setpcmark();
@@ -3942,7 +3943,7 @@ current_tagblock(
old_end = curwin->w_cursor;
}
}
- else if (lt(VIsual, curwin->w_cursor))
+ else if (LT_POS(VIsual, curwin->w_cursor))
{
old_start = VIsual;
curwin->w_cursor = VIsual; /* cursor at low end of Visual */
@@ -3999,7 +4000,7 @@ again:
vim_free(spat);
vim_free(epat);
- if (r < 1 || lt(curwin->w_cursor, old_end))
+ if (r < 1 || LT_POS(curwin->w_cursor, old_end))
{
/* Can't find other end or it's before the previous end. Could be a
* HTML tag that doesn't have a matching end. Search backwards for
@@ -4046,7 +4047,7 @@ again:
/* If we now have the same text as before reset "do_include" and try
* again. */
- if (equalpos(start_pos, old_start) && equalpos(end_pos, old_end))
+ if (EQUAL_POS(start_pos, old_start) && EQUAL_POS(end_pos, old_end))
{
do_include = TRUE;
curwin->w_cursor = old_start;
@@ -4059,7 +4060,7 @@ again:
{
/* If the end is before the start there is no text between tags, select
* the char under the cursor. */
- if (lt(end_pos, start_pos))
+ if (LT_POS(end_pos, start_pos))
curwin->w_cursor = start_pos;
else if (*p_sel == 'e')
inc_cursor();
@@ -4072,7 +4073,7 @@ again:
{
oap->start = start_pos;
oap->motion_type = MCHAR;
- if (lt(end_pos, start_pos))
+ if (LT_POS(end_pos, start_pos))
{
/* End is before the start: there is no text between tags; operate
* on an empty area. */
@@ -4362,10 +4363,10 @@ current_quote(
if (VIsual.lnum != curwin->w_cursor.lnum)
return FALSE;
- vis_bef_curs = lt(VIsual, curwin->w_cursor);
+ vis_bef_curs = LT_POS(VIsual, curwin->w_cursor);
if (*p_sel == 'e' && vis_bef_curs)
dec_cursor();
- vis_empty = equalpos(VIsual, curwin->w_cursor);
+ vis_empty = EQUAL_POS(VIsual, curwin->w_cursor);
}
if (!vis_empty)
@@ -4605,7 +4606,7 @@ current_search(
p_ws = FALSE;
/* Correct cursor when 'selection' is exclusive */
- if (VIsual_active && *p_sel == 'e' && lt(VIsual, curwin->w_cursor))
+ if (VIsual_active && *p_sel == 'e' && LT_POS(VIsual, curwin->w_cursor))
dec_cursor();
if (VIsual_active)
@@ -4668,12 +4669,14 @@ current_search(
}
else if (!i && !result)
{
- if (forward) /* try again from start of buffer */
+ if (forward)
{
- clearpos(&pos);
+ /* try again from start of buffer */
+ CLEAR_POS(&pos);
}
- else /* try again from end of buffer */
+ else
{
+ /* try again from end of buffer */
/* searching backwards, so set pos to last line and col */
pos.lnum = curwin->w_buffer->b_ml.ml_line_count;
pos.col = (colnr_T)STRLEN(
@@ -4709,9 +4712,9 @@ current_search(
if (*p_sel == 'e')
{
/* Correction for exclusive selection depends on the direction. */
- if (forward && ltoreq(VIsual, curwin->w_cursor))
+ if (forward && LTOREQ_POS(VIsual, curwin->w_cursor))
inc_cursor();
- else if (!forward && ltoreq(curwin->w_cursor, VIsual))
+ else if (!forward && LTOREQ_POS(curwin->w_cursor, VIsual))
inc(&VIsual);
}
@@ -4764,7 +4767,9 @@ is_one_char(char_u *pattern, int move)
regmatch.startpos[0].col = -1;
/* move to match */
if (move)
- clearpos(&pos)
+ {
+ CLEAR_POS(&pos);
+ }
else
{
pos = curwin->w_cursor;
diff --git a/src/spell.c b/src/spell.c
index f124ef21d..1e1f03f05 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -1603,7 +1603,7 @@ spell_move_to(
* though...
*/
lnum = wp->w_cursor.lnum;
- clearpos(&found_pos);
+ CLEAR_POS(&found_pos);
while (!got_int)
{
@@ -8545,7 +8545,7 @@ ex_spelldump(exarg_T *eap)
set_option_value((char_u*)"spl", dummy, spl, OPT_LOCAL);
vim_free(spl);
- if (!bufempty())
+ if (!BUFEMPTY())
return;
spell_dump_compl(NULL, 0, NULL, eap->forceit ? DUMPFLAG_COUNT : 0);
diff --git a/src/tag.c b/src/tag.c
index 8621419db..1dfe0a117 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -178,7 +178,7 @@ do_tag(
free_string_option(nofile_fname);
nofile_fname = NULL;
- clearpos(&saved_fmark.mark); /* shutup gcc 4.0 */
+ CLEAR_POS(&saved_fmark.mark); /* shutup gcc 4.0 */
saved_fmark.fnum = 0;
/*
diff --git a/src/ui.c b/src/ui.c
index 4da79f0c1..d89c500ae 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -442,7 +442,7 @@ clip_update_selection(VimClipboard *clip)
/* If visual mode is only due to a redo command ("."), then ignore it */
if (!redo_VIsual_busy && VIsual_active && (State & NORMAL))
{
- if (lt(VIsual, curwin->w_cursor))
+ if (LT_POS(VIsual, curwin->w_cursor))
{
start = VIsual;
end = curwin->w_cursor;
@@ -456,8 +456,8 @@ clip_update_selection(VimClipboard *clip)
start = curwin->w_cursor;
end = VIsual;
}
- if (!equalpos(clip->start, start)
- || !equalpos(clip->end, end)
+ if (!EQUAL_POS(clip->start, start)
+ || !EQUAL_POS(clip->end, end)
|| clip->vmode != VIsual_mode)
{
clip_clear_selection(clip);
diff --git a/src/undo.c b/src/undo.c
index 5b953795e..833deca87 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -2784,7 +2784,7 @@ u_undoredo(int undo)
curhead->uh_entry = newlist;
curhead->uh_flags = new_flags;
- if ((old_flags & UH_EMPTYBUF) && bufempty())
+ if ((old_flags & UH_EMPTYBUF) && BUFEMPTY())
curbuf->b_ml.ml_flags |= ML_EMPTY;
if (old_flags & UH_CHANGED)
changed();
@@ -3175,14 +3175,14 @@ u_find_first_changed(void)
if (STRCMP(ml_get_buf(curbuf, lnum, FALSE),
uep->ue_array[lnum - 1]) != 0)
{
- clearpos(&(uhp->uh_cursor));
+ CLEAR_POS(&(uhp->uh_cursor));
uhp->uh_cursor.lnum = lnum;
return;
}
if (curbuf->b_ml.ml_line_count != uep->ue_size)
{
/* lines added or deleted at the end, put the cursor there */
- clearpos(&(uhp->uh_cursor));
+ CLEAR_POS(&(uhp->uh_cursor));
uhp->uh_cursor.lnum = lnum;
}
}
diff --git a/src/version.c b/src/version.c
index caf1b64dc..7e4d0fee5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 448,
+/**/
447,
/**/
446,
@@ -2091,7 +2093,7 @@ static void do_intro_line(int row, char_u *mesg, int add_version, int attr);
void
maybe_intro_message(void)
{
- if (bufempty()
+ if (BUFEMPTY()
&& curbuf->b_fname == NULL
#ifdef FEAT_WINDOWS
&& firstwin->w_next == NULL
diff --git a/src/workshop.c b/src/workshop.c
index 0b9774fa5..844da854a 100644
--- a/src/workshop.c
+++ b/src/workshop.c
@@ -1087,7 +1087,7 @@ workshop_get_positions(
*curCol = curwin->w_cursor.col;
if (curbuf->b_visual.vi_mode == 'v' &&
- equalpos(curwin->w_cursor, curbuf->b_visual.vi_end))
+ EQUAL_POS(curwin->w_cursor, curbuf->b_visual.vi_end))
{
*selStartLine = curbuf->b_visual.vi_start.lnum;
*selStartCol = curbuf->b_visual.vi_start.col;