annotate vimtutor.bat @ 33713:9aa03e12b2b5 v9.0.2090

patch 9.0.2090: complete_info() skips entries with 'noselect' Commit: https://github.com/vim/vim/commit/57f9ce1a0977da13e5923214086795ffa2d28ce1 Author: Christian Brabandt <cb@256bit.org> Date: Sat Nov 4 09:58:14 2023 +0100 patch 9.0.2090: complete_info() skips entries with 'noselect' Problem: complete_info() skips entries with 'noselect' Solution: Check, if first entry is at original text state Unfortunately, Commit daef8c74375141974d61b85199b383017644978c introduced a regression, that when ':set completeopt+=noselect' is set and no completion item has been selected yet, it did not fill the complete_info['items'] list. This happened, because the current match item did not have the CP_ORIGINAL_TEXT flag set and then the cp->prev pointer did point to the original flag item, which caused the following while loop to not being run but being skipped instead. So when the 'noselect' is set, only start with to the previous selection item, if the initial completion item has the CP_ORIGINAL_TEXT flag set, else use the 2nd previous item instead. fixes: #13451 closes: #13452 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 04 Nov 2023 10:15:04 +0100
parents 79aaaa134298
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 :: Start Vim on a copy of the tutor file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 @echo off
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 :: Usage: vimtutor [-console] [xx]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 ::
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 :: -console means gvim will not be used
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 :: xx is a language code like "es" or "nl".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 :: When an xx argument is given, it tries loading that tutor.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 :: When this fails or no xx argument was given, it tries using 'v:lang'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 :: When that also fails, it uses the English version.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 :: Use Vim to copy the tutor, it knows the value of $VIMRUNTIME
19711
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
13 FOR %%d in (. %TMP% %TEMP%) DO (
25812
79aaaa134298 patch 8.2.3441: MS-Windows: vimtutor can't handle path with spaces
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
14 call :test_dir_writable "%~dpf0" %%d
19711
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
15 IF NOT ERRORLEVEL 1 GOTO dir_ok
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
16 )
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
17
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
18 echo No working directory is found
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
19 GOTO end
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
20
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
21 :test_dir_writable
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
22 SET TUTORCOPY=%2\$tutor$
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
23 COPY %1 %TUTORCOPY% >nul 2>nul
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
24 GOTO end
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
25
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
26 :dir_ok
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 SET xx=%1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 IF NOT .%1==.-console GOTO use_gui
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 SHIFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 SET xx=%1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 GOTO use_vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 :use_gui
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 :: Try making a copy of tutor with gvim. If gvim cannot be found, try using
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 :: vim instead. If vim cannot be found, alert user to check environment and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 :: installation.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 :: The script tutor.vim tells Vim which file to copy.
19711
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
41 start "dummy" /b /w "%~dp0gvim.exe" -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 IF ERRORLEVEL 1 GOTO use_vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 :: Start gvim without any .vimrc, set 'nocompatible'
19711
831a3f3be6f4 patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents: 13113
diff changeset
45 start "dummy" /b /w "%~dp0gvim.exe" -u NONE -c "set nocp" %TUTORCOPY%
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 GOTO end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 :use_vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 :: The script tutor.vim tells Vim which file to copy
12485
ab40ecb0fd73 patch 8.0.1122: vimtutor.bat doesn't work well with vim.bat
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
51 call vim -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 IF ERRORLEVEL 1 GOTO no_executable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 :: Start vim without any .vimrc, set 'nocompatible'
12485
ab40ecb0fd73 patch 8.0.1122: vimtutor.bat doesn't work well with vim.bat
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
55 call vim -u NONE -c "set nocp" %TUTORCOPY%
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 GOTO end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 :no_executable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 ECHO.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 ECHO.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 ECHO No vim or gvim found in current directory or PATH.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 ECHO Check your installation or re-run install.exe
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 :end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 :: remove the copy of the tutor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 IF EXIST %TUTORCOPY% DEL %TUTORCOPY%
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 SET xx=