summaryrefslogtreecommitdiffstats
path: root/src/os_win32.c
AgeCommit message (Collapse)Author
2024-02-21patch 9.1.0123: MS-Windows: system() may deadlockv9.1.0123GuyBrush
Problem: MS-Windows: system() may deadlock when calling binaries that expect stdin Solution: Ignore the SHELL_EXPAND flag (GuyBrush) This happens on binaries that expect stdin. For example: :echo system("xxd") will cause a deadlock. SHELL_EXPAND is a flag devoted to support the linux implementation of the backtick-expansion mechanism. On linux backtic-expansion relies in the function mch_expand_wildchars() (os_unix.c) that delegates on each specific shell (bash, sh, csh, zsh) the expansion. Basically it composes a shell command that does the expansion and redirects the output to a file and call_shell() it. On windows backtick-expansion is performed by Vim itself. On linux SHELL_EXPAND modifies how mch_call_shell_fork() (os_unix.c) works. This function: - relies on posix fork() to spawn a child process to execute a external command. - Child and parent process communicate using pipes (or pseudoterminal if available). User input (type ahead content) is processed in a loop only if !(SHELL_EXPAND || SHELL_COOKED). Though signals are used to detect Ctrl-C in all cases (the input loop is not necessary to interrupt the function). In the backtick-expansion the external command is the shell command that provides the expansion. For the child redirection: - SHELL_EXPAND replaces stdin, stdout & stderr to /dev/null. This is why the shell command composed includes redirection (otherwise output would be lost). - !SHELL_EXPAND replaces stdin, stdout & stderr with the parent created pipes (or pseudoterminal). Note that the use of SIGINT signal prevents mch_call_shell_fork() from hanging vim. On Windows mch_system_piped() (os_win32.c) (which is only used when the GUI is running) mimics mch_call_shell_fork() (os_unix.c). Win32 lacks fork() and relies on CreateProcessW() and only has pipe support (not pseudoterminal) which makes the implementation much different. But, the key idea is that windows lacks signals, the OS provides support for console apps but gvim is not one. The only way of detecting a Ctrl-C is actually processing user input (type ahead content). By ignoring the user input under SHELL_EXPAND the function can hang gvim. Ignoring SHELL_EXPAND flag has no consequence in Windows because as mentioned above it is only meaningful in linux. closes: #13988 Signed-off-by: GuyBrush <miguel.barro@live.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-14patch 9.1.0028: win32: Ctrl-D cannot be used to close a pipev9.1.0028GuyBrush
Problem: win32: Ctrl-D cannot be used to close a pipe Solution: Properly detect Ctrl-D when reading from a pipe (GuyBrush) Enabling Ctrl-D for gvim pipeline input and apply defensive programming on account of PR #12752 so that once PR 12752 is merged, CTRL-D will keep on working closes: #13849 Signed-off-by: GuyBrush <miguel.barro@live.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-04patch 9.1.0006: is*() and to*() function may be unsafev9.1.0006Keith Thompson
Problem: is*() and to*() function may be unsafe Solution: Add SAFE_* macros and start using those instead (Keith Thompson) Use SAFE_() macros for is*() and to*() functions The standard is*() and to*() functions declared in <ctype.h> have undefined behavior for negative arguments other than EOF. If plain char is signed, passing an unchecked value from argv for from user input to one of these functions has undefined behavior. Solution: Add SAFE_*() macros that cast the argument to unsigned char. Most implementations behave sanely for negative arguments, and most character values in practice are non-negative, but it's still best to avoid undefined behavior. The change from #13347 has been omitted, as this has already been separately fixed in commit ac709e2fc0db6d31abb7da96f743c40956b60c3a (v9.0.2054) fixes: #13332 closes: #13347 Signed-off-by: Keith Thompson <Keith.S.Thompson@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-27patch 9.0.2186: LTCG compile error ARM64 for write_charsv9.0.2186Saleem Abdulrasool
Problem: LTCG compile error on Win/ARM64 for `write_chars()` Solution: Explicitly initialise the storage to use data rather than BSS (Saleem Abdulrasool) win32: add a workaround for a LTCG issue on Windows ARM64 It appears that the implicit initialisation which would push `g_coords` into BSS causes an aliasing issue with LTCG on ARM64. By explicitly initialising the value, we use usual data storage but prevent the aliasing. This allows the console version of VIM to run on Windows ARM64 again. fixes: #13453 closes: #13775 Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-11patch 9.0.2099: win32: terminal codes clear the terminalv9.0.2099Nir Lichtman
Problem: Terminal control codes¹ are sent even when silent mode is on, causing the terminal to clear up Solution: Block any terminal codes when silent mode is on ¹https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences fixes: #12822 closes: #13521 Signed-off-by: Nir Lichtman <nir@lichtman.org> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-04patch 9.0.1980: win32: issues with stable python ABIv9.0.1980Ken Takata
Problem: win32: issues with stable python ABI Solution: if_python3,win32: Fix Python3 stable ABI There were some issues in current stable ABI implementation on Windows: * Python DLL name should be `python3.dll` instead of `python311.dll` and so on. (See: https://docs.python.org/3/c-api/stable.html) * Some non-stable API functions were used: - `_PyObject_NextNotImplemented` - `PyStdPrinter_Type` * `reset_stdin()` and `hook_py_exit()` didn't work with `python3.dll`. `python3.dll` is a special type of DLL called forwarder DLL. It just forwards the functions to other DLL (e.g. `python311.dll`). There were two issues regarding these functions: - `python3.dll` doesn't have import tables. This caused a crash in `get_imported_func_info()`. Add a check whether the specified DLL has an import table. - `reset_stdin()` and `hook_py_exit()` should be applied to the forwarded DLL (e.g. `python311.dll`), not to `python3.dll`. Check the export directory of `python3.dll` to find the forwarded DLL and apply the functions to it. closes: #13260 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ken Takata <kentkt@csc.jp>
2023-09-16patch 9.0.1901: win32: not correctly freeing environmentv9.0.1901Ken Takata
Problem: win32: not correctly freeing environment Solution: After we call GetEnvironmentStringsW, we should call FreeEnvironmentStringsW closes: #13096 closes: #13094 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ken Takata <kentkt@csc.jp>
2023-08-20patch 9.0.1769: executable() ignoring symlinks on Windowsv9.0.1769AmberArr
Problem: executable() ignoring symlinks on Windows Solution: resolve reparse points closes: #12562 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: AmberArr <me@frost.moe>
2023-05-15patch 9.0.1560: Win32: When 'encoding' is set $PATH has duplicate entriesv9.0.1560K.Takata
Problem: Win32: When 'encoding' is set $PATH has duplicate entries. Solution: Only append the directory if it is not there yet. (Ken Takata, closes #12400, closes #12372)
2023-05-11patch 9.0.1544: recent glibc marks sigset() as a deprecatedv9.0.1544ichizok
Problem: Recent glibc marks sigset() as a deprecated. Solution: Use sigaction() in mch_signal() if possible. (Ozaki Kiichi, closes #12373)
2023-05-09patch 9.0.1529: code style test doesn't check for space after "if"v9.0.1529Bram Moolenaar
Problem: Code style test doesn't check for space after "if". Solution: Add a test for space.
2023-03-07patch 9.0.1391: "clear" macros are not always usedv9.0.1391Yegappan Lakshmanan
Problem: "clear" macros are not always used. Solution: Use ALLOC_ONE, VIM_CLEAR, CLEAR_POINTER and CLEAR_FIELD in more places. (Yegappan Lakshmanan, closes #12104)
2023-03-07patch 9.0.1390: FOR_ALL_ macros are defined in an unexpected filev9.0.1390Yegappan Lakshmanan
Problem: FOR_ALL_ macros are defined in an unexpected file. Solution: Move FOR_ALL_ macros to macros.h. Add FOR_ALL_HASHTAB_ITEMS. (Yegappan Lakshmanan, closes #12109)
2023-02-15patch 9.0.1313: some settings use the current codepage instead of 'encoding'v9.0.1313K.Takata
Problem: Some settings use the current codepage instead of 'encoding'. Solution: Adjust how options are initialized. (Ken Takata, closes #11992)
2023-01-28patch 9.0.1252: MS-Windows: scrollback cropped off on Vim exitv9.0.1252Christopher Plewright
Problem: MS-Windows: scrollback cropped off on Vim exit. Solution: Don't call SetConsoleScreenBufferInfoEx when using the alternate screen buffer. (Christopher Plewright, closes #11882)
2023-01-27patch 9.0.1251: checking returned value of ga_grow() is inconsistentv9.0.1251Yegappan Lakshmanan
Problem: Checking returned value of ga_grow() is inconsistent. Solution: Check for FAIL instaed of "not OK". (Yegappan Lakshmanan, closes #11897)
2023-01-23patch 9.0.1235: MS-Windows console: not flushing termguicolorsv9.0.1235Christopher Plewright
Problem: MS-Windows console: not flushing termguicolors. Solution: Flush termguicolors. (Christopher Plewright, closes #11871)
2023-01-22patch 9.0.1232: ColorTable saving and restoring does not work properlyv9.0.1232Christopher Plewright
Problem: ColorTable saving and restoring does not work properly. Solution: Restore ColorTable[16] usage. (Christopher Plewright, closes #11836)
2023-01-16patch 9.0.1208: code is indented more than necessaryv9.0.1208Yegappan Lakshmanan
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11819)
2023-01-10patch 9.0.1169: some key+modifier tests fail on some AppVeyor imagesv9.0.1169Christopher Plewright
Problem: Some key+modifier tests fail on some AppVeyor images. Solution: Adjust the tests for key movements and fix the revealed bugs. (Christopher Plewright, closes #11798)
2023-01-04patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappablev9.0.1146Christopher Plewright
Problem: MS-Windows: various special keys and modifiers are not mappable. Solution: Adjust the handling of keys with modifiers. (Christian Plewright, closes #11768)
2022-12-30patch 9.0.1112: test_mswin_event() can hangv9.0.1112Christopher Plewright
Problem: test_mswin_event() can hang. Solution: Add the "execute" argument to process events right away. (Christopher Plewright, closes #11760)
2022-12-22patch 9.0.1088: clang warns for unused variablev9.0.1088Bram Moolenaar
Problem: Clang warns for unused variable. Solution: Adjust #ifdef. (John Marriott)
2022-12-22patch 9.0.1086: display wrong in Windows terminal after exiting Vimv9.0.1086Christopher Plewright
Problem: Display wrong in Windows terminal after exiting Vim. Solution: Apply screen restore fix for Windows 11 also to Windows 10 builds. (Christopher Plewright, closes #11713, closes #11706)
2022-12-20patch 9.0.1085: compiler warns for uninitialized variablev9.0.1085Bram Moolenaar
Problem: Compiler warns for uninitialized variable. Solution: Initialize the variable. Remove unused function. (John Marriott)
2022-12-20patch 9.0.1084: code handling low level MS-Windows events cannot be testedv9.0.1084Christopher Plewright
Problem: Code handling low level MS-Windows events cannot be tested. Solution: Add test_mswin_event() and tests using it. (Christopher Plewright, closes #11622)
2022-11-30patch 9.0.0977: it is not easy to see what client-server commands are doingv9.0.0977Bram Moolenaar
Problem: It is not easy to see what client-server commands are doing. Solution: Add channel log messages if ch_log() is available. Move the channel logging and make it available with the +eval feature.
2022-11-28patch 9.0.0965: using one window for executing autocommands is insufficientv9.0.0965Bram Moolenaar
Problem: Using one window for executing autocommands is insufficient. Solution: Use up to five windows for executing autocommands.
2022-11-23patch 9.0.0931: MS-Windows: mouse column limited to 223v9.0.0931Christopher Plewright
Problem: MS-Windows: mouse column limited to 223. Solution: Use two bytes for each mouse coordinate. Add the mouse position to scroll events. (Christopher Plewright, closes #11597)
2022-11-22patch 9.0.0918: MS-Windows: modifier keys do not work with mouse scroll eventv9.0.0918Christopher Plewright
Problem: MS-Windows: modifier keys do not work with mouse scroll events. Solution: Use K_SPECIAL instead of CSI for the modifier keys. (Christopher Plewright, closes #11587)
2022-11-14patch 9.0.0880: preprocessor indenting is offv9.0.0880K.Takata
Problem: Preprocessor indenting is off. Solution: Adjust preprocessor indentation. (Ken Takata, closes #11546)
2022-11-12patch 9.0.0868: MS-Windows: after Vim exits console resizing problemv9.0.0868Christopher Plewright
Problem: MS-Windows: after Vim exits console resizing does not work properly. Solution: Restore screen behavior checks for various WT and VTP combinations. (Christopher Plewright, closes #11526, closes #11507)
2022-11-09patch 9.0.0850: MS-Windows Terminal has unstable color controlv9.0.0850Christopher Plewright
Problem: MS-Windows Terminal has unstable color control. Solution: Do not try to read the old command prompt colortable, use modern VT sequences. (Christopher Plewright, closes #11450, closes #11373)
2022-11-06patch 9.0.0838: compiler warnings for unused variablesv9.0.0838Bram Moolenaar
Problem: Compiler warnings for unused variables. Solution: Addjust #ifdef and remove unused variables. (John Marriott)
2022-11-02patch 9.0.0828: various typosv9.0.0828dundargoc
Problem: Various typos. Solution: Correct typos. (closes #11432)
2022-10-20patch 9.0.0802: MS-Windows: cannot map console mouse scroll eventsv9.0.0802Christopher Plewright
Problem: MS-Windows: cannot map console mouse scroll events. Solution: Change CSI to K_SPECIAL when checking for a mapping. (Christopher Plewright, closes #11410)
2022-10-19patch 9.0.0793: MS-Windows: mouse scroll events only work with the dllv9.0.0793Christopher Plewright
Problem: MS-Windows: mouse scroll events only work with the dll. Solution: Accept CSI codes for MS-Windows without the GUI. (Christopher Plewright, closes #11401)
2022-10-18patch 9.0.0792: MS-Windows: compiler complains about unused functionv9.0.0792Bram Moolenaar
Problem: MS-Windows: compiler complains about unused function. Solution: Add #ifdef. (John Marriott)
2022-10-18patch 9.0.0787: mouse scrolling in terminal misbehaves without dllv9.0.0787Christopher Plewright
Problem: MS-Windows: mouse scrolling in terminal misbehaves without dll. Solution: Add #ifdef as a temporary solution. (Christopher Plewright, closes #11392)
2022-10-16patch 9.0.0775: MS-Windows: mouse scrolling not supported in the consolev9.0.0775Christopher Plewright
Problem: MS-Windows: mouse scrolling not supported in the console. Solution: Add event handling for mouse scroll events. (Christopher Plewright, closes #11374)
2022-10-04patch 9.0.0655: passing modifier codes to a shell running in the GUIv9.0.0655Bram Moolenaar
Problem: passing modifier codes to a shell running in the GUI. (Gary Johnson) Solution: Include modifier codes into the key and drop the modifiers.
2022-10-03patch 9.0.0653: BS and DEL do not work properly in an interacive shellv9.0.0653Bram Moolenaar
Problem: BS and DEL do not work properly in an interacive shell. (Gary Johnson) Solution: Adjust the length for replaced codes.
2022-09-18patch 9.0.0496: no good reason to keep supporting Windows-XPv9.0.0496K.Takata
Problem: No good reason to keep supporting Windows-XP. Solution: Drop Windows-XP support. (Ken Takata, closes #11089)
2022-09-10patch 9.0.0436: CI: running tests in parallel causes flakinessv9.0.0436K.Takata
Problem: CI: running tests in parallel causes flakiness. Solution: Reorganize the MS-Windows runs. (Ken Takata, closes #11101)
2022-09-05patch 9.0.0392: inverted condition is a bit confusingv9.0.0392K.Takata
Problem: Inverted condition is a bit confusing. Solution: Remove the "!" and swap the blocks. (Ken Takata)
2022-09-01patch 9.0.0347: MS-Windows: cannot set cursor shape in Windows Terminalv9.0.0347K.Takata
Problem: MS-Windows: cannot set cursor shape in Windows Terminal. Solution: Make cursor shape work with Windows Terminal. (Ken Takata, closes #11028, closes #6576)
2022-09-01patch 9.0.0344: MS-Windows: background color wrong in Consolev9.0.0344Yasuhiro Matsumoto
Problem: MS-Windows: background color wrong in Console. Solution: Figure out the default console background color. (Yasuhiro Matsumoto, issue #10310)
2022-08-14patch 9.0.0206: redraw flags are not named specificallyv9.0.0206Bram Moolenaar
Problem: Redraw flags are not named specifically. Solution: Prefix "UPD_" to the flags, for UPDate_screen().
2022-06-20patch 8.2.5141: using "volatile int" in a signal handler might be wrongv8.2.5141Bram Moolenaar
Problem: Using "volatile int" in a signal handler might be wrong. Solution: Use "volatile sig_atomic_t".
2022-06-19patch 8.2.5129: timeout handling is not optimalv8.2.5129Bram Moolenaar
Problem: Timeout handling is not optimal. Solution: Avoid setting timeout_flag twice. Adjust the pointer when stopping the regexp timeout. Adjust variable name.