mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
Remove USE_MCH_ERRMSG
USE_MCH_ERRMSG has never been defined, so the dead code has been removed.
This commit is contained in:
@@ -904,11 +904,6 @@ EXTERN disptick_T display_tick INIT(= 0);
|
||||
* cursor position in Insert mode. */
|
||||
EXTERN linenr_T spell_redraw_lnum INIT(= 0);
|
||||
|
||||
#ifdef USE_MCH_ERRMSG
|
||||
// Grow array to collect error messages in until they can be displayed.
|
||||
EXTERN garray_T error_ga INIT(= GA_EMPTY_INIT_VALUE);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The error messages that can be shared are included here.
|
||||
|
@@ -2554,78 +2554,7 @@ static int do_more_prompt(int typed_char)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if defined(USE_MCH_ERRMSG) || defined(WIN32)
|
||||
|
||||
# ifdef mch_errmsg
|
||||
# undef mch_errmsg
|
||||
# endif
|
||||
# ifdef mch_msg
|
||||
# undef mch_msg
|
||||
# endif
|
||||
|
||||
# if defined(USE_MCH_ERRMSG)
|
||||
// Give an error message. To be used when the screen hasn't been initialized
|
||||
// yet. When stderr can't be used, collect error messages until the GUI has
|
||||
// started and they can be displayed in a message box.
|
||||
void mch_errmsg(const char *const str)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
# ifdef UNIX
|
||||
// On Unix use stderr if it's a tty.
|
||||
// When not going to start the GUI also use stderr.
|
||||
// On Mac, when started from Finder, stderr is the console.
|
||||
if (os_isatty(2)) {
|
||||
fprintf(stderr, "%s", str);
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
/* avoid a delay for a message that isn't there */
|
||||
emsg_on_display = FALSE;
|
||||
|
||||
const size_t len = strlen(str) + 1;
|
||||
if (error_ga.ga_data == NULL) {
|
||||
ga_set_growsize(&error_ga, 80);
|
||||
error_ga.ga_itemsize = 1;
|
||||
}
|
||||
ga_grow(&error_ga, len);
|
||||
memmove(error_ga.ga_data + error_ga.ga_len, str, len);
|
||||
# ifdef UNIX
|
||||
// remove CR characters, they are displayed/
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
p = (char_u *)error_ga.ga_data + error_ga.ga_len;
|
||||
for (;; ) {
|
||||
p = vim_strchr(p, '\r');
|
||||
if (p == NULL)
|
||||
break;
|
||||
*p = ' ';
|
||||
}
|
||||
}
|
||||
# endif
|
||||
len--; // don't count the NUL at the end
|
||||
error_ga.ga_len += len;
|
||||
}
|
||||
|
||||
// Give a message. To be used when the screen hasn't been initialized yet.
|
||||
// When there is no tty, collect messages until the GUI has started and they
|
||||
// can be displayed in a message box.
|
||||
void mch_msg(char *str)
|
||||
{
|
||||
# ifdef UNIX
|
||||
// On Unix use stdout if we have a tty. This allows "vim -h | more" and
|
||||
// uses mch_errmsg() when started from the desktop.
|
||||
// When not going to start the GUI also use stdout.
|
||||
// On Mac, when started from Finder, stderr is the console.
|
||||
if (os_isatty(2)) {
|
||||
printf("%s", str);
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
mch_errmsg(str);
|
||||
}
|
||||
# else
|
||||
#if defined(WIN32)
|
||||
void mch_errmsg(char *str)
|
||||
{
|
||||
wchar_t *utf16str;
|
||||
@@ -2649,8 +2578,7 @@ void mch_msg(char *str)
|
||||
xfree(utf16str);
|
||||
}
|
||||
}
|
||||
# endif // USE_MCH_ERRMSG
|
||||
#endif // USE_MCH_ERRMSG && WIN32
|
||||
#endif // WIN32
|
||||
|
||||
/*
|
||||
* Put a character on the screen at the current message position and advance
|
||||
|
Reference in New Issue
Block a user