]> granicus.if.org Git - vim/commitdiff
patch 8.2.4294: MS-Windows: #ifdefs for Cygwin are too complicated v8.2.4294
authorK.Takata <kentkt@csc.jp>
Fri, 4 Feb 2022 10:45:38 +0000 (10:45 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 4 Feb 2022 10:45:38 +0000 (10:45 +0000)
Problem:    MS-Windows: #ifdefs for Cygwin are too complicated.
Solution:   Simplify the conditions. (Ken Takata, closes #9693)

src/evalfunc.c
src/main.c
src/os_unix.c
src/os_win32.c
src/os_win32.h
src/version.c

index 71632cd294e85a58b4d631332e2684ad5fce129c..a584443dd8756b28489672e996666aac0b1d3ba6 100644 (file)
@@ -5196,7 +5196,7 @@ f_has(typval_T *argvars, typval_T *rettv)
 #endif
                },
        {"win32unix",
-#if defined(UNIX) && defined(__CYGWIN__)
+#ifdef WIN32UNIX
                1
 #else
                0
index 7c0c4e64fc7aa27e3e41e8f3f0a59e9cedd9a3a0..fa5d8f1d3d50fe056cdc7dd5e3ace8843c3f201f 100644 (file)
 #include "vim.h"
 
 #ifdef __CYGWIN__
-# ifndef MSWIN
-#  include <cygwin/version.h>
-#  include <sys/cygwin.h>      // for cygwin_conv_to_posix_path() and/or
+# include <cygwin/version.h>
+# include <sys/cygwin.h>       // for cygwin_conv_to_posix_path() and/or
                                // cygwin_conv_path()
-# endif
 # include <limits.h>
 #endif
 
@@ -2570,7 +2568,7 @@ scripterror:
                }
            }
 #endif
-#if defined(__CYGWIN32__) && !defined(MSWIN)
+#ifdef __CYGWIN32__
            /*
             * If vim is invoked by non-Cygwin tools, convert away any
             * DOS paths, so things like .swp files are created correctly.
index 984869809d9bdeca7af939533c8db5d2c43a9c34..cbd8ba8bda6b3179df5ded8da2bcd571cea82c77 100644 (file)
@@ -44,15 +44,13 @@ static int selinux_enabled = -1;
 #endif
 
 #ifdef __CYGWIN__
-# ifndef MSWIN
-#  include <cygwin/version.h>
-#  include <sys/cygwin.h>      // for cygwin_conv_to_posix_path() and/or
+# include <cygwin/version.h>
+# include <sys/cygwin.h>       // for cygwin_conv_to_posix_path() and/or
                                // for cygwin_conv_path()
-#  ifdef FEAT_CYGWIN_WIN32_CLIPBOARD
-#   define WIN32_LEAN_AND_MEAN
-#   include <windows.h>
-#   include "winclip.pro"
-#  endif
+# ifdef FEAT_CYGWIN_WIN32_CLIPBOARD
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+#  include "winclip.pro"
 # endif
 #endif
 
index d2d2fe7a309b84f66f9e609b2a12a99cdcb6c0a1..a01cee5b812ed36ddf492fe9b9e7f974e0e38180 100644 (file)
@@ -241,12 +241,6 @@ static char_u *exe_path = NULL;
 
 static BOOL win8_or_later = FALSE;
 
-#if defined(__GNUC__) && !defined(__MINGW32__)  && !defined(__CYGWIN__)
-# define UChar UnicodeChar
-#else
-# define UChar uChar.UnicodeChar
-#endif
-
 #if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL)
 // Dynamic loading for portability
 typedef struct _DYN_CONSOLE_SCREEN_BUFFER_INFOEX
@@ -306,7 +300,7 @@ is_ambiwidth_event(
                && ir->Event.KeyEvent.wRepeatCount == 1
                && ir->Event.KeyEvent.wVirtualKeyCode == 0x12
                && ir->Event.KeyEvent.wVirtualScanCode == 0x38
-               && ir->Event.KeyEvent.UChar == 0
+               && ir->Event.KeyEvent.uChar.UnicodeChar == 0
                && ir->Event.KeyEvent.dwControlKeyState == 2;
 }
 
@@ -317,7 +311,8 @@ make_ambiwidth_event(
 {
     down->Event.KeyEvent.wVirtualKeyCode = 0;
     down->Event.KeyEvent.wVirtualScanCode = 0;
-    down->Event.KeyEvent.UChar = up->Event.KeyEvent.UChar;
+    down->Event.KeyEvent.uChar.UnicodeChar
+                                   = up->Event.KeyEvent.uChar.UnicodeChar;
     down->Event.KeyEvent.dwControlKeyState = 0;
 }
 
@@ -1005,12 +1000,12 @@ win32_kbd_patch_key(
 
     if (s_iIsDead == 2)
     {
-       pker->UChar = (WCHAR) awAnsiCode[1];
+       pker->uChar.UnicodeChar = (WCHAR) awAnsiCode[1];
        s_iIsDead = 0;
        return 1;
     }
 
-    if (pker->UChar != 0)
+    if (pker->uChar.UnicodeChar != 0)
        return 1;
 
     CLEAR_FIELD(abKeystate);
@@ -1033,7 +1028,7 @@ win32_kbd_patch_key(
                        abKeystate, awAnsiCode, 2, 0);
 
     if (s_iIsDead > 0)
-       pker->UChar = (WCHAR) awAnsiCode[0];
+       pker->uChar.UnicodeChar = (WCHAR) awAnsiCode[0];
 
     return s_iIsDead;
 }
@@ -1075,7 +1070,8 @@ decode_key_event(
     }
 
     // special cases
-    if ((nModifs & CTRL) != 0 && (nModifs & ~CTRL) == 0 && pker->UChar == NUL)
+    if ((nModifs & CTRL) != 0 && (nModifs & ~CTRL) == 0
+                                           && pker->uChar.UnicodeChar == NUL)
     {
        // Ctrl-6 is Ctrl-^
        if (pker->wVirtualKeyCode == '6')
@@ -1137,7 +1133,7 @@ decode_key_event(
        *pch = NUL;
     else
     {
-       *pch = (i > 0) ? pker->UChar : NUL;
+       *pch = (i > 0) ? pker->uChar.UnicodeChar : NUL;
 
        if (pmodifiers != NULL)
        {
@@ -1683,7 +1679,7 @@ WaitForChar(long msec, int ignore_input)
 # ifdef FEAT_MBYTE_IME
                // Windows IME sends two '\n's with only one 'ENTER'.  First:
                // wVirtualKeyCode == 13. second: wVirtualKeyCode == 0
-               if (ir.Event.KeyEvent.UChar == 0
+               if (ir.Event.KeyEvent.uChar.UnicodeChar == 0
                        && ir.Event.KeyEvent.wVirtualKeyCode == 13)
                {
                    read_console_input(g_hConIn, &ir, 1, &cRecords);
index d22772353b8f33ba8cb930e08d1d510483904e31..464357070d3868fc2cfbbff9a1baec3d75d9c15b 100644 (file)
  */
 
 #include "os_dos.h"            // common MS-DOS and Win32 stuff
-#ifndef __CYGWIN__
 // cproto fails on missing include files
-# ifndef PROTO
-#  include <direct.h>          // for _mkdir()
-# endif
+#ifndef PROTO
+# include <direct.h>           // for _mkdir()
 #endif
 
 #define BINARY_FILE_IO
index 5140eb95207d5f126a5b8f97a198102456b4a46d..70d76d5773360578be7435441349bc9ad9d4a2a2 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4294,
 /**/
     4293,
 /**/