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:
28
src/term.c
28
src/term.c
@@ -92,7 +92,7 @@ static int term_is_builtin(char_u *name);
|
||||
static int term_7to8bit(char_u *p);
|
||||
|
||||
#ifdef HAVE_TGETENT
|
||||
static char_u *tgetent_error(char_u *, char_u *);
|
||||
static char *tgetent_error(char_u *, char_u *);
|
||||
|
||||
/*
|
||||
* Here is our own prototype for tgetstr(), any prototypes from the include
|
||||
@@ -1357,7 +1357,7 @@ termgui_get_color(char_u *name)
|
||||
t = termgui_mch_get_color(name);
|
||||
|
||||
if (t == INVALCOLOR)
|
||||
EMSG2(_("E254: Cannot allocate color %s"), name);
|
||||
semsg(_("E254: Cannot allocate color %s"), name);
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -1696,14 +1696,14 @@ get_term_entries(int *height, int *width)
|
||||
#endif
|
||||
|
||||
static void
|
||||
report_term_error(char_u *error_msg, char_u *term)
|
||||
report_term_error(char *error_msg, char_u *term)
|
||||
{
|
||||
struct builtin_term *termp;
|
||||
|
||||
mch_errmsg("\r\n");
|
||||
if (error_msg != NULL)
|
||||
{
|
||||
mch_errmsg((char *)error_msg);
|
||||
mch_errmsg(error_msg);
|
||||
mch_errmsg("\r\n");
|
||||
}
|
||||
mch_errmsg("'");
|
||||
@@ -1756,7 +1756,7 @@ set_termname(char_u *term)
|
||||
int termcap_cleared = FALSE;
|
||||
#endif
|
||||
int width = 0, height = 0;
|
||||
char_u *error_msg = NULL;
|
||||
char *error_msg = NULL;
|
||||
char_u *bs_p, *del_p;
|
||||
|
||||
/* In silect mode (ex -s) we don't use the 'term' option. */
|
||||
@@ -2191,7 +2191,7 @@ del_mouse_termcode(
|
||||
* Call tgetent()
|
||||
* Return error message if it fails, NULL if it's OK.
|
||||
*/
|
||||
static char_u *
|
||||
static char *
|
||||
tgetent_error(char_u *tbuf, char_u *term)
|
||||
{
|
||||
int i;
|
||||
@@ -2210,13 +2210,13 @@ tgetent_error(char_u *tbuf, char_u *term)
|
||||
|
||||
if (i < 0)
|
||||
# ifdef TGETENT_ZERO_ERR
|
||||
return (char_u *)_("E557: Cannot open termcap file");
|
||||
return _("E557: Cannot open termcap file");
|
||||
if (i == 0)
|
||||
# endif
|
||||
#ifdef TERMINFO
|
||||
return (char_u *)_("E558: Terminal entry not found in terminfo");
|
||||
return _("E558: Terminal entry not found in terminfo");
|
||||
#else
|
||||
return (char_u *)_("E559: Terminal entry not found in termcap");
|
||||
return _("E559: Terminal entry not found in termcap");
|
||||
#endif
|
||||
}
|
||||
return NULL;
|
||||
@@ -2282,7 +2282,7 @@ add_termcap_entry(char_u *name, int force)
|
||||
char_u tbuf[TBUFSZ];
|
||||
char_u tstrbuf[TBUFSZ];
|
||||
char_u *tp = tstrbuf;
|
||||
char_u *error_msg = NULL;
|
||||
char *error_msg = NULL;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -2369,10 +2369,10 @@ add_termcap_entry(char_u *name, int force)
|
||||
{
|
||||
#ifdef HAVE_TGETENT
|
||||
if (error_msg != NULL)
|
||||
EMSG(error_msg);
|
||||
emsg(error_msg);
|
||||
else
|
||||
#endif
|
||||
EMSG2(_("E436: No \"%s\" entry in termcap"), name);
|
||||
semsg(_("E436: No \"%s\" entry in termcap"), name);
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
@@ -3055,7 +3055,7 @@ ttest(int pairs)
|
||||
* MUST have "cm": cursor motion.
|
||||
*/
|
||||
if (*T_CM == NUL)
|
||||
EMSG(_("E437: terminal capability \"cm\" required"));
|
||||
emsg(_("E437: terminal capability \"cm\" required"));
|
||||
|
||||
/*
|
||||
* if "cs" defined, use a scroll region, it's faster.
|
||||
@@ -6153,7 +6153,7 @@ replace_termcodes(
|
||||
if (STRNICMP(src, "<SID>", 5) == 0)
|
||||
{
|
||||
if (current_sctx.sc_sid <= 0)
|
||||
EMSG(_(e_usingsid));
|
||||
emsg(_(e_usingsid));
|
||||
else
|
||||
{
|
||||
src += 5;
|
||||
|
Reference in New Issue
Block a user