Patch 8.2.3700

14 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 29, 2021, 4:13:26 PM11/29/21
to vim...@googlegroups.com

Patch 8.2.3700
Problem: Text property highlighting continues over breakindent.
Solution: Stop before the end column. (closes #9242)
Files: src/drawline.c, src/testdir/test_textprop.vim,
src/testdir/dumps/Test_prop_linebreak.dump


*** ../vim-8.2.3699/src/drawline.c 2021-11-29 19:18:33.910686983 +0000
--- src/drawline.c 2021-11-29 21:11:19.168177835 +0000
***************
*** 265,270 ****
--- 265,273 ----
int c_extra = NUL; // extra chars, all the same
int c_final = NUL; // final char, mandatory if set
int extra_attr = 0; // attributes when n_extra != 0
+ #ifdef FEAT_LINEBREAK
+ int in_linebreak = FALSE; // n_extra set for showing linebreak
+ #endif
static char_u *at_end_str = (char_u *)""; // used for p_extra when
// displaying eol at end-of-line
int lcs_eol_one = wp->w_lcs_chars.eol; // eol until it's been used
***************
*** 1419,1425 ****
int pi;
int bcol = (int)(ptr - line);

! if (n_extra > 0)
--bcol; // still working on the previous char, e.g. Tab

// Check if any active property ends.
--- 1422,1432 ----
int pi;
int bcol = (int)(ptr - line);

! if (n_extra > 0
! # ifdef FEAT_LINEBREAK
! && !in_linebreak
! # endif
! )
--bcol; // still working on the previous char, e.g. Tab

// Check if any active property ends.
***************
*** 1437,1442 ****
--- 1444,1454 ----
* (text_props_active - (pi + 1)));
--text_props_active;
--pi;
+ # ifdef FEAT_LINEBREAK
+ // not exactly right but should work in most cases
+ if (in_linebreak && syntax_attr == text_prop_attr)
+ syntax_attr = 0;
+ # endif
}
}

***************
*** 1705,1710 ****
--- 1717,1726 ----
++p_extra;
}
--n_extra;
+ #ifdef FEAT_LINEBREAK
+ if (n_extra <= 0)
+ in_linebreak = FALSE;
+ #endif
}
else
{
***************
*** 2030,2035 ****
--- 2046,2053 ----

c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' ';
c_final = NUL;
+ if (n_extra > 0)
+ in_linebreak = TRUE;
if (VIM_ISWHITE(c))
{
# ifdef FEAT_CONCEAL
*** ../vim-8.2.3699/src/testdir/test_textprop.vim 2021-11-23 11:46:12.409848336 +0000
--- src/testdir/test_textprop.vim 2021-11-29 21:08:51.032354252 +0000
***************
*** 1615,1620 ****
--- 1615,1638 ----
bwipe!
enddef

+ func Test_prop_in_linebreak()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set breakindent linebreak breakat+=]
+ call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
+ call prop_type_add('test', #{highlight: 'ErrorMsg'})
+ call prop_add(1, 51, #{length: 1, type: 'test'})
+ END
+ call writefile(lines, 'XscriptPropLinebreak')
+ let buf = RunVimInTerminal('-S XscriptPropLinebreak', #{rows: 10})
+ call TermWait(buf)
+ call VerifyScreenDump(buf, 'Test_prop_linebreak', {})
+
+ call StopVimInTerminal(buf)
+ call delete('XscriptPropLinebreak')
+ endfunc
+
" Buffer number of 0 should be ignored, as if the parameter wasn't passed.
def Test_prop_bufnr_zero()
new
*** ../vim-8.2.3699/src/testdir/dumps/Test_prop_linebreak.dump 2021-11-29 21:12:10.812114279 +0000
--- src/testdir/dumps/Test_prop_linebreak.dump 2021-11-29 21:08:53.624351253 +0000
***************
*** 0 ****
--- 1,10 ----
+ >x+0&#ffffff0@49|]+0#ffffff16#e000002| +0#0000000#ffffff0@23
+ |x@69| @4
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ | +0#0000000&@56|1|,|1| @10|A|l@1|
*** ../vim-8.2.3699/src/version.c 2021-11-29 20:39:06.682101619 +0000
--- src/version.c 2021-11-29 20:47:37.889603145 +0000
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 3700,
/**/

--
./configure
Checking whether build environment is sane ...
build environment is grinning and holding a spatula. Guess not.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

John Marriott

unread,
Dec 1, 2021, 2:38:51 PM12/1/21
to vim...@googlegroups.com

On 30-Nov-2021 08:13, Bram Moolenaar wrote:
> Patch 8.2.3700
> Problem: Text property highlighting continues over breakindent.
> Solution: Stop before the end column. (closes #9242)
> Files: src/drawline.c, src/testdir/test_textprop.vim,
> src/testdir/dumps/Test_prop_linebreak.dump
>
>
After this patch, mingw64 (gcc 11.2.0) throws this warning if
FEAT_LINEBREAK is defined but FEAT_PROP_POPUP is not:
<snip>
gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD drawline.c -o
gobjnative/drawline.o
drawline.c: In function 'win_line':
drawline.c:269:17: warning: variable 'in_linebreak' set but not used
[-Wunused-but-set-variable]
  269 |     int         in_linebreak = FALSE;   // n_extra set for
showing linebreak
      |                 ^~~~~~~~~~~~
</snip>

After enabling FEAT_PROP_POPUP, the linker then throws this error if
FEAT_SPELL, FEAT_QUICKFIX or PROTO are not defined (see memline.c, line
#3361):
<snip>
gcc -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD -Wl,-nxcompat,-dynamicbase
-municode -s -mwindows -o gvim.exe gobjnative/alloc.o
gobjnative/arabic.o gobjnative/arglist.o gobjnative/autocmd.o
gobjnative/beval.o gobjnative/blob.o gobjnative/blowfish.o
gobjnative/buffer.o gobjnative/bufwrite.o gobjnative/change.o
gobjnative/charset.o gobjnative/cindent.o gobjnative/clientserver.o
gobjnative/clipboard.o gobjnative/cmdexpand.o gobjnative/cmdhist.o
gobjnative/crypt.o gobjnative/crypt_zip.o gobjnative/debugger.o
gobjnative/dict.o gobjnative/diff.o gobjnative/digraph.o
gobjnative/drawline.o gobjnative/drawscreen.o gobjnative/edit.o
gobjnative/eval.o gobjnative/evalbuffer.o gobjnative/evalfunc.o
gobjnative/evalvars.o gobjnative/evalwindow.o gobjnative/ex_cmds.o
gobjnative/ex_cmds2.o gobjnative/ex_docmd.o gobjnative/ex_eval.o
gobjnative/ex_getln.o gobjnative/fileio.o gobjnative/filepath.o
gobjnative/findfile.o gobjnative/float.o gobjnative/fold.o
gobjnative/getchar.o gobjnative/gui_xim.o gobjnative/hardcopy.o
gobjnative/hashtab.o gobjnative/help.o gobjnative/highlight.o
gobjnative/if_cscope.o gobjnative/indent.o gobjnative/insexpand.o
gobjnative/json.o gobjnative/list.o gobjnative/locale.o
gobjnative/main.o gobjnative/map.o gobjnative/mark.o gobjnative/match.o
gobjnative/memfile.o gobjnative/memline.o gobjnative/menu.o
gobjnative/message.o gobjnative/misc1.o gobjnative/misc2.o
gobjnative/mouse.o gobjnative/move.o gobjnative/mbyte.o
gobjnative/normal.o gobjnative/ops.o gobjnative/option.o
gobjnative/optionstr.o gobjnative/os_mswin.o gobjnative/os_win32.o
gobjnative/pathdef.o gobjnative/popupmenu.o gobjnative/popupwin.o
gobjnative/profiler.o gobjnative/quickfix.o gobjnative/regexp.o
gobjnative/register.o gobjnative/scriptfile.o gobjnative/screen.o
gobjnative/search.o gobjnative/session.o gobjnative/sha256.o
gobjnative/sign.o gobjnative/spell.o gobjnative/spellfile.o
gobjnative/spellsuggest.o gobjnative/strings.o gobjnative/syntax.o
gobjnative/tag.o gobjnative/term.o gobjnative/testing.o
gobjnative/textformat.o gobjnative/textobject.o gobjnative/textprop.o
gobjnative/time.o gobjnative/typval.o gobjnative/ui.o gobjnative/undo.o
gobjnative/usercmd.o gobjnative/userfunc.o gobjnative/version.o
gobjnative/vim9compile.o gobjnative/vim9execute.o
gobjnative/vim9script.o gobjnative/vim9type.o gobjnative/viminfo.o
gobjnative/winclip.o gobjnative/window.o gobjnative/os_w32exe.o
gobjnative/vimres.o gobjnative/xdiffi.o gobjnative/xemit.o
gobjnative/xprepare.o gobjnative/xutils.o gobjnative/xhistogram.o
gobjnative/xpatience.o gobjnative/gui.o gobjnative/gui_w32.o
gobjnative/gui_beval.o -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32
-lcomctl32 -lnetapi32 -lversion -lole32 -luuid

d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
gobjnative/popupwin.o:popupwin.c:(.text+0xd86): undefined reference to
`ml_append_buf'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
gobjnative/popupwin.o:popupwin.c:(.text+0xde5): undefined reference to
`ml_append_buf'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
gobjnative/popupwin.o:popupwin.c:(.text+0xe3a): undefined reference to
`ml_append_buf'
collect2.exe: error: ld returned 1 exit status
make: *** [Make_cyg_ming.mak:1089: gvim.exe] Error 1
</snip>

I don't have a patch for this issue.

However, I found that the in_linebreak variable is surrounded by a test
for FEAT_LINEBREAK everywhere inside function win_line() except for it's
usage at line #2050. The attached patch tries to fix that.

Cheers
John
drawline.c.8.2.3717.patch

Bram Moolenaar

unread,
Dec 2, 2021, 6:37:08 AM12/2/21
to vim...@googlegroups.com, John Marriott
[...]

That probably is the wrong way to add this define. Not all combinations
are valid.

I'll adjust the #ifdefs, that should fix the first problem.

--
Any resemblance between the above views and those of my employer, my terminal,
or the view out my window are purely coincidental. Any resemblance between
the above and my own views is non-deterministic. The question of the
existence of views in the absence of anyone to hold them is left as an
exercise for the reader. The question of the existence of the reader is left
as an exercise for the second god coefficient. (A discussion of
non-orthogonal, non-integral polytheism is beyond the scope of this article.)
(Ralph Jennings)
Reply all
Reply to author
Forward
0 new messages