view vimtutor.bat @ 34776:19e038a1139a v9.1.0264

patch 9.1.0264: libgpm may delete some signal handlers Commit: https://github.com/vim/vim/commit/cc59d62215b075c715294ad24a41bfd091cb8d48 Author: Julio B <julio.bacel@gmail.com> Date: Thu Apr 4 21:55:10 2024 +0200 patch 9.1.0264: libgpm may delete some signal handlers Problem: libgpm may delete some signal handlers Solution: restore these signal handlers after calling gpm (Julio B) When 'mouse' is set, vim is trying to detect mouse support on startup. Eventually, vim resorts to using libgpm as the final method of mouse detection. This library may delete some signals handlers that were initially set up by vim. This is how: - mch_setmouse() calls gpm_open() - Gpm_Open is executed, which returns early on line 210 [1] - Keep in mind that lines 353-373 [2] are skipped, so gpm_saved_suspend_hook and gpm_saved_winch_hook are empty - Finally, Gpm_Close is called, which will reset [3] SIGWINCH and SIGTSTP to an empty sigaction. [1] https://github.com/telmich/gpm/blob/e82d1a653ca94aa4ed12441424da6ce780b1e530/src/lib/liblow.c#L210 [2] https://github.com/telmich/gpm/blob/e82d1a653ca94aa4ed12441424da6ce780b1e530/src/lib/liblow.c#L353-L373 [3] https://github.com/telmich/gpm/blob/e82d1a653ca94aa4ed12441424da6ce780b1e530/src/lib/liblow.c#L419-L424 fixes: #12154 closes: #14401 Signed-off-by: Julio B <julio.bacel@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 04 Apr 2024 22:00:06 +0200
parents 79aaaa134298
children
line wrap: on
line source

:: Start Vim on a copy of the tutor file.
@echo off

:: Usage: vimtutor [-console] [xx]
::
:: -console means gvim will not be used
:: xx is a language code like "es" or "nl".
:: When an xx argument is given, it tries loading that tutor.
:: When this fails or no xx argument was given, it tries using 'v:lang'
:: When that also fails, it uses the English version.

:: Use Vim to copy the tutor, it knows the value of $VIMRUNTIME
FOR %%d in (. %TMP% %TEMP%) DO (
    call :test_dir_writable "%~dpf0" %%d
    IF NOT ERRORLEVEL 1 GOTO dir_ok
)

echo No working directory is found
GOTO end

:test_dir_writable
SET TUTORCOPY=%2\$tutor$
COPY %1 %TUTORCOPY% >nul 2>nul
GOTO end

:dir_ok

SET xx=%1

IF NOT .%1==.-console GOTO use_gui
SHIFT
SET xx=%1
GOTO use_vim
:use_gui

:: Try making a copy of tutor with gvim.  If gvim cannot be found, try using
:: vim instead.  If vim cannot be found, alert user to check environment and
:: installation.

:: The script tutor.vim tells Vim which file to copy.
start "dummy" /b /w "%~dp0gvim.exe" -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim"
IF ERRORLEVEL 1 GOTO use_vim

:: Start gvim without any .vimrc, set 'nocompatible'
start "dummy" /b /w "%~dp0gvim.exe" -u NONE -c "set nocp" %TUTORCOPY%

GOTO end

:use_vim
:: The script tutor.vim tells Vim which file to copy
call vim -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim"
IF ERRORLEVEL 1 GOTO no_executable

:: Start vim without any .vimrc, set 'nocompatible'
call vim -u NONE -c "set nocp" %TUTORCOPY%

GOTO end

:no_executable
ECHO.
ECHO.
ECHO No vim or gvim found in current directory or PATH.
ECHO Check your installation or re-run install.exe

:end
:: remove the copy of the tutor
IF EXIST %TUTORCOPY% DEL %TUTORCOPY%
SET xx=