runtime(syntax-tests): Allow for folded and wrapped lines in syntax test files
The current implementation falls short for syntax test files
on two accounts:
1. With folded lines -- some lines before folded lines are
unnecessarily repeated in generated dump files because
closed folded lines are always treated as opened for the
cursor to move _in_ instead of to move _over_ them.
2. With wrapped lines (longer than 75 columns) -- some lines
are omitted in generated dump files because calculations
for the cursor progress and its movement commands only
refer to file lines and not their layout within a 20x75
buffer (less &cmdheight).
As an alternative, we abandon deterministic (and inaccurate
at times) calculations for the cursor progress and, instead,
advance the cursor by as much as before for a single dump
file, but now rely on marking the last visible line and
additional movement to position lines at desired offsets,
carefully preserving compatibility for the &scrolloff and
&ruler values inherited from defaults.vim. The parent Vim
process will keep track of progress through a syntax test
file made by its child process ("terminal") by reading the
rightmost end of the ruler line from the terminal buffer,
looking for " All " or " Bot " for its cue to finish dump
file generation.
With these changes applied, the lossless line length limit
will be raised from 75 to 1425 (for a 19x75 view) columns.
Also, prefer "lastline" to "truncate" for &display; hiding
the content of any last _long_ line in a view goes against
the purpose of syntax file testing -- all lines should be
recorded.
related: #15150
fixes: #14245
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/testdir/README.txt b/runtime/syntax/testdir/README.txt
index 9c12648..d0f292e 100644
--- a/runtime/syntax/testdir/README.txt
+++ b/runtime/syntax/testdir/README.txt
@@ -27,12 +27,12 @@
Create a source file in the language you want to test in the "input"
directory. Use the filetype name as the base and a file name extension
-matching the filetype. Let's use Java as an example. The file would then be
+matching the filetype. Let's use Java as an example. The file would then be
"input/java.java".
Make sure to include some interesting constructs with plenty of complicated
highlighting. Optionally, pre-configure the testing environment by including
-setup commands at the top of the input file. The format for these lines is:
+setup commands at the top of the input file. The format for these lines is:
VIM_TEST_SETUP {command}
@@ -61,6 +61,8 @@
Both inline setup commands and setup scripts may be used at the same time, the
script file will be sourced before any VIM_TEST_SETUP commands are executed.
+Every line of a source file must not be longer than 1425 (19 x 75) characters.
+
If there is no further setup required, you can now run the tests:
make test