0
0
mirror of https://github.com/vim/vim.git synced 2025-08-29 20:33:37 -04:00

patch 8.0.0448: some macros are in lower case

Problem:    Some macros are in lower case, which can be confusing.
Solution:   Make a few lower case macros upper case.
This commit is contained in:
Bram Moolenaar 2017-03-12 18:23:53 +01:00
parent 8774845ce1
commit b5aedf3e22
30 changed files with 194 additions and 166 deletions

View File

@ -111,7 +111,7 @@ read_buffer(
{ {
/* Set or reset 'modified' before executing autocommands, so that /* Set or reset 'modified' before executing autocommands, so that
* it can be changed there. */ * it can be changed there. */
if (!readonlymode && !bufempty()) if (!readonlymode && !BUFEMPTY())
changed(); changed();
else if (retval == OK) else if (retval == OK)
unchanged(curbuf, FALSE); unchanged(curbuf, FALSE);
@ -1959,7 +1959,7 @@ buflist_new(
&& curbuf != NULL && curbuf != NULL
&& curbuf->b_ffname == NULL && curbuf->b_ffname == NULL
&& curbuf->b_nwindows <= 1 && curbuf->b_nwindows <= 1
&& (curbuf->b_ml.ml_mfp == NULL || bufempty())) && (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY()))
{ {
buf = curbuf; buf = curbuf;
#ifdef FEAT_AUTOCMD #ifdef FEAT_AUTOCMD
@ -2334,7 +2334,7 @@ buflist_getfile(
/* If 'switchbuf' contains "split", "vsplit" or "newtab" and the /* If 'switchbuf' contains "split", "vsplit" or "newtab" and the
* current buffer isn't empty: open new tab or window */ * current buffer isn't empty: open new tab or window */
if (wp == NULL && (swb_flags & (SWB_VSPLIT | SWB_SPLIT | SWB_NEWTAB)) if (wp == NULL && (swb_flags & (SWB_VSPLIT | SWB_SPLIT | SWB_NEWTAB))
&& !bufempty()) && !BUFEMPTY())
{ {
if (swb_flags & SWB_NEWTAB) if (swb_flags & SWB_NEWTAB)
tabpage_new(); tabpage_new();
@ -5017,7 +5017,7 @@ do_arg_all(
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
/* ":drop all" should re-use an empty window to avoid "--remote-tab" /* ":drop all" should re-use an empty window to avoid "--remote-tab"
* leaving an empty tab page when executed locally. */ * 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) && curbuf->b_ffname == NULL && !curbuf->b_changed)
use_firstwin = TRUE; use_firstwin = TRUE;
#endif #endif

View File

@ -1403,7 +1403,8 @@ getvcol(
&& (State & NORMAL) && (State & NORMAL)
&& !wp->w_p_list && !wp->w_p_list
&& !virtual_active() && !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 */ *cursor = vcol + incr - 1; /* cursor at end */
else else
@ -1496,7 +1497,7 @@ getvcols(
{ {
colnr_T from1, from2, to1, to2; colnr_T from1, from2, to1, to2;
if (ltp(pos1, pos2)) if (LT_POSP(pos1, pos2))
{ {
getvvcol(wp, pos1, &from1, NULL, &to1); getvvcol(wp, pos1, &from1, NULL, &to1);
getvvcol(wp, pos2, &from2, NULL, &to2); getvvcol(wp, pos2, &from2, NULL, &to2);

View File

@ -2333,7 +2333,7 @@ ex_diffgetput(exarg_T *eap)
end_skip = 0; end_skip = 0;
} }
buf_empty = bufempty(); buf_empty = BUFEMPTY();
added = 0; added = 0;
for (i = 0; i < count; ++i) for (i = 0; i < count; ++i)
{ {

View File

@ -408,7 +408,7 @@ edit(
* the "A" command, thus set State to avoid that. Also check that the * the "A" command, thus set State to avoid that. Also check that the
* line number is still valid (lines may have been deleted). * line number is still valid (lines may have been deleted).
* Do not restore if v:char was set to a non-empty string. */ * 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 # ifdef FEAT_EVAL
&& *get_vim_var_str(VV_CHAR) == NUL && *get_vim_var_str(VV_CHAR) == NUL
# endif # endif
@ -1631,7 +1631,7 @@ ins_redraw(
# endif # endif
) )
# ifdef FEAT_AUTOCMD # ifdef FEAT_AUTOCMD
&& !equalpos(last_cursormoved, curwin->w_cursor) && !EQUAL_POS(last_cursormoved, curwin->w_cursor)
# endif # endif
# ifdef FEAT_INS_EXPAND # ifdef FEAT_INS_EXPAND
&& !pum_visible() && !pum_visible()
@ -4130,7 +4130,7 @@ expand_by_function(
} }
curwin->w_cursor = pos; /* restore the cursor position */ curwin->w_cursor = pos; /* restore the cursor position */
validate_cursor(); validate_cursor();
if (!equalpos(curwin->w_cursor, pos)) if (!EQUAL_POS(curwin->w_cursor, pos))
{ {
EMSG(_(e_compldel)); EMSG(_(e_compldel));
goto theend; goto theend;
@ -5408,7 +5408,7 @@ ins_complete(int c, int enable_pum)
} }
curwin->w_cursor = pos; /* restore the cursor position */ curwin->w_cursor = pos; /* restore the cursor position */
validate_cursor(); validate_cursor();
if (!equalpos(curwin->w_cursor, pos)) if (!EQUAL_POS(curwin->w_cursor, pos))
{ {
EMSG(_(e_compldel)); EMSG(_(e_compldel));
return FAIL; return FAIL;
@ -8947,7 +8947,7 @@ ins_bs(
* can't backup past starting point unless 'backspace' > 1 * can't backup past starting point unless 'backspace' > 1
* can backup to a previous line if 'backspace' == 0 * can backup to a previous line if 'backspace' == 0
*/ */
if ( bufempty() if ( BUFEMPTY()
|| ( || (
#ifdef FEAT_RIGHTLEFT #ifdef FEAT_RIGHTLEFT
!revins_on && !revins_on &&
@ -9462,7 +9462,7 @@ ins_mousescroll(int dir)
} }
# endif # endif
if (!equalpos(curwin->w_cursor, tpos)) if (!EQUAL_POS(curwin->w_cursor, tpos))
{ {
start_arrow(&tpos); start_arrow(&tpos);
# ifdef FEAT_CINDENT # ifdef FEAT_CINDENT

View File

@ -9552,20 +9552,20 @@ do_searchpair(
save_cursor = curwin->w_cursor; save_cursor = curwin->w_cursor;
pos = curwin->w_cursor; pos = curwin->w_cursor;
clearpos(&firstpos); CLEAR_POS(&firstpos);
clearpos(&foundpos); CLEAR_POS(&foundpos);
pat = pat3; pat = pat3;
for (;;) for (;;)
{ {
n = searchit(curwin, curbuf, &pos, dir, pat, 1L, n = searchit(curwin, curbuf, &pos, dir, pat, 1L,
options, RE_SEARCH, lnum_stop, &tm); 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 */ /* didn't find it or found the first match again: FAIL */
break; break;
if (firstpos.lnum == 0) if (firstpos.lnum == 0)
firstpos = pos; firstpos = pos;
if (equalpos(pos, foundpos)) if (EQUAL_POS(pos, foundpos))
{ {
/* Found the same position again. Can happen with a pattern that /* Found the same position again. Can happen with a pattern that
* has "\zs" at the end and searching backwards. Advance one * has "\zs" at the end and searching backwards. Advance one

View File

@ -851,24 +851,41 @@ do_move(linenr_T line1, linenr_T line2, linenr_T dest)
* their final destination at the new text position -- webb * their final destination at the new text position -- webb
*/ */
last_line = curbuf->b_ml.ml_line_count; last_line = curbuf->b_ml.ml_line_count;
mark_adjust(line1, line2, last_line - line2, 0L); mark_adjust_nofold(line1, line2, last_line - line2, 0L);
changed_lines(last_line - num_lines + 1, 0, last_line + 1, num_lines);
if (dest >= line2) 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_start.lnum = dest - num_lines + 1;
curbuf->b_op_end.lnum = dest; curbuf->b_op_end.lnum = dest;
} }
else 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_start.lnum = dest + 1;
curbuf->b_op_end.lnum = dest + num_lines; curbuf->b_op_end.lnum = dest + num_lines;
} }
curbuf->b_op_start.col = curbuf->b_op_end.col = 0; 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); -(last_line - dest - extra), 0L);
changed_lines(last_line - num_lines + 1, 0, last_line + 1, -extra);
/* /*
* Now we delete the original text -- webb * Now we delete the original text -- webb
@ -4211,7 +4228,7 @@ do_ecmd(
/* If autocommands change the cursor position or topline, we should /* If autocommands change the cursor position or topline, we should
* keep it. Also when it moves within a line. */ * 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; newlnum = curwin->w_cursor.lnum;
newcol = curwin->w_cursor.col; newcol = curwin->w_cursor.col;

View File

@ -234,7 +234,7 @@ getcmdline(
ccline.overstrike = FALSE; /* always start in insert mode */ ccline.overstrike = FALSE; /* always start in insert mode */
#ifdef FEAT_SEARCH_EXTRA #ifdef FEAT_SEARCH_EXTRA
clearpos(&match_end); CLEAR_POS(&match_end);
save_cursor = curwin->w_cursor; /* may be restored later */ save_cursor = curwin->w_cursor; /* may be restored later */
search_start = curwin->w_cursor; search_start = curwin->w_cursor;
old_curswant = curwin->w_curswant; old_curswant = curwin->w_curswant;
@ -1479,7 +1479,7 @@ getcmdline(
if (did_incsearch) if (did_incsearch)
{ {
curwin->w_cursor = match_end; curwin->w_cursor = match_end;
if (!equalpos(curwin->w_cursor, search_start)) if (!EQUAL_POS(curwin->w_cursor, search_start))
{ {
c = gchar_cursor(); c = gchar_cursor();
/* If 'ignorecase' and 'smartcase' are set and the /* If 'ignorecase' and 'smartcase' are set and the
@ -1707,7 +1707,7 @@ getcmdline(
search_start = t; search_start = t;
(void)decl(&search_start); (void)decl(&search_start);
} }
if (lt(t, search_start) && c == Ctrl_G) if (LT_POS(t, search_start) && c == Ctrl_G)
{ {
/* wrap around */ /* wrap around */
search_start = t; search_start = t;
@ -2007,7 +2007,7 @@ returncmd:
curwin->w_cursor = save_cursor; curwin->w_cursor = save_cursor;
else else
{ {
if (!equalpos(save_cursor, search_start)) if (!EQUAL_POS(save_cursor, search_start))
{ {
/* put the '" mark at the original position */ /* put the '" mark at the original position */
curwin->w_cursor = save_cursor; curwin->w_cursor = save_cursor;

View File

@ -7118,7 +7118,7 @@ buf_reload(buf_T *buf, int orig_mode)
* the old contents. Can't use memory only, the file might be * the old contents. Can't use memory only, the file might be
* too big. Use a hidden buffer to move the buffer contents to. * too big. Use a hidden buffer to move the buffer contents to.
*/ */
if (bufempty() || saved == FAIL) if (BUFEMPTY() || saved == FAIL)
savebuf = NULL; savebuf = NULL;
else else
{ {
@ -7161,7 +7161,7 @@ buf_reload(buf_T *buf, int orig_mode)
{ {
/* Put the text back from the save buffer. First /* Put the text back from the save buffer. First
* delete any lines that readfile() added. */ * delete any lines that readfile() added. */
while (!bufempty()) while (!BUFEMPTY())
if (ml_delete(buf->b_ml.ml_line_count, FALSE) == FAIL) if (ml_delete(buf->b_ml.ml_line_count, FALSE) == FAIL)
break; break;
(void)move_lines(savebuf, buf); (void)move_lines(savebuf, buf);

View File

@ -1039,7 +1039,7 @@ foldAdjustVisual(void)
if (!VIsual_active || !hasAnyFolding(curwin)) if (!VIsual_active || !hasAnyFolding(curwin))
return; return;
if (ltoreq(VIsual, curwin->w_cursor)) if (LTOREQ_POS(VIsual, curwin->w_cursor))
{ {
start = &VIsual; start = &VIsual;
end = &curwin->w_cursor; end = &curwin->w_cursor;

View File

@ -4476,7 +4476,7 @@ gui_do_scroll(void)
pum_redraw(); pum_redraw();
#endif #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 curwin->w_p_cole > 0
# endif # endif
) )
&& !equalpos(last_cursormoved, curwin->w_cursor)) && !EQUAL_POS(last_cursormoved, curwin->w_cursor))
{ {
# ifdef FEAT_AUTOCMD # ifdef FEAT_AUTOCMD
if (has_cursormoved()) if (has_cursormoved())

View File

@ -84,7 +84,7 @@ general_beval_cb(BalloonEval *beval, int state UNUSED)
result = eval_to_string(bexpr, NULL, TRUE); result = eval_to_string(bexpr, NULL, TRUE);
/* Remove one trailing newline, it is added when the result was a /* 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. */ * trailing newline he can add two and one remains. */
if (result != NULL) if (result != NULL)
{ {
@ -366,7 +366,7 @@ get_beval_info(
if (VIsual_active) if (VIsual_active)
{ {
if (lt(VIsual, curwin->w_cursor)) if (LT_POS(VIsual, curwin->w_cursor))
{ {
spos = &VIsual; spos = &VIsual;
epos = &curwin->w_cursor; epos = &curwin->w_cursor;

View File

@ -1288,7 +1288,7 @@ ex_perldo(exarg_T *eap)
linenr_T i; linenr_T i;
buf_T *was_curbuf = curbuf; buf_T *was_curbuf = curbuf;
if (bufempty()) if (BUFEMPTY())
return; return;
if (perl_interp == NULL) if (perl_interp == NULL)

View File

@ -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 * Position comparisons
*/ */
#ifdef FEAT_VIRTUALEDIT #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).lnum < (b).lnum \
: (a).col != (b).col \ : (a).col != (b).col \
? (a).col < (b).col \ ? (a).col < (b).col \
: (a).coladd < (b).coladd) : (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)->lnum < (b)->lnum \
: (a)->col != (b)->col \ : (a)->col != (b)->col \
? (a)->col < (b)->col \ ? (a)->col < (b)->col \
: (a)->coladd < (b)->coladd) : (a)->coladd < (b)->coladd)
# define equalpos(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && ((a).coladd == (b).coladd)) # define EQUAL_POS(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 CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0;}
#else #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)) ? ((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)) ? ((a)->lnum < (b)->lnum) : ((a)->col < (b)->col))
# define equalpos(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col)) # define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col))
# define clearpos(a) {(a)->lnum = 0; (a)->col = 0;} # define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0;}
#endif #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. * toupper() and tolower() that use the current locale.

View File

@ -1144,7 +1144,7 @@ main_loop(
# endif # endif
) )
# ifdef FEAT_AUTOCMD # ifdef FEAT_AUTOCMD
&& !equalpos(last_cursormoved, curwin->w_cursor) && !EQUAL_POS(last_cursormoved, curwin->w_cursor)
# endif # endif
) )
{ {
@ -3557,8 +3557,11 @@ set_progpath(char_u *argv0)
&& vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL) && vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL)
val = buf; val = buf;
} }
# endif
# endif # endif
set_vim_var_string(VV_PROGPATH, val, -1); set_vim_var_string(VV_PROGPATH, val, -1);
# ifdef WIN32 # ifdef WIN32
vim_free(path); vim_free(path);
# endif # endif

View File

@ -206,7 +206,7 @@ setpcmark(void)
checkpcmark(void) checkpcmark(void)
{ {
if (curwin->w_prev_pcmark.lnum != 0 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.lnum == 0))
{ {
curwin->w_pcmark = curwin->w_prev_pcmark; curwin->w_pcmark = curwin->w_prev_pcmark;
@ -401,7 +401,7 @@ getmark_buf_fnum(
{ {
startp = &buf->b_visual.vi_start; startp = &buf->b_visual.vi_start;
endp = &buf->b_visual.vi_end; 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) && startp->lnum != 0)
posp = startp; posp = startp;
else else
@ -497,14 +497,14 @@ getnextmark(
{ {
if (dir == FORWARD) if (dir == FORWARD)
{ {
if ((result == NULL || lt(curbuf->b_namedm[i], *result)) if ((result == NULL || LT_POS(curbuf->b_namedm[i], *result))
&& lt(pos, curbuf->b_namedm[i])) && LT_POS(pos, curbuf->b_namedm[i]))
result = &curbuf->b_namedm[i]; result = &curbuf->b_namedm[i];
} }
else else
{ {
if ((result == NULL || lt(*result, curbuf->b_namedm[i])) if ((result == NULL || LT_POS(*result, curbuf->b_namedm[i]))
&& lt(curbuf->b_namedm[i], pos)) && LT_POS(curbuf->b_namedm[i], pos))
result = &curbuf->b_namedm[i]; result = &curbuf->b_namedm[i];
} }
} }
@ -1063,7 +1063,7 @@ mark_adjust(
one_adjust(&(curbuf->b_last_change.lnum)); one_adjust(&(curbuf->b_last_change.lnum));
/* last cursor position, if it was set */ /* 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)); 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) for (i = 0; i < buf->b_changelistlen; ++i)
{ {
/* skip duplicates */ /* 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]); write_one_mark(fp_out, '+', &buf->b_changelist[i]);
} }
#endif #endif

View File

@ -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 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 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 rs_pos;
return comment_pos; return comment_pos;
} }
@ -7217,7 +7218,8 @@ get_c_indent(void)
comment_pos = &tryposCopy; comment_pos = &tryposCopy;
} }
trypos = find_start_rawstring(curbuf->b_ind_maxcomment); 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; amount = -1;
goto laterend; goto laterend;
@ -9352,7 +9354,7 @@ get_lisp_indent(void)
{ {
paren = *pos; paren = *pos;
pos = findmatch(NULL, '['); pos = findmatch(NULL, '[');
if (pos == NULL || ltp(pos, &paren)) if (pos == NULL || LT_POSP(pos, &paren))
pos = &paren; pos = &paren;
} }
if (pos != NULL) if (pos != NULL)

View File

@ -210,7 +210,7 @@ update_topline(void)
/* /*
* If the buffer is empty, always set topline to 1. * 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) if (curwin->w_topline != 1)
redraw_later(NOT_VALID); redraw_later(NOT_VALID);

View File

@ -1540,7 +1540,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
if (VIsual_select && VIsual_mode == 'V' if (VIsual_select && VIsual_mode == 'V'
&& cap->oap->op_type != OP_DELETE) && cap->oap->op_type != OP_DELETE)
{ {
if (lt(VIsual, curwin->w_cursor)) if (LT_POS(VIsual, curwin->w_cursor))
{ {
VIsual.col = 0; VIsual.col = 0;
curwin->w_cursor.col = 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 * 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. * 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 #ifdef FEAT_FOLDING
/* Include folded lines completely. */ /* Include folded lines completely. */
@ -1776,7 +1776,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
&& (!oap->inclusive && (!oap->inclusive
|| (oap->op_type == OP_YANK || (oap->op_type == OP_YANK
&& gchar_pos(&oap->end) == NUL)) && gchar_pos(&oap->end) == NUL))
&& equalpos(oap->start, oap->end) && EQUAL_POS(oap->start, oap->end)
#ifdef FEAT_VIRTUALEDIT #ifdef FEAT_VIRTUALEDIT
&& !(virtual_op && oap->start.coladd != oap->end.coladd) && !(virtual_op && oap->start.coladd != oap->end.coladd)
#endif #endif
@ -2683,12 +2683,12 @@ do_mouse(
jump_flags = MOUSE_MAY_STOP_VIS; jump_flags = MOUSE_MAY_STOP_VIS;
else else
{ {
if ((lt(curwin->w_cursor, VIsual) if ((LT_POS(curwin->w_cursor, VIsual)
&& (lt(m_pos, curwin->w_cursor) && (LT_POS(m_pos, curwin->w_cursor)
|| lt(VIsual, m_pos))) || LT_POS(VIsual, m_pos)))
|| (lt(VIsual, curwin->w_cursor) || (LT_POS(VIsual, curwin->w_cursor)
&& (lt(m_pos, VIsual) && (LT_POS(m_pos, VIsual)
|| lt(curwin->w_cursor, m_pos)))) || LT_POS(curwin->w_cursor, m_pos))))
{ {
jump_flags = MOUSE_MAY_STOP_VIS; jump_flags = MOUSE_MAY_STOP_VIS;
} }
@ -2754,7 +2754,7 @@ do_mouse(
* Remember the start and end of visual before moving the * Remember the start and end of visual before moving the
* cursor. * cursor.
*/ */
if (lt(curwin->w_cursor, VIsual)) if (LT_POS(curwin->w_cursor, VIsual))
{ {
start_visual = curwin->w_cursor; start_visual = curwin->w_cursor;
end_visual = VIsual; end_visual = VIsual;
@ -2891,9 +2891,9 @@ do_mouse(
* If the click is after the end of visual, change the end. If * If the click is after the end of visual, change the end. If
* the click is inside the visual, change the closest side. * 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; VIsual = end_visual;
else if (lt(end_visual, curwin->w_cursor)) else if (LT_POS(end_visual, curwin->w_cursor))
VIsual = start_visual; VIsual = start_visual;
else else
{ {
@ -3097,7 +3097,7 @@ do_mouse(
if (oap != NULL if (oap != NULL
&& VIsual_mode == 'v' && VIsual_mode == 'v'
&& !vim_iswordc(gchar_pos(&end_visual)) && !vim_iswordc(gchar_pos(&end_visual))
&& equalpos(curwin->w_cursor, VIsual) && EQUAL_POS(curwin->w_cursor, VIsual)
&& (pos = findmatch(oap, NUL)) != NULL) && (pos = findmatch(oap, NUL)) != NULL)
{ {
curwin->w_cursor = *pos; curwin->w_cursor = *pos;
@ -3105,7 +3105,7 @@ do_mouse(
VIsual_mode = 'V'; VIsual_mode = 'V';
else if (*p_sel == 'e') else if (*p_sel == 'e')
{ {
if (lt(curwin->w_cursor, VIsual)) if (LT_POS(curwin->w_cursor, VIsual))
++VIsual.col; ++VIsual.col;
else else
++curwin->w_cursor.col; ++curwin->w_cursor.col;
@ -3117,7 +3117,7 @@ do_mouse(
{ {
/* When not found a match or when dragging: extend to include /* When not found a match or when dragging: extend to include
* a word. */ * 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_start_of_word(&curwin->w_cursor);
find_end_of_word(&VIsual); find_end_of_word(&VIsual);
@ -3745,7 +3745,7 @@ clear_showcmd(void)
if (VIsual_active && !char_avail()) if (VIsual_active && !char_avail())
{ {
int cursor_bot = lt(VIsual, curwin->w_cursor); int cursor_bot = LT_POS(VIsual, curwin->w_cursor);
long lines; long lines;
colnr_T leftcol, rightcol; colnr_T leftcol, rightcol;
linenr_T top, bot; linenr_T top, bot;
@ -4353,7 +4353,7 @@ find_decl(
curwin->w_cursor.col = 0; curwin->w_cursor.col = 0;
/* Search forward for the identifier, ignore comment lines. */ /* Search forward for the identifier, ignore comment lines. */
clearpos(&found_pos); CLEAR_POS(&found_pos);
for (;;) for (;;)
{ {
valid = FALSE; valid = FALSE;
@ -4419,13 +4419,10 @@ find_decl(
* declarations this skips the function header without types. */ * declarations this skips the function header without types. */
if (!valid) if (!valid)
{ {
/* Braces needed due to macro expansion of clearpos. */ CLEAR_POS(&found_pos);
clearpos(&found_pos);
} }
else else
{
found_pos = curwin->w_cursor; found_pos = curwin->w_cursor;
}
/* Remove SEARCH_START from flags to avoid getting stuck at one /* Remove SEARCH_START from flags to avoid getting stuck at one
* position. */ * position. */
searchflags &= ~SEARCH_START; searchflags &= ~SEARCH_START;
@ -5834,7 +5831,7 @@ get_visual_text(
} }
else else
{ {
if (lt(curwin->w_cursor, VIsual)) if (LT_POS(curwin->w_cursor, VIsual))
{ {
*pp = ml_get_pos(&curwin->w_cursor); *pp = ml_get_pos(&curwin->w_cursor);
*lenp = VIsual.col - curwin->w_cursor.col + 1; *lenp = VIsual.col - curwin->w_cursor.col + 1;
@ -6020,7 +6017,7 @@ nv_right(cmdarg_T *cap)
* included, move to next line after that */ * included, move to next line after that */
if ( cap->oap->op_type != OP_NOP if ( cap->oap->op_type != OP_NOP
&& !cap->oap->inclusive && !cap->oap->inclusive
&& !lineempty(curwin->w_cursor.lnum)) && !LINEEMPTY(curwin->w_cursor.lnum))
cap->oap->inclusive = TRUE; cap->oap->inclusive = TRUE;
else else
{ {
@ -6042,7 +6039,7 @@ nv_right(cmdarg_T *cap)
} }
else else
{ {
if (!lineempty(curwin->w_cursor.lnum)) if (!LINEEMPTY(curwin->w_cursor.lnum))
cap->oap->inclusive = TRUE; cap->oap->inclusive = TRUE;
} }
break; break;
@ -6121,7 +6118,7 @@ nv_left(cmdarg_T *cap)
* Don't adjust op_end now, otherwise it won't work. */ * Don't adjust op_end now, otherwise it won't work. */
if ( (cap->oap->op_type == OP_DELETE if ( (cap->oap->op_type == OP_DELETE
|| cap->oap->op_type == OP_CHANGE) || cap->oap->op_type == OP_CHANGE)
&& !lineempty(curwin->w_cursor.lnum)) && !LINEEMPTY(curwin->w_cursor.lnum))
{ {
char_u *cp = ml_get_cursor(); char_u *cp = ml_get_cursor();
@ -6333,7 +6330,7 @@ nv_search(cmdarg_T *cap)
} }
(void)normal_search(cap, cap->cmdchar, cap->searchbuf, (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); ? 0 : SEARCH_MARK);
} }
@ -6347,7 +6344,7 @@ nv_next(cmdarg_T *cap)
pos_T old = curwin->w_cursor; pos_T old = curwin->w_cursor;
int i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg); 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 /* Avoid getting stuck on the current cursor position, which can
* happen when an offset is given and the cursor is on the last char * 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) if (VIsual_active)
{ {
start = ltoreq(VIsual, curwin->w_cursor) start = LTOREQ_POS(VIsual, curwin->w_cursor)
? 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); curwin->w_cursor = (dir == BACKWARD ? start : end);
} }
# ifdef FEAT_CLIPBOARD # ifdef FEAT_CLIPBOARD
@ -7315,7 +7312,7 @@ n_swapchar(cmdarg_T *cap)
if (checkclearopq(cap->oap)) if (checkclearopq(cap->oap))
return; 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); clearopbeep(cap->oap);
return; return;
@ -7559,7 +7556,7 @@ nv_gomark(cmdarg_T *cap)
#ifdef FEAT_FOLDING #ifdef FEAT_FOLDING
if (cap->oap->op_type == OP_NOP if (cap->oap->op_type == OP_NOP
&& pos != NULL && pos != NULL
&& (pos == (pos_T *)-1 || !equalpos(old_cursor, *pos)) && (pos == (pos_T *)-1 || !EQUAL_POS(old_cursor, *pos))
&& (fdo_flags & FDO_MARK) && (fdo_flags & FDO_MARK)
&& old_KeyTyped) && old_KeyTyped)
foldOpenCursor(); 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 /* Don't leave the cursor on the NUL past the end of line. Unless we
* didn't move it forward. */ * didn't move it forward. */
if (lt(startpos, curwin->w_cursor)) if (LT_POS(startpos, curwin->w_cursor))
adjust_cursor(cap->oap); adjust_cursor(cap->oap);
if (n == FAIL && cap->oap->op_type == OP_NOP) if (n == FAIL && cap->oap->op_type == OP_NOP)
@ -8833,7 +8830,7 @@ nv_beginline(cmdarg_T *cap)
adjust_for_sel(cmdarg_T *cap) adjust_for_sel(cmdarg_T *cap)
{ {
if (VIsual_active && cap->oap->inclusive && *p_sel == 'e' 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 #ifdef FEAT_MBYTE
if (has_mbyte) if (has_mbyte)
@ -8855,9 +8852,9 @@ unadjust_for_sel(void)
{ {
pos_T *pp; 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; pp = &curwin->w_cursor;
else else
pp = &VIsual; pp = &VIsual;
@ -9071,8 +9068,8 @@ nv_edit(cmdarg_T *cap)
/* When the last char in the line was deleted then append. Detect this /* When the last char in the line was deleted then append. Detect this
* by checking if the cursor moved to before the Visual area. */ * by checking if the cursor moved to before the Visual area. */
if (*ml_get_cursor() != NUL && lt(curwin->w_cursor, old_pos) if (*ml_get_cursor() != NUL && LT_POS(curwin->w_cursor, old_pos)
&& lt(curwin->w_cursor, old_visual)) && LT_POS(curwin->w_cursor, old_visual))
inc_cursor(); inc_cursor();
/* Insert to replace the deleted text with the pasted text. */ /* Insert to replace the deleted text with the pasted text. */

View File

@ -2190,7 +2190,7 @@ op_replace(oparg_T *oap, int c)
else if (!oap->inclusive) else if (!oap->inclusive)
dec(&(oap->end)); dec(&(oap->end));
while (ltoreq(curwin->w_cursor, oap->end)) while (LTOREQ_POS(curwin->w_cursor, oap->end))
{ {
n = gchar_cursor(); n = gchar_cursor();
if (n != NUL) if (n != NUL)
@ -2229,7 +2229,7 @@ op_replace(oparg_T *oap, int c)
getvpos(&oap->end, end_vcol); getvpos(&oap->end, end_vcol);
} }
#endif #endif
pchar(curwin->w_cursor, c); PCHAR(curwin->w_cursor, c);
} }
} }
#ifdef FEAT_VIRTUALEDIT #ifdef FEAT_VIRTUALEDIT
@ -2248,7 +2248,7 @@ op_replace(oparg_T *oap, int c)
curwin->w_cursor.col -= (virtcols + 1); curwin->w_cursor.col -= (virtcols + 1);
for (; virtcols >= 0; virtcols--) for (; virtcols >= 0; virtcols--)
{ {
pchar(curwin->w_cursor, c); PCHAR(curwin->w_cursor, c);
if (inc(&curwin->w_cursor) == -1) if (inc(&curwin->w_cursor) == -1)
break; break;
} }
@ -2338,7 +2338,7 @@ op_tilde(oparg_T *oap)
did_change |= swapchars(oap->op_type, &pos, did_change |= swapchars(oap->op_type, &pos,
pos.lnum == oap->end.lnum ? oap->end.col + 1: pos.lnum == oap->end.lnum ? oap->end.col + 1:
(int)STRLEN(ml_get_pos(&pos))); (int)STRLEN(ml_get_pos(&pos)));
if (ltoreq(oap->end, pos) || inc(&pos) == -1) if (LTOREQ_POS(oap->end, pos) || inc(&pos) == -1)
break; break;
} }
if (did_change) if (did_change)
@ -2490,7 +2490,7 @@ swapchar(int op_type, pos_T *pos)
} }
else else
#endif #endif
pchar(*pos, nc); PCHAR(*pos, nc);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -2575,7 +2575,7 @@ op_insert(oparg_T *oap, long count1)
check_cursor_col(); check_cursor_col();
/* Works just like an 'i'nsert on the next character. */ /* 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) && oap->start_vcol != oap->end_vcol)
inc_cursor(); 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 * have been converted to a tab as well, the column of the cursor
* might have actually been reduced, so need to adjust here. */ * might have actually been reduced, so need to adjust here. */
if (t1.lnum == curbuf->b_op_start_orig.lnum 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; oap->start = curbuf->b_op_start_orig;
/* If user has moved off this line, we don't know what to do, so do /* 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) else if (op_delete(oap) == FAIL)
return FALSE; 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) && !virtual_op)
inc_cursor(); inc_cursor();
@ -3519,7 +3519,7 @@ do_put(
++lnum; ++lnum;
/* In an empty buffer the empty line is going to be replaced, include /* In an empty buffer the empty line is going to be replaced, include
* it in the saved lines. */ * 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; goto end;
#ifdef FEAT_FOLDING #ifdef FEAT_FOLDING
if (dir == FORWARD) if (dir == FORWARD)
@ -4936,7 +4936,7 @@ format_lines(
&& prev_is_end_par && prev_is_end_par
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) && 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 #ifdef FEAT_COMMENTS
if (leader_len == 0 && next_leader_len == 0) if (leader_len == 0 && next_leader_len == 0)
@ -7237,7 +7237,7 @@ cursor_pos_info(dict_T *dict)
if (VIsual_active) if (VIsual_active)
{ {
if (lt(VIsual, curwin->w_cursor)) if (LT_POS(VIsual, curwin->w_cursor))
{ {
min_pos = VIsual; min_pos = VIsual;
max_pos = curwin->w_cursor; max_pos = curwin->w_cursor;

View File

@ -4170,7 +4170,7 @@ set_init_3(void)
} }
#endif #endif
if (bufempty()) if (BUFEMPTY())
{ {
int idx_ffs = findoption((char_u *)"ffs"); int idx_ffs = findoption((char_u *)"ffs");

View File

@ -590,7 +590,7 @@ pum_set_selected(int n, int repeat)
&& curbuf->b_p_bh[0] == 'w') && curbuf->b_p_bh[0] == 'w')
{ {
/* Already a "wipeout" buffer, make it empty. */ /* Already a "wipeout" buffer, make it empty. */
while (!bufempty()) while (!BUFEMPTY())
ml_delete((linenr_T)1, FALSE); ml_delete((linenr_T)1, FALSE);
} }
else else

View File

@ -4150,7 +4150,7 @@ reg_match_visual(void)
if (VIsual_active) if (VIsual_active)
{ {
if (lt(VIsual, wp->w_cursor)) if (LT_POS(VIsual, wp->w_cursor))
{ {
top = VIsual; top = VIsual;
bot = wp->w_cursor; bot = wp->w_cursor;
@ -4164,7 +4164,7 @@ reg_match_visual(void)
} }
else 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; top = curbuf->b_visual.vi_start;
bot = curbuf->b_visual.vi_end; bot = curbuf->b_visual.vi_end;

View File

@ -2714,7 +2714,7 @@ fold_line(
*/ */
if (VIsual_active && wp->w_buffer == curwin->w_buffer) 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 */ /* Visual is after curwin->w_cursor */
top = &curwin->w_cursor; top = &curwin->w_cursor;
@ -3170,7 +3170,7 @@ win_line(
if (VIsual_active && wp->w_buffer == curwin->w_buffer) if (VIsual_active && wp->w_buffer == curwin->w_buffer)
{ {
/* Visual is after curwin->w_cursor */ /* Visual is after curwin->w_cursor */
if (ltoreq(curwin->w_cursor, VIsual)) if (LTOREQ_POS(curwin->w_cursor, VIsual))
{ {
top = &curwin->w_cursor; top = &curwin->w_cursor;
bot = &VIsual; bot = &VIsual;

View File

@ -2100,7 +2100,7 @@ findmatchlimit(
do_quotes = -1; do_quotes = -1;
start_in_quotes = MAYBE; start_in_quotes = MAYBE;
clearpos(&match_pos); CLEAR_POS(&match_pos);
/* backward search: Check if this line contains a single-line comment */ /* backward search: Check if this line contains a single-line comment */
if ((backwards && comment_dir) if ((backwards && comment_dir)
@ -2720,7 +2720,7 @@ findsent(int dir, long count)
if (decl(&pos) == -1) if (decl(&pos) == -1)
break; break;
/* when going forward: Stop in front of empty line */ /* when going forward: Stop in front of empty line */
if (lineempty(pos.lnum) && dir == FORWARD) if (LINEEMPTY(pos.lnum) && dir == FORWARD)
{ {
incl(&pos); incl(&pos);
goto found; goto found;
@ -3082,7 +3082,7 @@ bck_word(long count, int bigword, int stop)
while (cls() == 0) while (cls() == 0)
{ {
if (curwin->w_cursor.col == 0 if (curwin->w_cursor.col == 0
&& lineempty(curwin->w_cursor.lnum)) && LINEEMPTY(curwin->w_cursor.lnum))
goto finished; goto finished;
if (dec_cursor() == -1) /* hit start of file, stop here */ if (dec_cursor() == -1) /* hit start of file, stop here */
return OK; return OK;
@ -3163,7 +3163,7 @@ end_word(
while (cls() == 0) while (cls() == 0)
{ {
if (empty && curwin->w_cursor.col == 0 if (empty && curwin->w_cursor.col == 0
&& lineempty(curwin->w_cursor.lnum)) && LINEEMPTY(curwin->w_cursor.lnum))
goto finished; goto finished;
if (inc_cursor() == -1) /* hit end of file, stop here */ if (inc_cursor() == -1) /* hit end of file, stop here */
return FAIL; return FAIL;
@ -3223,7 +3223,7 @@ bckend_word(
*/ */
while (cls() == 0) 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; break;
if ((i = dec_cursor()) == -1 || (eol && i == 1)) if ((i = dec_cursor()) == -1 || (eol && i == 1))
return OK; return OK;
@ -3320,17 +3320,17 @@ current_word(
int include_white = FALSE; int include_white = FALSE;
cls_bigword = bigword; cls_bigword = bigword;
clearpos(&start_pos); CLEAR_POS(&start_pos);
/* Correct cursor when 'selection' is exclusive */ /* 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(); dec_cursor();
/* /*
* When Visual mode is not active, or when the VIsual area is only one * 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. * 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. * Go to start of current word or white space.
@ -3387,7 +3387,7 @@ current_word(
while (count > 0) while (count > 0)
{ {
inclusive = TRUE; 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. * In Visual mode, with cursor at start: move cursor back.
@ -3463,7 +3463,7 @@ current_word(
if (VIsual_active) 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(); inc_cursor();
if (VIsual_mode == 'V') 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. * 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: extend:
if (lt(start_pos, VIsual)) if (LT_POS(start_pos, VIsual))
{ {
/* /*
* Cursor at start of Visual area. * Cursor at start of Visual area.
@ -3512,7 +3512,7 @@ extend:
*/ */
at_start_sent = TRUE; at_start_sent = TRUE;
decl(&pos); decl(&pos);
while (lt(pos, curwin->w_cursor)) while (LT_POS(pos, curwin->w_cursor))
{ {
c = gchar_pos(&pos); c = gchar_pos(&pos);
if (!vim_iswhite(c)) if (!vim_iswhite(c))
@ -3525,7 +3525,7 @@ extend:
if (!at_start_sent) if (!at_start_sent)
{ {
findsent(BACKWARD, 1L); 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 */ at_start_sent = TRUE; /* exactly at start of sentence */
else else
/* inside a sentence, go to its end (start of next) */ /* inside a sentence, go to its end (start of next) */
@ -3554,10 +3554,11 @@ extend:
*/ */
incl(&pos); incl(&pos);
at_start_sent = TRUE; 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; at_start_sent = FALSE;
while (lt(pos, curwin->w_cursor)) while (LT_POS(pos, curwin->w_cursor))
{ {
c = gchar_pos(&pos); c = gchar_pos(&pos);
if (!vim_iswhite(c)) if (!vim_iswhite(c))
@ -3588,7 +3589,7 @@ extend:
*/ */
while (c = gchar_pos(&pos), vim_iswhite(c)) /* vim_iswhite() is a macro */ while (c = gchar_pos(&pos), vim_iswhite(c)) /* vim_iswhite() is a macro */
incl(&pos); incl(&pos);
if (equalpos(pos, curwin->w_cursor)) if (EQUAL_POS(pos, curwin->w_cursor))
{ {
start_blank = TRUE; start_blank = TRUE;
find_first_blank(&start_pos); /* go back to first blank */ find_first_blank(&start_pos); /* go back to first blank */
@ -3633,7 +3634,7 @@ extend:
if (VIsual_active) if (VIsual_active)
{ {
/* Avoid getting stuck with "is" on a single space before a sentence. */ /* 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; goto extend;
if (*p_sel == 'e') if (*p_sel == 'e')
++curwin->w_cursor.col; ++curwin->w_cursor.col;
@ -3682,7 +3683,7 @@ current_block(
/* /*
* If we start on '(', '{', ')', '}', etc., use the whole block inclusive. * 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(); setpcmark();
if (what == '{') /* ignore indent */ if (what == '{') /* ignore indent */
@ -3693,7 +3694,7 @@ current_block(
/* cursor on '(' or '{', move cursor just after it */ /* cursor on '(' or '{', move cursor just after it */
++curwin->w_cursor.col; ++curwin->w_cursor.col;
} }
else if (lt(VIsual, curwin->w_cursor)) else if (LT_POS(VIsual, curwin->w_cursor))
{ {
old_start = VIsual; old_start = VIsual;
curwin->w_cursor = VIsual; /* cursor at low end of 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 * 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. * 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) && VIsual_active)
{ {
curwin->w_cursor = old_start; curwin->w_cursor = old_start;
@ -3792,7 +3793,7 @@ current_block(
oap->inclusive = FALSE; oap->inclusive = FALSE;
if (sol) if (sol)
incl(&curwin->w_cursor); 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. */ /* Include the character under the cursor. */
oap->inclusive = TRUE; oap->inclusive = TRUE;
else else
@ -3916,7 +3917,7 @@ current_tagblock(
/* /*
* If we start on "<aaa>" select that block. * 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(); setpcmark();
@ -3942,7 +3943,7 @@ current_tagblock(
old_end = curwin->w_cursor; old_end = curwin->w_cursor;
} }
} }
else if (lt(VIsual, curwin->w_cursor)) else if (LT_POS(VIsual, curwin->w_cursor))
{ {
old_start = VIsual; old_start = VIsual;
curwin->w_cursor = VIsual; /* cursor at low end of Visual */ curwin->w_cursor = VIsual; /* cursor at low end of Visual */
@ -3999,7 +4000,7 @@ again:
vim_free(spat); vim_free(spat);
vim_free(epat); 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 /* 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 * 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 /* If we now have the same text as before reset "do_include" and try
* again. */ * 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; do_include = TRUE;
curwin->w_cursor = old_start; curwin->w_cursor = old_start;
@ -4059,7 +4060,7 @@ again:
{ {
/* If the end is before the start there is no text between tags, select /* If the end is before the start there is no text between tags, select
* the char under the cursor. */ * the char under the cursor. */
if (lt(end_pos, start_pos)) if (LT_POS(end_pos, start_pos))
curwin->w_cursor = start_pos; curwin->w_cursor = start_pos;
else if (*p_sel == 'e') else if (*p_sel == 'e')
inc_cursor(); inc_cursor();
@ -4072,7 +4073,7 @@ again:
{ {
oap->start = start_pos; oap->start = start_pos;
oap->motion_type = MCHAR; 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 /* End is before the start: there is no text between tags; operate
* on an empty area. */ * on an empty area. */
@ -4362,10 +4363,10 @@ current_quote(
if (VIsual.lnum != curwin->w_cursor.lnum) if (VIsual.lnum != curwin->w_cursor.lnum)
return FALSE; 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) if (*p_sel == 'e' && vis_bef_curs)
dec_cursor(); dec_cursor();
vis_empty = equalpos(VIsual, curwin->w_cursor); vis_empty = EQUAL_POS(VIsual, curwin->w_cursor);
} }
if (!vis_empty) if (!vis_empty)
@ -4605,7 +4606,7 @@ current_search(
p_ws = FALSE; p_ws = FALSE;
/* Correct cursor when 'selection' is exclusive */ /* 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(); dec_cursor();
if (VIsual_active) if (VIsual_active)
@ -4668,12 +4669,14 @@ current_search(
} }
else if (!i && !result) 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 */ /* searching backwards, so set pos to last line and col */
pos.lnum = curwin->w_buffer->b_ml.ml_line_count; pos.lnum = curwin->w_buffer->b_ml.ml_line_count;
pos.col = (colnr_T)STRLEN( pos.col = (colnr_T)STRLEN(
@ -4709,9 +4712,9 @@ current_search(
if (*p_sel == 'e') if (*p_sel == 'e')
{ {
/* Correction for exclusive selection depends on the direction. */ /* 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(); inc_cursor();
else if (!forward && ltoreq(curwin->w_cursor, VIsual)) else if (!forward && LTOREQ_POS(curwin->w_cursor, VIsual))
inc(&VIsual); inc(&VIsual);
} }
@ -4764,7 +4767,9 @@ is_one_char(char_u *pattern, int move)
regmatch.startpos[0].col = -1; regmatch.startpos[0].col = -1;
/* move to match */ /* move to match */
if (move) if (move)
clearpos(&pos) {
CLEAR_POS(&pos);
}
else else
{ {
pos = curwin->w_cursor; pos = curwin->w_cursor;

View File

@ -1603,7 +1603,7 @@ spell_move_to(
* though... * though...
*/ */
lnum = wp->w_cursor.lnum; lnum = wp->w_cursor.lnum;
clearpos(&found_pos); CLEAR_POS(&found_pos);
while (!got_int) while (!got_int)
{ {
@ -8545,7 +8545,7 @@ ex_spelldump(exarg_T *eap)
set_option_value((char_u*)"spl", dummy, spl, OPT_LOCAL); set_option_value((char_u*)"spl", dummy, spl, OPT_LOCAL);
vim_free(spl); vim_free(spl);
if (!bufempty()) if (!BUFEMPTY())
return; return;
spell_dump_compl(NULL, 0, NULL, eap->forceit ? DUMPFLAG_COUNT : 0); spell_dump_compl(NULL, 0, NULL, eap->forceit ? DUMPFLAG_COUNT : 0);

View File

@ -178,7 +178,7 @@ do_tag(
free_string_option(nofile_fname); free_string_option(nofile_fname);
nofile_fname = NULL; nofile_fname = NULL;
clearpos(&saved_fmark.mark); /* shutup gcc 4.0 */ CLEAR_POS(&saved_fmark.mark); /* shutup gcc 4.0 */
saved_fmark.fnum = 0; saved_fmark.fnum = 0;
/* /*

View File

@ -442,7 +442,7 @@ clip_update_selection(VimClipboard *clip)
/* If visual mode is only due to a redo command ("."), then ignore it */ /* If visual mode is only due to a redo command ("."), then ignore it */
if (!redo_VIsual_busy && VIsual_active && (State & NORMAL)) if (!redo_VIsual_busy && VIsual_active && (State & NORMAL))
{ {
if (lt(VIsual, curwin->w_cursor)) if (LT_POS(VIsual, curwin->w_cursor))
{ {
start = VIsual; start = VIsual;
end = curwin->w_cursor; end = curwin->w_cursor;
@ -456,8 +456,8 @@ clip_update_selection(VimClipboard *clip)
start = curwin->w_cursor; start = curwin->w_cursor;
end = VIsual; end = VIsual;
} }
if (!equalpos(clip->start, start) if (!EQUAL_POS(clip->start, start)
|| !equalpos(clip->end, end) || !EQUAL_POS(clip->end, end)
|| clip->vmode != VIsual_mode) || clip->vmode != VIsual_mode)
{ {
clip_clear_selection(clip); clip_clear_selection(clip);

View File

@ -2784,7 +2784,7 @@ u_undoredo(int undo)
curhead->uh_entry = newlist; curhead->uh_entry = newlist;
curhead->uh_flags = new_flags; curhead->uh_flags = new_flags;
if ((old_flags & UH_EMPTYBUF) && bufempty()) if ((old_flags & UH_EMPTYBUF) && BUFEMPTY())
curbuf->b_ml.ml_flags |= ML_EMPTY; curbuf->b_ml.ml_flags |= ML_EMPTY;
if (old_flags & UH_CHANGED) if (old_flags & UH_CHANGED)
changed(); changed();
@ -3175,14 +3175,14 @@ u_find_first_changed(void)
if (STRCMP(ml_get_buf(curbuf, lnum, FALSE), if (STRCMP(ml_get_buf(curbuf, lnum, FALSE),
uep->ue_array[lnum - 1]) != 0) uep->ue_array[lnum - 1]) != 0)
{ {
clearpos(&(uhp->uh_cursor)); CLEAR_POS(&(uhp->uh_cursor));
uhp->uh_cursor.lnum = lnum; uhp->uh_cursor.lnum = lnum;
return; return;
} }
if (curbuf->b_ml.ml_line_count != uep->ue_size) if (curbuf->b_ml.ml_line_count != uep->ue_size)
{ {
/* lines added or deleted at the end, put the cursor there */ /* 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; uhp->uh_cursor.lnum = lnum;
} }
} }

View File

@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
448,
/**/ /**/
447, 447,
/**/ /**/
@ -2091,7 +2093,7 @@ static void do_intro_line(int row, char_u *mesg, int add_version, int attr);
void void
maybe_intro_message(void) maybe_intro_message(void)
{ {
if (bufempty() if (BUFEMPTY()
&& curbuf->b_fname == NULL && curbuf->b_fname == NULL
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
&& firstwin->w_next == NULL && firstwin->w_next == NULL

View File

@ -1087,7 +1087,7 @@ workshop_get_positions(
*curCol = curwin->w_cursor.col; *curCol = curwin->w_cursor.col;
if (curbuf->b_visual.vi_mode == 'v' && 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; *selStartLine = curbuf->b_visual.vi_start.lnum;
*selStartCol = curbuf->b_visual.vi_start.col; *selStartCol = curbuf->b_visual.vi_start.col;