mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.1426: no test for syntax highlight in popup window
Problem: No test for syntax highlight in popup window. Solution: Add a screenshot test. Update associated documentation. Avoid 'buftype' being reset by setbufvar().
This commit is contained in:
parent
89adc3a137
commit
b42301247d
@ -1,4 +1,4 @@
|
|||||||
*eval.txt* For Vim version 8.1. Last change: 2019 May 25
|
*eval.txt* For Vim version 8.1. Last change: 2019 May 30
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -2087,12 +2087,12 @@ v:t_blob Value of |Blob| type. Read-only. See: |type()|
|
|||||||
*v:termresponse* *termresponse-variable*
|
*v:termresponse* *termresponse-variable*
|
||||||
v:termresponse The escape sequence returned by the terminal for the |t_RV|
|
v:termresponse The escape sequence returned by the terminal for the |t_RV|
|
||||||
termcap entry. It is set when Vim receives an escape sequence
|
termcap entry. It is set when Vim receives an escape sequence
|
||||||
that starts with ESC [ or CSI and ends in a 'c', with only
|
that starts with ESC [ or CSI, then '>' or '?' and ends in a
|
||||||
digits, ';' and '.' in between.
|
'c', with only digits and ';' in between.
|
||||||
When this option is set, the TermResponse autocommand event is
|
When this option is set, the TermResponse autocommand event is
|
||||||
fired, so that you can react to the response from the
|
fired, so that you can react to the response from the
|
||||||
terminal.
|
terminal.
|
||||||
The response from a new xterm is: "<Esc>[ Pp ; Pv ; Pc c". Pp
|
The response from a new xterm is: "<Esc>[> Pp ; Pv ; Pc c". Pp
|
||||||
is the terminal type: 0 for vt100 and 1 for vt220. Pv is the
|
is the terminal type: 0 for vt100 and 1 for vt220. Pv is the
|
||||||
patch level (since this was introduced in patch 95, it's
|
patch level (since this was introduced in patch 95, it's
|
||||||
always 95 or bigger). Pc is always zero.
|
always 95 or bigger). Pc is always zero.
|
||||||
@ -8400,6 +8400,8 @@ setreg({regname}, {value} [, {options}])
|
|||||||
settabvar({tabnr}, {varname}, {val}) *settabvar()*
|
settabvar({tabnr}, {varname}, {val}) *settabvar()*
|
||||||
Set tab-local variable {varname} to {val} in tab page {tabnr}.
|
Set tab-local variable {varname} to {val} in tab page {tabnr}.
|
||||||
|t:var|
|
|t:var|
|
||||||
|
Note that autocommands are blocked, side effects may not be
|
||||||
|
triggered, e.g. when setting 'filetype'.
|
||||||
Note that the variable name without "t:" must be used.
|
Note that the variable name without "t:" must be used.
|
||||||
Tabs are numbered starting with one.
|
Tabs are numbered starting with one.
|
||||||
This function is not available in the |sandbox|.
|
This function is not available in the |sandbox|.
|
||||||
@ -8411,6 +8413,8 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
|
|||||||
use |setwinvar()|.
|
use |setwinvar()|.
|
||||||
{winnr} can be the window number or the |window-ID|.
|
{winnr} can be the window number or the |window-ID|.
|
||||||
When {winnr} is zero the current window is used.
|
When {winnr} is zero the current window is used.
|
||||||
|
Note that autocommands are blocked, side effects may not be
|
||||||
|
triggered, e.g. when setting 'filetype' or 'syntax'.
|
||||||
This also works for a global or local buffer option, but it
|
This also works for a global or local buffer option, but it
|
||||||
doesn't work for a global or local buffer variable.
|
doesn't work for a global or local buffer variable.
|
||||||
For a local buffer option the global value is unchanged.
|
For a local buffer option the global value is unchanged.
|
||||||
@ -10318,9 +10322,13 @@ wildmenumode() *wildmenumode()*
|
|||||||
win_execute({id}, {command} [, {silent}]) *win_execute()*
|
win_execute({id}, {command} [, {silent}]) *win_execute()*
|
||||||
Like `execute()` but in the context of window {id}.
|
Like `execute()` but in the context of window {id}.
|
||||||
The window will temporarily be made the current window,
|
The window will temporarily be made the current window,
|
||||||
without triggering autocommands.
|
without triggering autocommands. When executing {command}
|
||||||
|
autocommands will be triggered, this may have unexpected side
|
||||||
|
effects. Use |:noautocmd| if needed.
|
||||||
Example: >
|
Example: >
|
||||||
call win_execute(winid, 'syntax enable')
|
call win_execute(winid, 'set syntax=python')
|
||||||
|
< Doing the same with `setwinvar()` would not trigger
|
||||||
|
autocommands and not actually show syntax highlighting.
|
||||||
|
|
||||||
win_findbuf({bufnr}) *win_findbuf()*
|
win_findbuf({bufnr}) *win_findbuf()*
|
||||||
Returns a list with |window-ID|s for windows that contain
|
Returns a list with |window-ID|s for windows that contain
|
||||||
|
10
src/testdir/dumps/Test_popupwin_10.dump
Normal file
10
src/testdir/dumps/Test_popupwin_10.dump
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
>1+0&#ffffff0| @73
|
||||||
|
|2| @73
|
||||||
|
|3| @22|#+0#e000e06#5fd7ff255|i|n|c|l|u|d|e| |<+0#e000002&|s|t|d|i|o|.|h|>| +0#0000000#ffffff0@32
|
||||||
|
|4| @22|i+0#00e0003#5fd7ff255|n|t| +0#0000000&|m|a|i|n|(|v+0#00e0003&|o|i|d|)+0#0000000&| @3| +0&#ffffff0@32
|
||||||
|
|5| @22|{+0fd7ff255| @16| +0&#ffffff0@32
|
||||||
|
|6| @22| +0fd7ff255@3|p|r|i|n|t|f|(|1+0#e000002&|2|3|)+0#0000000&|;| @1| +0&#ffffff0@32
|
||||||
|
|7| @22|}+0fd7ff255| @16| +0&#ffffff0@32
|
||||||
|
|8| @73
|
||||||
|
|9| @73
|
||||||
|
@57|1|,|1| @10|T|o|p|
|
10
src/testdir/dumps/Test_popupwin_11.dump
Normal file
10
src/testdir/dumps/Test_popupwin_11.dump
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
>1+0&#ffffff0| @73
|
||||||
|
|2| @73
|
||||||
|
|3| @18|#+0#e000e06#e0e0e08|i|n|c|l|u|d|e| |<+0#e000002&|s|t|d|i|o|.|h|>| +0#0000000#ffffff0@36
|
||||||
|
|4| @18|i+0#00e0003#e0e0e08|n|t| +0#0000000&|m|a|i|n|(|v+0#00e0003&|o|i|d|)+0#0000000&| @3| +0&#ffffff0@36
|
||||||
|
|5| @18|{+0&#e0e0e08| @16| +0&#ffffff0@36
|
||||||
|
|6| @18| +0&#e0e0e08@3|p|r|i|n|t|f|(|5+0#e000002&|6|7|)+0#0000000&|;| @1| +0&#ffffff0@36
|
||||||
|
|7| @18|}+0&#e0e0e08| @16| +0&#ffffff0@36
|
||||||
|
|8| @73
|
||||||
|
|9| @73
|
||||||
|
@57|1|,|1| @10|T|o|p|
|
@ -56,6 +56,54 @@ func Test_simple_popup()
|
|||||||
call delete('XtestPopup')
|
call delete('XtestPopup')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_popup_with_syntax_win_execute()
|
||||||
|
if !CanRunVimInTerminal()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
call writefile([
|
||||||
|
\ "call setline(1, range(1, 100))",
|
||||||
|
\ "hi PopupColor ctermbg=lightblue",
|
||||||
|
\ "let winid = popup_create([",
|
||||||
|
\ "\\ '#include <stdio.h>',",
|
||||||
|
\ "\\ 'int main(void)',",
|
||||||
|
\ "\\ '{',",
|
||||||
|
\ "\\ ' printf(123);',",
|
||||||
|
\ "\\ '}',",
|
||||||
|
\ "\\], {'line': 3, 'col': 25, 'highlight': 'PopupColor'})",
|
||||||
|
\ "call win_execute(winid, 'set syntax=cpp')",
|
||||||
|
\], 'XtestPopup')
|
||||||
|
let buf = RunVimInTerminal('-S XtestPopup', {'rows': 10})
|
||||||
|
call VerifyScreenDump(buf, 'Test_popupwin_10', {})
|
||||||
|
|
||||||
|
" clean up
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XtestPopup')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_popup_with_syntax_setbufvar()
|
||||||
|
if !CanRunVimInTerminal()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
call writefile([
|
||||||
|
\ "call setline(1, range(1, 100))",
|
||||||
|
\ "hi PopupColor ctermbg=lightgrey",
|
||||||
|
\ "let winid = popup_create([",
|
||||||
|
\ "\\ '#include <stdio.h>',",
|
||||||
|
\ "\\ 'int main(void)',",
|
||||||
|
\ "\\ '{',",
|
||||||
|
\ "\\ ' printf(567);',",
|
||||||
|
\ "\\ '}',",
|
||||||
|
\ "\\], {'line': 3, 'col': 21, 'highlight': 'PopupColor'})",
|
||||||
|
\ "call setbufvar(winbufnr(winid), '&syntax', 'cpp')",
|
||||||
|
\], 'XtestPopup')
|
||||||
|
let buf = RunVimInTerminal('-S XtestPopup', {'rows': 10})
|
||||||
|
call VerifyScreenDump(buf, 'Test_popupwin_11', {})
|
||||||
|
|
||||||
|
" clean up
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XtestPopup')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_popup_time()
|
func Test_popup_time()
|
||||||
if !has('timers')
|
if !has('timers')
|
||||||
return
|
return
|
||||||
|
@ -767,6 +767,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1426,
|
||||||
/**/
|
/**/
|
||||||
1425,
|
1425,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user