Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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)
|
|
Problem: Recent glibc marks sigset() as a deprecated.
Solution: Use sigaction() in mch_signal() if possible. (Ozaki Kiichi,
closes #12373)
|
|
Problem: Code style test doesn't check for space after "if".
Solution: Add a test for space.
|
|
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)
|
|
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)
|
|
Problem: Some settings use the current codepage instead of 'encoding'.
Solution: Adjust how options are initialized. (Ken Takata, closes #11992)
|
|
Problem: MS-Windows: scrollback cropped off on Vim exit.
Solution: Don't call SetConsoleScreenBufferInfoEx when using the alternate
screen buffer. (Christopher Plewright, closes #11882)
|
|
Problem: Checking returned value of ga_grow() is inconsistent.
Solution: Check for FAIL instaed of "not OK". (Yegappan Lakshmanan,
closes #11897)
|
|
Problem: MS-Windows console: not flushing termguicolors.
Solution: Flush termguicolors. (Christopher Plewright, closes #11871)
|
|
Problem: ColorTable saving and restoring does not work properly.
Solution: Restore ColorTable[16] usage. (Christopher Plewright,
closes #11836)
|
|
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11819)
|
|
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)
|
|
Problem: MS-Windows: various special keys and modifiers are not mappable.
Solution: Adjust the handling of keys with modifiers. (Christian Plewright,
closes #11768)
|
|
Problem: test_mswin_event() can hang.
Solution: Add the "execute" argument to process events right away.
(Christopher Plewright, closes #11760)
|
|
Problem: Clang warns for unused variable.
Solution: Adjust #ifdef. (John Marriott)
|
|
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)
|
|
Problem: Compiler warns for uninitialized variable.
Solution: Initialize the variable. Remove unused function. (John Marriott)
|
|
Problem: Code handling low level MS-Windows events cannot be tested.
Solution: Add test_mswin_event() and tests using it. (Christopher Plewright,
closes #11622)
|
|
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.
|
|
Problem: Using one window for executing autocommands is insufficient.
Solution: Use up to five windows for executing autocommands.
|
|
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)
|
|
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)
|
|
Problem: Preprocessor indenting is off.
Solution: Adjust preprocessor indentation. (Ken Takata, closes #11546)
|
|
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)
|
|
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)
|
|
Problem: Compiler warnings for unused variables.
Solution: Addjust #ifdef and remove unused variables. (John Marriott)
|
|
Problem: Various typos.
Solution: Correct typos. (closes #11432)
|
|
Problem: MS-Windows: cannot map console mouse scroll events.
Solution: Change CSI to K_SPECIAL when checking for a mapping. (Christopher
Plewright, closes #11410)
|
|
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)
|
|
Problem: MS-Windows: compiler complains about unused function.
Solution: Add #ifdef. (John Marriott)
|
|
Problem: MS-Windows: mouse scrolling in terminal misbehaves without dll.
Solution: Add #ifdef as a temporary solution. (Christopher Plewright,
closes #11392)
|
|
Problem: MS-Windows: mouse scrolling not supported in the console.
Solution: Add event handling for mouse scroll events. (Christopher
Plewright, closes #11374)
|
|
Problem: passing modifier codes to a shell running in the GUI. (Gary
Johnson)
Solution: Include modifier codes into the key and drop the modifiers.
|
|
Problem: BS and DEL do not work properly in an interacive shell. (Gary
Johnson)
Solution: Adjust the length for replaced codes.
|
|
Problem: No good reason to keep supporting Windows-XP.
Solution: Drop Windows-XP support. (Ken Takata, closes #11089)
|
|
Problem: CI: running tests in parallel causes flakiness.
Solution: Reorganize the MS-Windows runs. (Ken Takata, closes #11101)
|
|
Problem: Inverted condition is a bit confusing.
Solution: Remove the "!" and swap the blocks. (Ken 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)
|
|
Problem: MS-Windows: background color wrong in Console.
Solution: Figure out the default console background color. (Yasuhiro
Matsumoto, issue #10310)
|
|
Problem: Redraw flags are not named specifically.
Solution: Prefix "UPD_" to the flags, for UPDate_screen().
|
|
Problem: Using "volatile int" in a signal handler might be wrong.
Solution: Use "volatile sig_atomic_t".
|
|
Problem: Timeout handling is not optimal.
Solution: Avoid setting timeout_flag twice. Adjust the pointer when
stopping the regexp timeout. Adjust variable name.
|