vim/src
Drew Vogel cf2642fc72
patch 9.1.1345: tests: Test_xxd_color2() test failure dump diff is misleading
Problem:  tests: Test_xxd_color2() test failure dump diff is misleading
Solution: Ensure the reference dump and the test dump are both processed the
          same (Drew Vogel).

Background:

Commit b6dc76b6fd sought to make the xxd
screendump tests compatible with non-standard `XXD` overrides. It provides a
vim script that matches a very general `xxd` command pattern but then also
removed the matching line from the reference dump. This second step was
unnecessary because `VerifyScreenDump()` runs the associated vim script against
both the reference dump and the test dump.

Problem Details:

As part of some unrelated work, the GUI tests were failing with a window size 1
column too narrow. The screendumps in `Test_xxd_color2` were failing as a
result. When I loaded the diff using `term_dumpdiff()` the associated vim
scripts are not run. As a result, the test dump contained the `xxd` invocation
on line 1 while reference dump did not. This throws the diff off, obscuring the
true issue of the GUI window being too narrow.

Verification:

In addition to the test suite, locally I've tried to recreate the issue being
fixed in b6dc76b6fd. Setting a very non-standard
`XXD` path, this test still passes:

```
XXD=/home/dvogel/opt/vim/bin/xxd TEST_FILTER=Test_xxd_color2 TERM=xterm-color make test_xxd
rm -f test_xxd.res test.log messages starttime
if test -n "${ASAN_OPTIONS}"; then \
   XXD=../xxd/xxd; export XXD; ASAN_OPTIONS="${ASAN_OPTIONS}_test_xxd" \
UBSAN_OPTIONS="${UBSAN_OPTIONS}_test_xxd" VIMRUNTIME=../../runtime  ../vim -f \
-u unix.vim --gui-dialog-file guidialog -U NONE --noplugin --not-a-term -S \
runtest.vim test_xxd.vim ; \
fi

From test_xxd.vim:
Executed Test_xxd_color2()               in   0.066049 seconds
Filtered 17 tests with $TEST_FILTER and $TEST_SKIP_PAT
Executed 1 test                          in   0.096862 seconds
```

closes: #17202

Signed-off-by: Drew Vogel <dvogel@github>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-04-25 19:06:53 +02:00
..
auto patch 9.1.1064: not possible to use plural forms with gettext() 2025-02-01 15:47:51 +01:00
GvimExt patch 9.1.1029: the installer can be improved 2025-01-17 14:04:44 +01:00
libvterm patch 9.1.1078: Terminal ansi colors off by one after tgc reset 2025-02-06 20:31:27 +01:00
po translation(ru): fix and updated messages translation 2025-04-03 21:04:57 +02:00
proto patch 9.1.1341: cannot define completion triggers 2025-04-24 21:48:35 +02:00
tee
testdir patch 9.1.1345: tests: Test_xxd_color2() test failure dump diff is misleading 2025-04-25 19:06:53 +02:00
xdiff patch 9.0.2153: no support to build on OpenVMS 2023-12-05 16:04:23 +01:00
xpm
xxd patch 9.1.0912: xxd: integer overflow with sparse files and -autoskip 2024-12-07 16:27:22 +01:00
alloc.c patch 9.0.1594: some internal error messages are translated 2023-05-31 17:12:14 +01:00
alloc.h
arabic.c
arglist.c patch 9.1.1003: [security]: heap-buffer-overflow with visual mode 2025-01-11 15:25:00 +01:00
ascii.h
autocmd.c patch 9.1.1329: cannot get information about command line completion 2025-04-21 11:12:41 +02:00
beval.c patch 9.0.2032: cannot get mouse click pos for tab or virt text 2023-10-15 10:03:30 +02:00
beval.h
bigvim.bat patch 9.0.1994: inconsistent feature description 2023-10-05 22:25:12 +02:00
bigvim64.bat patch 9.0.1994: inconsistent feature description 2023-10-05 22:25:12 +02:00
blob.c patch 9.1.0027: Vim is missing a foreach() func 2024-01-13 11:47:33 +01:00
blowfish.c patch 9.0.1594: some internal error messages are translated 2023-05-31 17:12:14 +01:00
buffer.c patch 9.1.1341: cannot define completion triggers 2025-04-24 21:48:35 +02:00
bufwrite.c patch 9.1.1129: missing out-of-memory test in buf_write() 2025-02-20 23:17:09 +01:00
change.c patch 9.1.1266: MS-Windows: type conversion warnings 2025-04-01 20:38:37 +02:00
channel.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
charset.c patch 9.1.1108: 'smoothscroll' gets stuck with 'listchars' "eol" 2025-02-13 20:34:34 +01:00
cindent.c patch 9.1.1190: C indentation does not detect multibyte labels 2025-03-09 16:07:15 +01:00
clientserver.c patch 9.1.0356: MS-Windows: --remote may change working directory 2024-04-19 15:26:21 +02:00
clipboard.c patch 9.1.0852: No warning when X11 registers are not available 2024-11-11 20:52:55 +01:00
cmdexpand.c patch 9.1.1340: cannot complete :filetype arguments 2025-04-23 21:12:26 +02:00
cmdhist.c patch 9.1.0798: too many strlen() calls in cmdhist.c 2024-10-21 22:37:07 +02:00
config.h.in patch 9.1.1064: not possible to use plural forms with gettext() 2025-02-01 15:47:51 +01:00
config.mk.dist
config.mk.in patch 9.1.0173: msgfmt ver. 0.22 forcibly converts text to UTF-8 2024-03-12 22:14:39 +01:00
configure
configure.ac patch 9.1.1064: not possible to use plural forms with gettext() 2025-02-01 15:47:51 +01:00
create_cmdidxs.vim
create_nvcmdidxs.c
create_nvcmdidxs.vim
crypt.c patch 9.0.2153: no support to build on OpenVMS 2023-12-05 16:04:23 +01:00
crypt_zip.c patch 9.0.1481: decrypting with libsodium may fail if the library changes 2023-04-23 17:50:22 +01:00
debugger.c patch 9.0.1930: compiler warnings with clang-17 2023-09-24 16:16:06 +02:00
dict.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
diff.c patch 9.1.1319: Various typos in the code, issue with test_inst_complete.vim 2025-04-18 10:57:33 +02:00
digraph.c patch 9.1.1065: no digraph for "Approaches the limit" 2025-02-01 16:17:14 +01:00
dlldata.c
dosinst.c patch 9.1.0370: MS-Windows: patch number is zero in installer 2024-04-25 21:25:19 +02:00
dosinst.h
drawline.c patch 9.1.1243: diff mode is lacking for changes within lines 2025-03-26 19:46:09 +01:00
drawscreen.c patch 9.1.1136: Match highlighting marks a buffer region as changed 2025-02-22 09:19:04 +01:00
edit.c patch 9.1.1305: completion menu active after switching windows/tabs 2025-04-15 19:02:00 +02:00
errors.h patch 9.1.1283: quickfix stack is limited to 10 items 2025-04-06 17:20:39 +02:00
eval.c patch 9.1.1244: part of patch v9.1.1242 was wrong 2025-03-26 20:36:12 +01:00
evalbuffer.c patch 9.1.0831: 'findexpr' can't be used as lambad or Funcref 2024-11-02 18:43:42 +01:00
evalfunc.c patch 9.1.1341: cannot define completion triggers 2025-04-24 21:48:35 +02:00
evalvars.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
evalwindow.c patch 9.1.0888: leftcol property not available in getwininfo() 2024-11-25 19:39:04 +01:00
ex_cmdidxs.h patch 9.1.1224: cannot :put while keeping indent 2025-03-18 22:14:34 +01:00
ex_cmds.c patch 9.1.0849: there are a few typos in the source 2024-11-10 20:26:12 +01:00
ex_cmds.h patch 9.1.1224: cannot :put while keeping indent 2025-03-18 22:14:34 +01:00
ex_cmds2.c patch 9.1.1158: :verbose set has wrong file name with :compiler! 2025-02-28 17:32:07 +01:00
ex_docmd.c patch 9.1.1295: clientserver: does not handle :stopinsert correctly 2025-04-12 18:09:28 +02:00
ex_eval.c patch 9.1.0999: Vim9: leaking finished exception 2025-01-09 22:14:34 +01:00
ex_getln.c patch 9.1.1338: Calling expand() interferes with cmdcomplete_info() 2025-04-23 20:50:23 +02:00
feature.h patch 9.1.1282: Build and test failure without job feature 2025-04-06 16:15:10 +02:00
fileio.c patch 9.1.1339: missing out-of-memory checks for enc_to_utf16()/utf16_to_enc() 2025-04-23 20:56:08 +02:00
filepath.c patch 9.1.1218: missing out-of-memory check in filepath.c 2025-03-17 21:14:17 +01:00
findfile.c patch 9.1.1266: MS-Windows: type conversion warnings 2025-04-01 20:38:37 +02:00
float.c patch 9.1.1300: wrong detection of -inf 2025-04-14 21:19:34 +02:00
fold.c patch 9.1.1317: noisy error when restoring folds from session fails 2025-04-17 20:43:25 +02:00
gc.c patch 9.1.1239: if_python: no tuple data type support 2025-03-26 18:46:21 +01:00
getchar.c patch 9.1.1216: Pasting the '.' register multiple times may not work 2025-03-17 21:02:50 +01:00
globals.h patch 9.1.1267: Vim9: no support for type list/dict<object<any>> 2025-04-01 20:43:36 +02:00
gui.c patch 9.1.1137: ins_str() is inefficient by calling STRLEN() 2025-02-23 09:09:59 +01:00
gui.h patch 9.1.0133: MS-Windows: ligatures not rendering correctly 2024-02-24 14:26:52 +01:00
gui_beval.c patch 9.1.0063: GTK code can be improved 2024-01-29 20:18:22 +01:00
gui_dwrite.cpp
gui_dwrite.h
gui_gtk.c patch 9.1.0881: GUI: message dialog may not get focus 2024-11-23 13:35:43 +01:00
gui_gtk_f.c
gui_gtk_f.h
gui_gtk_res.xml
gui_gtk_vms.h
gui_gtk_x11.c patch 9.1.1199: gvim uses hardcoded xpm icon file 2025-03-12 23:16:42 +01:00
gui_haiku.cc patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
gui_haiku.h
gui_motif.c patch 9.1.0210: Motif: leaking memory when mui_mch_dialog() fails 2024-03-26 18:44:48 +01:00
gui_photon.c patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
gui_w32.c patch 9.1.1339: missing out-of-memory checks for enc_to_utf16()/utf16_to_enc() 2025-04-23 20:56:08 +02:00
gui_w32_rc.h
gui_x11.c patch 9.1.0432: Ancient XPM preprocessor hack may cause build errors 2024-05-22 16:51:53 +02:00
gui_x11_pm.h
gui_xim.c patch 9.1.0078: GTK3: using wrong style for pre-edit area 2024-02-06 10:49:14 +01:00
gui_xmdlg.c
gui_xmebw.c
gui_xmebw.h
gui_xmebwp.h
gvimtutor
hardcopy.c patch 9.1.0907: printoptions:portrait does not change postscript Orientation 2024-12-06 17:19:25 +01:00
hashtab.c patch 9.0.1390: FOR_ALL_ macros are defined in an unexpected file 2023-03-07 17:13:51 +00:00
help.c patch 9.1.0658: Coverity warns about dereferencing NULL pointer. 2024-08-03 14:52:00 +02:00
highlight.c patch 9.1.1243: diff mode is lacking for changes within lines 2025-03-26 19:46:09 +01:00
if_cscope.c patch 9.1.0959: Coverity complains about type conversion 2024-12-25 10:20:51 +01:00
if_lua.c patch 9.1.0848: if_lua: v:false/v:true are not evaluated to boolean 2024-11-09 18:31:08 +01:00
if_mzsch.c patch 9.1.0630: MS-Windows: build fails with VIMDLL and mzscheme 2024-07-27 13:25:34 +02:00
if_mzsch.h
if_ole.cpp patch 9.0.1687: mapset() not properly handling script ID 2023-08-11 23:16:10 +02:00
if_ole.h
if_ole.idl
if_perl.xs patch 9.1.1103: if_perl: still some compile errors with Perl 5.38 2025-02-11 20:06:07 +01:00
if_perlsfio.c
if_py_both.h patch 9.1.1251: if_python: build error with tuples and dynamic python 2025-03-27 20:15:26 +01:00
if_python.c patch 9.1.1256: if_python: duplicate tuple data entries 2025-03-29 08:53:12 +01:00
if_python3.c patch 9.1.1251: if_python: build error with tuples and dynamic python 2025-03-27 20:15:26 +01:00
if_ruby.c patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines 2024-01-29 19:32:39 +01:00
if_tcl.c patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines 2024-01-29 19:32:39 +01:00
if_xcmdsrv.c patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
iid_ole.c
indent.c patch 9.1.1328: too many strlen() calls in indent.c 2025-04-21 11:03:21 +02:00
insexpand.c patch 9.1.1344: double free in f_complete_match() (after v9.1.1341) 2025-04-25 19:01:06 +02:00
INSTALL INSTALL: remove outdated notice about statically linked executable 2024-07-20 12:08:43 +02:00
install-sh
INSTALLami.txt
INSTALLmac.txt Update runtime files 2023-05-14 18:50:25 +01:00
installman.sh
installml.sh
INSTALLpc.txt runtime(doc): clarify ARCH value for 32-bit in INSTALLpc.txt 2024-12-27 15:51:09 +01:00
INSTALLvms.txt patch 9.0.2153: no support to build on OpenVMS 2023-12-05 16:04:23 +01:00
INSTALLx.txt Update runtime files 2023-04-22 22:40:14 +01:00
iscygpty.c patch 9.0.2054: win32: iscygpty needs update 2023-10-20 11:57:08 +02:00
iscygpty.h
job.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
json.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
json_test.c
keymap.h patch 9.1.0058: Cannot map Super Keys in GTK UI 2024-01-25 22:44:00 +01:00
kword_test.c
linematch.c patch 9.1.1303: missing out-of-memory check in linematch.c 2025-04-15 18:15:24 +02:00
link.390
link.sh patch 9.1.0452: Configure checks for libelf unnecessarily 2024-05-30 19:31:36 +02:00
list.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
locale.c
logfile.c patch 9.0.1453: typos in source code and tests 2023-04-14 21:54:25 +01:00
macros.h patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
main.c patch 9.1.1324: undefined behaviour if X11 connection dies 2025-04-19 11:25:18 +02:00
Make_all.mak
Make_ami.mak patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
Make_cyg.mak
Make_cyg_ming.mak patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
Make_ming.mak
Make_mvc.mak patch 9.1.1275: MS-Windows: Not possible to pass additional flags to Make_mvc 2025-04-03 21:35:00 +02:00
Make_vms.mms patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
Makefile patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
map.c patch 9.1.0814: mapset() may remove unrelated mapping 2024-10-24 21:43:43 +02:00
mark.c patch 9.1.0556: :bwipe doesn't remove file from jumplist of other tabpages 2024-07-10 19:36:36 +02:00
match.c patch 9.1.1136: Match highlighting marks a buffer region as changed 2025-02-22 09:19:04 +01:00
mbyte.c patch 9.1.1276: inline word diff treats multibyte chars as word char 2025-04-04 19:16:21 +02:00
memfile.c patch 9.1.0842: not checking for the sync() systemcall 2024-11-04 20:36:41 +01:00
memfile_test.c
memline.c patch 9.1.0615: Unnecessary STRLEN() in make_percent_swname() 2024-07-25 20:58:42 +02:00
menu.c patch 9.0.1687: mapset() not properly handling script ID 2023-08-11 23:16:10 +02:00
message.c patch 9.1.1339: missing out-of-memory checks for enc_to_utf16()/utf16_to_enc() 2025-04-23 20:56:08 +02:00
message_test.c patch 9.1.1097: --log with non-existent path causes a crash 2025-02-10 21:12:19 +01:00
misc1.c patch 9.1.1003: [security]: heap-buffer-overflow with visual mode 2025-01-11 15:25:00 +01:00
misc2.c patch 9.1.1247: fragile setup to get (preferred) keys from key_name_entry 2025-03-27 17:51:03 +01:00
mouse.c patch 9.1.1330: may receive E315 in terminal 2025-04-21 11:23:12 +02:00
move.c patch 9.1.1297: Ctrl-D scrolling can get stuck 2025-04-13 17:45:34 +02:00
msvc-latest.bat
msvc2015.bat
msvc2017.bat
msvc2019.bat
msvc2022.bat
msys32.bat
msys64.bat
mysign
nbdebug.c
nbdebug.h
netbeans.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
normal.c patch 9.1.1319: Various typos in the code, issue with test_inst_complete.vim 2025-04-18 10:57:33 +02:00
nv_cmdidxs.h
nv_cmds.h
ops.c patch 9.1.1319: Various typos in the code, issue with test_inst_complete.vim 2025-04-18 10:57:33 +02:00
option.c patch 9.1.1341: cannot define completion triggers 2025-04-24 21:48:35 +02:00
option.h patch 9.1.1341: cannot define completion triggers 2025-04-24 21:48:35 +02:00
optiondefs.h patch 9.1.1341: cannot define completion triggers 2025-04-24 21:48:35 +02:00
optionstr.c patch 9.1.1341: cannot define completion triggers 2025-04-24 21:48:35 +02:00
os_amiga.c patch 9.0.1529: code style test doesn't check for space after "if" 2023-05-09 15:00:00 +01:00
os_amiga.h patch 9.0.1653: Amiga: default 'viewdir' may not work 2023-06-23 22:23:01 +01:00
os_dos.h patch 9.0.1650: MS-Windows: default 'viewdir' may include read-only directory 2023-06-23 16:15:13 +01:00
os_haiku.h patch 9.1.1153: build error on Haiku 2025-02-26 22:26:16 +01:00
os_haiku.rdef.in
os_mac.h patch 9.0.1621: FILETYPE_FILE is defined to the same value multiple times 2023-06-08 22:16:23 +01:00
os_mac_conv.c
os_macosx.m patch 9.0.1471: warnings for function declarations 2023-04-19 20:28:48 +01:00
os_mswin.c patch 9.1.1339: missing out-of-memory checks for enc_to_utf16()/utf16_to_enc() 2025-04-23 20:56:08 +02:00
os_qnx.c patch 9.0.1391: "clear" macros are not always used 2023-03-07 17:45:11 +00:00
os_qnx.h
os_unix.c patch 9.1.1319: Various typos in the code, issue with test_inst_complete.vim 2025-04-18 10:57:33 +02:00
os_unix.h patch 9.1.0979: VMS: type warning with $XDG_VIMRC_FILE 2024-12-30 10:10:01 +01:00
os_unixx.h patch 9.0.1544: recent glibc marks sigset() as a deprecated 2023-05-11 22:25:42 +01:00
os_vms.c
os_vms_conf.h patch 9.1.0005: OpenVMS does not support python3 and xterm_save 2024-01-04 21:05:18 +01:00
os_vms_fix.com
os_vms_mms.c
os_w32dll.c patch 9.1.0621: MS-Windows: startup code can be improved 2024-07-26 18:46:54 +02:00
os_w32exe.c patch 9.1.0630: MS-Windows: build fails with VIMDLL and mzscheme 2024-07-27 13:25:34 +02:00
os_win32.c patch 9.1.1339: missing out-of-memory checks for enc_to_utf16()/utf16_to_enc() 2025-04-23 20:56:08 +02:00
os_win32.h patch 9.1.0750: there are some Win9x legacy references 2024-09-30 19:42:28 +02:00
osdef.sh
osdef1.h.in
osdef2.h.in
pathdef.sh
popupmenu.c patch 9.1.1306: completion menu rendering can be improved 2025-04-15 19:06:58 +02:00
popupwin.c patch 9.1.1248: compile error when building without FEAT_QUICKFIX 2025-03-27 18:16:52 +01:00
profiler.c patch 9.1.0089: qsort() comparison functions should be transitive 2024-02-09 19:39:14 +01:00
proto.h patch 9.1.1291: too many strlen() calls in buffer.c 2025-04-10 21:34:19 +02:00
protodef.h
pty.c patch 9.0.2180: POSIX function name in exarg causes issues 2023-12-19 20:53:07 +01:00
quickfix.c patch 9.1.1319: Various typos in the code, issue with test_inst_complete.vim 2025-04-18 10:57:33 +02:00
README.md patch 9.1.0431: eval.c is too long 2024-05-22 16:45:04 +02:00
regexp.c patch 9.1.1258: regexp: max \U and \%U value is limited by INT_MAX 2025-03-29 09:08:58 +01:00
regexp.h patch 9.1.0011: regexp cannot match combining chars in collection 2024-01-04 22:54:08 +01:00
regexp_bt.c patch 9.1.1258: regexp: max \U and \%U value is limited by INT_MAX 2025-03-29 09:08:58 +01:00
regexp_nfa.c patch 9.1.1258: regexp: max \U and \%U value is limited by INT_MAX 2025-03-29 09:08:58 +01:00
register.c patch 9.1.1322: small delete register cannot paste multi-line correctly 2025-04-18 18:32:52 +02:00
screen.c patch 9.1.1296: completion: incorrect truncation logic 2025-04-12 18:39:16 +02:00
scriptfile.c patch 9.1.0984: exception handling can be improved 2025-01-02 18:06:00 +01:00
search.c patch 9.1.1315: completion: issue with fuzzy completion and 'completefuzzycollect' 2025-04-17 20:17:53 +02:00
session.c patch 9.1.1334: Coverity complains about unchecked return value 2025-04-22 20:05:46 +02:00
sha256.c
sign.c patch 9.1.0887: Wrong expression in sign.c 2024-11-25 09:59:20 +01:00
sound.c patch 9.1.0879: source is not consistently formatted 2024-11-19 22:55:13 +01:00
spell.c patch 9.1.1178: not possible to generate completion candidates using fuzzy matching 2025-03-06 21:59:13 +01:00
spell.h
spellfile.c patch 9.1.0608: Coverity warns about a few potential issues 2024-07-20 13:26:44 +02:00
spellsuggest.c patch 9.1.0418: Cannot move to previous/next rare word 2024-05-17 18:52:45 +02:00
strings.c patch 9.1.1314: max allowed string width too small 2025-04-17 20:13:05 +02:00
structs.h patch 9.1.1341: cannot define completion triggers 2025-04-24 21:48:35 +02:00
syntax.c patch 9.1.1138: cmdline completion for :hi is too simplistic 2025-02-23 09:34:50 +01:00
tag.c patch 9.1.1326: invalid cursor position after 'tagfunc' 2025-04-20 19:35:49 +02:00
tearoff.bmp
term.c patch 9.1.1319: Various typos in the code, issue with test_inst_complete.vim 2025-04-18 10:57:33 +02:00
termdefs.h patch 9.1.0321: Garbled output on serial terminals with XON/XOFF flow control 2024-04-14 20:02:50 +02:00
terminal.c patch 9.1.1339: missing out-of-memory checks for enc_to_utf16()/utf16_to_enc() 2025-04-23 20:56:08 +02:00
termlib.c
testing.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
textformat.c patch 9.1.1137: ins_str() is inefficient by calling STRLEN() 2025-02-23 09:09:59 +01:00
textobject.c patch 9.1.1175: inconsistent behaviour with exclusive selection and motion commands 2025-03-05 20:47:29 +01:00
textprop.c patch 9.1.0722: crash with large id in text_prop interface 2024-09-08 20:05:23 +02:00
time.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
toolbar.phi
toolcheck
tools.bmp
tuple.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
typemap
typval.c patch 9.1.1333: Coverity: complains about unutilized variable 2025-04-22 20:01:04 +02:00
ui.c patch 9.0.2069: possible to escape bracketed paste mode with Ctrl-C 2023-10-26 22:08:41 +02:00
undo.c patch 9.1.0957: MS-Windows: conversion warnings 2024-12-24 09:50:01 +01:00
uninstall.c patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
usercmd.c patch 9.1.1340: cannot complete :filetype arguments 2025-04-23 21:12:26 +02:00
userfunc.c patch 9.1.1298: define_function() is too long 2025-04-13 17:49:50 +02:00
version.c patch 9.1.1345: tests: Test_xxd_color2() test failure dump diff is misleading 2025-04-25 19:06:53 +02:00
version.h patch 9.1.0368: MS-Windows: Hard to define the Vim Patchlevel with leading zeroes 2024-04-23 20:33:38 +02:00
vim.h patch 9.1.1340: cannot complete :filetype arguments 2025-04-23 21:12:26 +02:00
vim.ico
vim.manifest patch 9.1.0000: Vim 9.1 release 2024-01-02 16:51:11 +01:00
vim.rc
vim.tlb
vim9.h patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
vim9class.c patch 9.1.1274: Vim9: no support for object<type> as variable type 2025-04-03 21:32:00 +02:00
vim9cmds.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
vim9compile.c patch 9.1.1267: Vim9: no support for type list/dict<object<any>> 2025-04-01 20:43:36 +02:00
vim9execute.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
vim9expr.c patch 9.1.1332: Vim9: segfault when using super within a lambda 2025-04-22 19:55:38 +02:00
vim9instr.c patch 9.1.1267: Vim9: no support for type list/dict<object<any>> 2025-04-01 20:43:36 +02:00
vim9script.c patch 9.1.1279: Vim9: null_object and null_class are no reserved names 2025-04-05 16:03:27 +02:00
vim9type.c patch 9.1.1279: Vim9: null_object and null_class are no reserved names 2025-04-05 16:03:27 +02:00
vim_alert.ico
vim_error.ico
vim_icon.xbm
vim_info.ico
vim_mask.xbm
vim_quest.ico
viminfo.c patch 9.1.1232: Vim script is missing the tuple data type 2025-03-23 16:42:16 +01:00
vimrun.c
vimtutor patch 9.1.0901: MS-Windows: vimtutor batch script can be improved 2024-12-02 20:07:58 +01:00
which.sh
winclip.c
window.c patch 9.1.1330: may receive E315 in terminal 2025-04-21 11:23:12 +02:00
xpm_w32.c
xpm_w32.h

Vim Logo

Vim source code

Here are a few hints for finding your way around the source code. This doesn't make it less complex than it is, but it gets you started.

You might also want to read :help development.

Jumping around

First of all, use :make tags to generate a tags file, so that you can jump around in the source code.

To jump to a function or variable definition, move the cursor on the name and use the CTRL-] command. Use CTRL-T or CTRL-O to jump back.

To jump to a file, move the cursor on its name and use the gf command.

Most code can be found in a file with an obvious name (incomplete list):

File name Description
alloc.c memory management
arglist.c handling argument list
autocmd.c autocommands
blob.c blob data type
buffer.c manipulating buffers (loaded files)
bufwrite.c writing a buffer to file
change.c handling changes to text
cindent.c C and Lisp indentation
clientserver.c client server functionality
clipboard.c handling the clipboard
cmdexpand.c command-line completion
cmdhist.c command-line history
debugger.c vim script debugger
diff.c diff mode (vimdiff)
drawline.c drawing a window line
drawscreen.c drawing the windows
eval.c expression evaluation
evalbuffer.c buffer related built-in functions
evalfunc.c built-in functions
evalvars.c vim variables
evalwindow.c window related built-in functions
fileio.c reading and writing files
filepath.c dealing with file names and paths
findfile.c search for files in 'path'
fold.c folding
getchar.c getting characters and key mapping
gc.c garbage collection
help.c vim help related functions
highlight.c syntax highlighting
indent.c text indentation
insexpand.c Insert mode completion
locale.c locale/language handling
map.c mapping and abbreviations
mark.c marks
match.c highlight matching
float.c floating point functions
mbyte.c multi-byte character handling
memfile.c storing lines for buffers in a swapfile
memline.c storing lines for buffers in memory
menu.c menus
message.c (error) messages
mouse.c handling the mouse
ops.c handling operators ("d", "y", "p")
option.c options
optionstr.c handling string options
popupmenu.c popup menu
popupwin.c popup window
profiler.c vim script profiler
quickfix.c quickfix commands (":make", ":cn")
regexp.c pattern matching
register.c handling registers
scriptfile.c runtime directory handling and sourcing scripts
screen.c lower level screen functions
search.c pattern searching
session.c sessions and views
sign.c signs
spell.c spell checking core
spellfile.c spell file handling
spellsuggest.c spell correction suggestions
strings.c string manipulation functions
syntax.c syntax and other highlighting
tag.c tags
term.c terminal handling, termcap codes
testing.c testing: assert and test functions
textformat.c text formatting
textobject.c text objects
textprop.c text properties
time.c time and timer functions
typval.c vim script type/value functions
undo.c undo and redo
usercmd.c user defined commands
userfunc.c user defined functions
viminfo.c viminfo handling
window.c handling split windows

Debugging

If you have a reasonable recent version of gdb, you can use the :Termdebug command to debug Vim. See :help :Termdebug.

When something is time critical or stepping through code is a hassle, use the channel logging to create a time-stamped log file. Add lines to the code like this:

ch_log(NULL, "Value is now %02x", value);

After compiling and starting Vim, do:

:call ch_logfile('debuglog', 'w')

And edit debuglog to see what happens. The channel functions already have ch_log() calls, thus you always see that in the log.

Important Variables

The current mode is stored in State. The values it can have are NORMAL, INSERT, CMDLINE, and a few others.

The current window is curwin. The current buffer is curbuf. These point to structures with the cursor position in the window, option values, the file name, etc. These are defined in structs.h.

All the global variables are declared in globals.h.

The main loop

This is conveniently called main_loop(). It updates a few things and then calls normal_cmd() to process a command. This returns when the command is finished.

The basic idea is that Vim waits for the user to type a character and processes it until another character is needed. Thus there are several places where Vim waits for a character to be typed. The vgetc() function is used for this. It also handles mapping.

Updating the screen is mostly postponed until a command or a sequence of commands has finished. The work is done by update_screen(), which calls win_update() for every window, which calls win_line() for every line. See the start of screen.c for more explanations.

Command-line mode

When typing a :, normal_cmd() will call getcmdline() to obtain a line with an Ex command. getcmdline() contains a loop that will handle each typed character. It returns when hitting CR or Esc or some other character that ends the command line mode.

Ex commands

Ex commands are handled by the function do_cmdline(). It does the generic parsing of the : command line and calls do_one_cmd() for each separate command. It also takes care of while loops.

do_one_cmd() parses the range and generic arguments and puts them in the exarg_t and passes it to the function that handles the command.

The : commands are listed in ex_cmds.h. The third entry of each item is the name of the function that handles the command. The last entry are the flags that are used for the command.

Normal mode commands

The Normal mode commands are handled by the normal_cmd() function. It also handles the optional count and an extra character for some commands. These are passed in a cmdarg_t to the function that handles the command.

There is a table nv_cmds in normal.c which lists the first character of every command. The second entry of each item is the name of the function that handles the command.

Insert mode commands

When doing an i or a command, normal_cmd() will call the edit() function. It contains a loop that waits for the next character and handles it. It returns when leaving Insert mode.

Options

There is a list with all option names in option.c, called options[].

The GUI

Most of the GUI code is implemented like it was a clever terminal. Typing a character, moving a scrollbar, clicking the mouse, etc. are all translated into events which are written in the input buffer. These are read by the main code, just like reading from a terminal. The code for this is scattered through gui.c. For example, gui_send_mouse_event() for a mouse click and gui_menu_cb() for a menu action. Key hits are handled by the system-specific GUI code, which calls add_to_input_buf() to send the key code.

Updating the GUI window is done by writing codes in the output buffer, just like writing to a terminal. When the buffer gets full or is flushed, gui_write() will parse the codes and draw the appropriate items. Finally the system-specific GUI code will be called to do the work.

Debugging the GUI

Remember to prevent that gvim forks and the debugger thinks Vim has exited, add the -f argument. In gdb: run -f -g.

When stepping through display updating code, the focus event is triggered when going from the debugger to Vim and back. To avoid this, recompile with some code in gui_focus_change() disabled.

Contributing

If you would like to help making Vim better, see the CONTRIBUTING.md file.

This is README.md for version 9.1 of the Vim source code.