aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/message.c
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-12-21 15:57:55 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-12-23 14:00:09 +0100
commiteae6727325111e596b49bb04337a467e8833397c (patch)
tree7be92bb7cb7cf1575ca0c714b8c7012fd25d6555 /src/nvim/message.c
parent7121241e5cecbd741795aec37a3cb1203c8e9f34 (diff)
downloadrneovim-eae6727325111e596b49bb04337a467e8833397c.tar.gz
rneovim-eae6727325111e596b49bb04337a467e8833397c.tar.bz2
rneovim-eae6727325111e596b49bb04337a467e8833397c.zip
refactor: remove os_errmsg and os_msg functions
Instead replace them with fprintf and printf.
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r--src/nvim/message.c42
1 files changed, 4 insertions, 38 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 895fba1372..2c0e8064fb 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -225,7 +225,7 @@ int verb_msg(const char *s)
}
/// Displays the string 's' on the status line
-/// When terminal not initialized (yet) os_errmsg(..) is used.
+/// When terminal not initialized (yet) printf("%s", ..) is used.
///
/// @return true if wait_return() not called
int msg(const char *s, const int attr)
@@ -748,7 +748,7 @@ bool emsg_multiline(const char *s, bool multiline)
/// emsg() - display an error message
///
/// Rings the bell, if appropriate, and calls message() to do the real work
-/// When terminal not initialized (yet) os_errmsg(..) is used.
+/// When terminal not initialized (yet) fprintf(stderr, "%s", ..) is used.
///
/// @return true if wait_return() not called
bool emsg(const char *s)
@@ -2635,9 +2635,9 @@ static void msg_puts_printf(const char *str, const ptrdiff_t maxlen)
memcpy(p, s, (size_t)len);
*(p + len) = '\0';
if (info_message) {
- os_msg(buf);
+ printf("%s", buf);
} else {
- os_errmsg(buf);
+ fprintf(stderr, "%s", buf);
}
}
@@ -2899,40 +2899,6 @@ static bool do_more_prompt(int typed_char)
return retval;
}
-#if defined(MSWIN)
-/// Headless (no UI) error message handler.
-static void do_msg(const char *str, bool errmsg)
-{
- static bool did_err = false;
- assert(str != NULL);
- wchar_t *utf16str;
- int r = utf8_to_utf16(str, -1, &utf16str);
- if (r != 0 && !did_err) {
- did_err = true;
- fprintf(stderr, "utf8_to_utf16 failed: %d", r);
- ELOG("utf8_to_utf16 failed: %d", r);
- } else if (r == 0) {
- if (errmsg) {
- fwprintf(stderr, L"%ls", utf16str);
- } else {
- wprintf(L"%ls", utf16str);
- }
- xfree(utf16str);
- }
-}
-
-void os_errmsg(const char *str)
-{
- do_msg(str, true);
-}
-
-/// Headless (no UI) message handler.
-void os_msg(const char *str)
-{
- do_msg(str, false);
-}
-#endif // MSWIN
-
void msg_moremsg(int full)
{
int attr = hl_combine_attr(HL_ATTR(HLF_MSG), HL_ATTR(HLF_M));