summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0918
diff options
context:
space:
mode:
Diffstat (limited to 'data/vim/patches/8.1.0918')
-rw-r--r--data/vim/patches/8.1.0918430
1 files changed, 430 insertions, 0 deletions
diff --git a/data/vim/patches/8.1.0918 b/data/vim/patches/8.1.0918
new file mode 100644
index 000000000..e7e36712d
--- /dev/null
+++ b/data/vim/patches/8.1.0918
@@ -0,0 +1,430 @@
+To: vim_dev@googlegroups.com
+Subject: Patch 8.1.0918
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 8.1.0918
+Problem: MS-Windows: startup messages are not converted.
+Solution: Convert messages when the current codepage differs from
+ 'encoding'. (Yasuhiro Matsumoto, closes #3914)
+Files: src/message.c, src/os_mswin.c, src/vim.h
+
+
+*** ../vim-8.1.0917/src/message.c 2019-01-24 17:59:35.135217476 +0100
+--- src/message.c 2019-02-14 14:04:44.531851174 +0100
+***************
+*** 2570,2626 ****
+ msg_puts_printf(char_u *str, int maxlen)
+ {
+ char_u *s = str;
+! char_u buf[4];
+! char_u *p;
+! #ifdef WIN3264
+! # if !defined(FEAT_GUI_MSWIN)
+! char_u *ccp = NULL;
+
+! # endif
+ if (!(silent_mode && p_verbose == 0))
+! mch_settmode(TMODE_COOK); /* handle '\r' and '\n' correctly */
+!
+! # if !defined(FEAT_GUI_MSWIN)
+! if (enc_codepage >= 0 && (int)GetConsoleCP() != enc_codepage)
+! {
+! int inlen = (int)STRLEN(str);
+! int outlen;
+! WCHAR *widestr = (WCHAR *)enc_to_utf16(str, &inlen);
+!
+! if (widestr != NULL)
+! {
+! WideCharToMultiByte_alloc(GetConsoleCP(), 0, widestr, inlen,
+! (LPSTR *)&ccp, &outlen, 0, 0);
+! vim_free(widestr);
+! s = str = ccp;
+! }
+! }
+! # endif
+ #endif
+ while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL)
+ {
+ if (!(silent_mode && p_verbose == 0))
+ {
+! /* NL --> CR NL translation (for Unix, not for "--version") */
+! p = &buf[0];
+! if (*s == '\n' && !info_message)
+! *p++ = '\r';
+! #if defined(USE_CR)
+! else
+ #endif
+! *p++ = *s;
+! *p = '\0';
+! if (info_message) /* informative message, not an error */
+! mch_msg((char *)buf);
+! else
+! mch_errmsg((char *)buf);
+ }
+
+! /* primitive way to compute the current column */
+ #ifdef FEAT_RIGHTLEFT
+ if (cmdmsg_rl)
+ {
+! if (*s == '\r' || *s == '\n')
+ msg_col = Columns - 1;
+ else
+ --msg_col;
+--- 2570,2614 ----
+ msg_puts_printf(char_u *str, int maxlen)
+ {
+ char_u *s = str;
+! char_u *buf = NULL;
+! char_u *p = s;
+
+! #ifdef WIN3264
+ if (!(silent_mode && p_verbose == 0))
+! mch_settmode(TMODE_COOK); /* handle CR and NL correctly */
+ #endif
+ while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL)
+ {
+ if (!(silent_mode && p_verbose == 0))
+ {
+! // NL --> CR NL translation (for Unix, not for "--version")
+! if (*s == NL)
+! {
+! int n = (int)(s - p);
+!
+! buf = alloc(n + 3);
+! memcpy(buf, p, n);
+! if (!info_message)
+! buf[n++] = CAR;
+! #ifdef USE_CR
+! else
+ #endif
+! buf[n++] = NL;
+! buf[n++] = NUL;
+! if (info_message) // informative message, not an error
+! mch_msg((char *)buf);
+! else
+! mch_errmsg((char *)buf);
+! vim_free(buf);
+! p = s + 1;
+! }
+ }
+
+! // primitive way to compute the current column
+ #ifdef FEAT_RIGHTLEFT
+ if (cmdmsg_rl)
+ {
+! if (*s == CAR || *s == NL)
+ msg_col = Columns - 1;
+ else
+ --msg_col;
+***************
+*** 2628,2646 ****
+ else
+ #endif
+ {
+! if (*s == '\r' || *s == '\n')
+ msg_col = 0;
+ else
+ ++msg_col;
+ }
+ ++s;
+ }
+! msg_didout = TRUE; /* assume that line is not empty */
+
+ #ifdef WIN3264
+- # if !defined(FEAT_GUI_MSWIN)
+- vim_free(ccp);
+- # endif
+ if (!(silent_mode && p_verbose == 0))
+ mch_settmode(TMODE_RAW);
+ #endif
+--- 2616,2642 ----
+ else
+ #endif
+ {
+! if (*s == CAR || *s == NL)
+ msg_col = 0;
+ else
+ ++msg_col;
+ }
+ ++s;
+ }
+!
+! if (*p != NUL && !(silent_mode && p_verbose == 0))
+! {
+! if (maxlen > 0 && STRLEN(p) > (size_t)maxlen)
+! p[maxlen] = 0;
+! if (info_message)
+! mch_msg((char *)p);
+! else
+! mch_errmsg((char *)p);
+! }
+!
+! msg_didout = TRUE; // assume that line is not empty
+
+ #ifdef WIN3264
+ if (!(silent_mode && p_verbose == 0))
+ mch_settmode(TMODE_RAW);
+ #endif
+***************
+*** 2941,2972 ****
+ void
+ mch_errmsg(char *str)
+ {
+ int len;
+
+! #if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI)
+ /* 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 (
+! # ifdef UNIX
+! # ifdef MACOS_X
+ (isatty(2) && strcmp("/dev/console", ttyname(2)) != 0)
+! # else
+ isatty(2)
+! # endif
+! # ifdef FEAT_GUI
+ ||
+ # endif
+! # endif
+! # ifdef FEAT_GUI
+ !(gui.in_use || gui.starting)
+! # endif
+ )
+ {
+ fprintf(stderr, "%s", str);
+ return;
+ }
+! #endif
+
+ /* avoid a delay for a message that isn't there */
+ emsg_on_display = FALSE;
+--- 2937,2987 ----
+ void
+ mch_errmsg(char *str)
+ {
++ #if defined(WIN3264) && !defined(FEAT_GUI_MSWIN)
++ int len = STRLEN(str);
++ DWORD nwrite = 0;
++ DWORD mode = 0;
++ HANDLE h = GetStdHandle(STD_ERROR_HANDLE);
++
++ if (GetConsoleMode(h, &mode) && enc_codepage >= 0
++ && (int)GetConsoleCP() != enc_codepage)
++ {
++ WCHAR *w = enc_to_utf16((char_u *)str, &len);
++
++ WriteConsoleW(h, w, len, &nwrite, NULL);
++ vim_free(w);
++ }
++ else
++ {
++ fprintf(stderr, "%s", str);
++ }
++ #else
+ int len;
+
+! # if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI)
+ /* 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 (
+! # ifdef UNIX
+! # ifdef MACOS_X
+ (isatty(2) && strcmp("/dev/console", ttyname(2)) != 0)
+! # else
+ isatty(2)
+! # endif
+! # ifdef FEAT_GUI
+ ||
++ # endif
+ # endif
+! # ifdef FEAT_GUI
+ !(gui.in_use || gui.starting)
+! # endif
+ )
+ {
+ fprintf(stderr, "%s", str);
+ return;
+ }
+! # endif
+
+ /* avoid a delay for a message that isn't there */
+ emsg_on_display = FALSE;
+***************
+*** 2981,2987 ****
+ {
+ mch_memmove((char_u *)error_ga.ga_data + error_ga.ga_len,
+ (char_u *)str, len);
+! #ifdef UNIX
+ /* remove CR characters, they are displayed */
+ {
+ char_u *p;
+--- 2996,3002 ----
+ {
+ mch_memmove((char_u *)error_ga.ga_data + error_ga.ga_len,
+ (char_u *)str, len);
+! # ifdef UNIX
+ /* remove CR characters, they are displayed */
+ {
+ char_u *p;
+***************
+*** 2995,3004 ****
+ *p = ' ';
+ }
+ }
+! #endif
+ --len; /* don't count the NUL at the end */
+ error_ga.ga_len += len;
+ }
+ }
+
+ /*
+--- 3010,3020 ----
+ *p = ' ';
+ }
+ }
+! # endif
+ --len; /* don't count the NUL at the end */
+ error_ga.ga_len += len;
+ }
++ #endif
+ }
+
+ /*
+***************
+*** 3009,3015 ****
+ void
+ mch_msg(char *str)
+ {
+! #if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI)
+ /* 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.
+--- 3025,3051 ----
+ void
+ mch_msg(char *str)
+ {
+! #if defined(WIN3264) && !defined(FEAT_GUI_MSWIN)
+! int len = STRLEN(str);
+! DWORD nwrite = 0;
+! DWORD mode;
+! HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
+!
+!
+! if (GetConsoleMode(h, &mode) && enc_codepage >= 0
+! && (int)GetConsoleCP() != enc_codepage)
+! {
+! WCHAR *w = enc_to_utf16((char_u *)str, &len);
+!
+! WriteConsoleW(h, w, len, &nwrite, NULL);
+! vim_free(w);
+! }
+! else
+! {
+! printf("%s", str);
+! }
+! #else
+! # if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI)
+ /* 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.
+***************
+*** 3035,3040 ****
+--- 3071,3077 ----
+ }
+ # endif
+ mch_errmsg(str);
++ #endif
+ }
+ #endif /* USE_MCH_ERRMSG */
+
+*** ../vim-8.1.0917/src/os_mswin.c 2019-02-12 23:12:33.600730918 +0100
+--- src/os_mswin.c 2019-02-14 13:48:22.873645483 +0100
+***************
+*** 675,680 ****
+--- 675,681 ----
+ # undef display_errors
+ #endif
+
++ #ifdef FEAT_GUI
+ /*
+ * Display the saved error message(s).
+ */
+***************
+*** 690,702 ****
+ if (!isspace(*p))
+ {
+ (void)gui_mch_dialog(
+- #ifdef FEAT_GUI
+ gui.starting ? VIM_INFO :
+- #endif
+ VIM_ERROR,
+- #ifdef FEAT_GUI
+ gui.starting ? (char_u *)_("Message") :
+- #endif
+ (char_u *)_("Error"),
+ (char_u *)p, (char_u *)_("&Ok"),
+ 1, NULL, FALSE);
+--- 691,699 ----
+***************
+*** 705,710 ****
+--- 702,714 ----
+ ga_clear(&error_ga);
+ }
+ }
++ #else
++ void
++ display_errors(void)
++ {
++ FlushFileBuffers(GetStdHandle(STD_ERROR_HANDLE));
++ }
++ #endif
+ #endif
+
+
+*** ../vim-8.1.0917/src/vim.h 2019-02-01 20:42:18.718884011 +0100
+--- src/vim.h 2019-02-14 13:48:22.873645483 +0100
+***************
+*** 2093,2099 ****
+ * functions of these names. The declarations would break if the defines had
+ * been seen at that stage. But it must be before globals.h, where error_ga
+ * is declared. */
+! #if !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_X11) \
+ && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) && !defined(PROTO)
+ # define mch_errmsg(str) fprintf(stderr, "%s", (str))
+ # define display_errors() fflush(stderr)
+--- 2093,2099 ----
+ * functions of these names. The declarations would break if the defines had
+ * been seen at that stage. But it must be before globals.h, where error_ga
+ * is declared. */
+! #if !defined(MSWIN) && !defined(FEAT_GUI_X11) \
+ && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) && !defined(PROTO)
+ # define mch_errmsg(str) fprintf(stderr, "%s", (str))
+ # define display_errors() fflush(stderr)
+*** ../vim-8.1.0917/src/version.c 2019-02-14 13:43:33.779220100 +0100
+--- src/version.c 2019-02-14 13:49:48.741169891 +0100
+***************
+*** 785,786 ****
+--- 785,788 ----
+ { /* Add new patch number below this line */
++ /**/
++ 918,
+ /**/
+
+--
+BODY: I'm not dead!
+CART DRIVER: 'Ere. He says he's not dead.
+LARGE MAN: Yes he is.
+BODY: I'm not!
+ "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
+/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\ an exciting new programming language -- http://www.Zimbu.org ///
+ \\\ help me help AIDS victims -- http://ICCF-Holland.org ///