forked from aniani/vim
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes #3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts.
This commit is contained in:
52
src/window.c
52
src/window.c
@@ -101,7 +101,7 @@ do_window(
|
||||
do { \
|
||||
if (cmdwin_type != 0) \
|
||||
{ \
|
||||
EMSG(_(e_cmdwin)); \
|
||||
emsg(_(e_cmdwin)); \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -156,9 +156,9 @@ do_window(
|
||||
? curwin->w_alt_fnum : Prenum) == NULL)
|
||||
{
|
||||
if (Prenum == 0)
|
||||
EMSG(_(e_noalt));
|
||||
emsg(_(e_noalt));
|
||||
else
|
||||
EMSGN(_("E92: Buffer %ld not found"), Prenum);
|
||||
semsg(_("E92: Buffer %ld not found"), Prenum);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ newwindow:
|
||||
if (wp->w_p_pvw)
|
||||
break;
|
||||
if (wp == NULL)
|
||||
EMSG(_("E441: There is no preview window"));
|
||||
emsg(_("E441: There is no preview window"));
|
||||
else
|
||||
win_goto(wp);
|
||||
break;
|
||||
@@ -739,7 +739,7 @@ win_split(int size, int flags)
|
||||
flags |= cmdmod.split;
|
||||
if ((flags & WSP_TOP) && (flags & WSP_BOT))
|
||||
{
|
||||
EMSG(_("E442: Can't split topleft and botright at the same time"));
|
||||
emsg(_("E442: Can't split topleft and botright at the same time"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -794,7 +794,7 @@ win_split_ins(
|
||||
{
|
||||
if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL)
|
||||
{
|
||||
EMSG(_(e_noroom));
|
||||
emsg(_(e_noroom));
|
||||
return FAIL;
|
||||
}
|
||||
need_status = STATUS_HEIGHT;
|
||||
@@ -852,7 +852,7 @@ win_split_ins(
|
||||
}
|
||||
if (available < needed && new_wp == NULL)
|
||||
{
|
||||
EMSG(_(e_noroom));
|
||||
emsg(_(e_noroom));
|
||||
return FAIL;
|
||||
}
|
||||
if (new_size == 0)
|
||||
@@ -935,7 +935,7 @@ win_split_ins(
|
||||
}
|
||||
if (available < needed && new_wp == NULL)
|
||||
{
|
||||
EMSG(_(e_noroom));
|
||||
emsg(_(e_noroom));
|
||||
return FAIL;
|
||||
}
|
||||
oldwin_height = oldwin->w_height;
|
||||
@@ -1606,7 +1606,7 @@ win_rotate(int upwards, int count)
|
||||
FOR_ALL_FRAMES(frp, curwin->w_frame->fr_parent->fr_child)
|
||||
if (frp->fr_win == NULL)
|
||||
{
|
||||
EMSG(_("E443: Cannot rotate when another window is split"));
|
||||
emsg(_("E443: Cannot rotate when another window is split"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2309,7 +2309,7 @@ win_close(win_T *win, int free_buf)
|
||||
|
||||
if (last_window())
|
||||
{
|
||||
EMSG(_("E444: Cannot close last window"));
|
||||
emsg(_("E444: Cannot close last window"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -2318,12 +2318,12 @@ win_close(win_T *win, int free_buf)
|
||||
return FAIL; /* window is already being closed */
|
||||
if (win == aucmd_win)
|
||||
{
|
||||
EMSG(_("E813: Cannot close autocmd window"));
|
||||
emsg(_("E813: Cannot close autocmd window"));
|
||||
return FAIL;
|
||||
}
|
||||
if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window())
|
||||
{
|
||||
EMSG(_("E814: Cannot close window, only autocmd window would remain"));
|
||||
emsg(_("E814: Cannot close window, only autocmd window would remain"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -3419,7 +3419,7 @@ close_others(
|
||||
}
|
||||
|
||||
if (message && !ONE_WINDOW)
|
||||
EMSG(_("E445: Other window contains changes"));
|
||||
emsg(_("E445: Other window contains changes"));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -5447,7 +5447,7 @@ win_setminheight(void)
|
||||
--p_wmh;
|
||||
if (first)
|
||||
{
|
||||
EMSG(_(e_noroom));
|
||||
emsg(_(e_noroom));
|
||||
first = FALSE;
|
||||
}
|
||||
}
|
||||
@@ -5473,7 +5473,7 @@ win_setminwidth(void)
|
||||
--p_wmw;
|
||||
if (first)
|
||||
{
|
||||
EMSG(_(e_noroom));
|
||||
emsg(_(e_noroom));
|
||||
first = FALSE;
|
||||
}
|
||||
}
|
||||
@@ -5950,7 +5950,7 @@ command_height(void)
|
||||
{
|
||||
if (frp == NULL)
|
||||
{
|
||||
EMSG(_(e_noroom));
|
||||
emsg(_(e_noroom));
|
||||
p_ch = old_p_ch;
|
||||
curtab->tp_ch_used = p_ch;
|
||||
cmdline_row = Rows - p_ch;
|
||||
@@ -6041,7 +6041,7 @@ last_status_rec(frame_T *fr, int statusline)
|
||||
{
|
||||
if (fp == topframe)
|
||||
{
|
||||
EMSG(_(e_noroom));
|
||||
emsg(_(e_noroom));
|
||||
return;
|
||||
}
|
||||
/* In a column of frames: go to frame above. If already at
|
||||
@@ -6170,7 +6170,7 @@ file_name_in_line(
|
||||
if (*ptr == NUL) /* nothing found */
|
||||
{
|
||||
if (options & FNAME_MESS)
|
||||
EMSG(_("E446: No file name under cursor"));
|
||||
emsg(_("E446: No file name under cursor"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -6319,7 +6319,7 @@ find_file_name_in_path(
|
||||
{
|
||||
c = ptr[len];
|
||||
ptr[len] = NUL;
|
||||
EMSG2(_("E447: Can't find file \"%s\" in path"), ptr);
|
||||
semsg(_("E447: Can't find file \"%s\" in path"), ptr);
|
||||
ptr[len] = c;
|
||||
}
|
||||
|
||||
@@ -6782,7 +6782,7 @@ match_add(
|
||||
return -1;
|
||||
if (id < -1 || id == 0)
|
||||
{
|
||||
EMSGN(_("E799: Invalid ID: %ld (must be greater than or equal to 1)"), id);
|
||||
semsg(_("E799: Invalid ID: %ld (must be greater than or equal to 1)"), id);
|
||||
return -1;
|
||||
}
|
||||
if (id != -1)
|
||||
@@ -6792,7 +6792,7 @@ match_add(
|
||||
{
|
||||
if (cur->id == id)
|
||||
{
|
||||
EMSGN(_("E801: ID already taken: %ld"), id);
|
||||
semsg(_("E801: ID already taken: %ld"), id);
|
||||
return -1;
|
||||
}
|
||||
cur = cur->next;
|
||||
@@ -6800,12 +6800,12 @@ match_add(
|
||||
}
|
||||
if ((hlg_id = syn_namen2id(grp, (int)STRLEN(grp))) == 0)
|
||||
{
|
||||
EMSG2(_(e_nogroup), grp);
|
||||
semsg(_(e_nogroup), grp);
|
||||
return -1;
|
||||
}
|
||||
if (pat != NULL && (regprog = vim_regcomp(pat, RE_MAGIC)) == NULL)
|
||||
{
|
||||
EMSG2(_(e_invarg2), pat);
|
||||
semsg(_(e_invarg2), pat);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -6900,7 +6900,7 @@ match_add(
|
||||
}
|
||||
else
|
||||
{
|
||||
EMSG(_("List or number required"));
|
||||
emsg(_("List or number required"));
|
||||
goto fail;
|
||||
}
|
||||
if (toplnum == 0 || lnum < toplnum)
|
||||
@@ -6969,7 +6969,7 @@ match_delete(win_T *wp, int id, int perr)
|
||||
if (id < 1)
|
||||
{
|
||||
if (perr == TRUE)
|
||||
EMSGN(_("E802: Invalid ID: %ld (must be greater than or equal to 1)"),
|
||||
semsg(_("E802: Invalid ID: %ld (must be greater than or equal to 1)"),
|
||||
id);
|
||||
return -1;
|
||||
}
|
||||
@@ -6981,7 +6981,7 @@ match_delete(win_T *wp, int id, int perr)
|
||||
if (cur == NULL)
|
||||
{
|
||||
if (perr == TRUE)
|
||||
EMSGN(_("E803: ID not found: %ld"), id);
|
||||
semsg(_("E803: ID not found: %ld"), id);
|
||||
return -1;
|
||||
}
|
||||
if (cur == prev)
|
||||
|
Reference in New Issue
Block a user