mirror of
https://github.com/vim/vim.git
synced 2025-10-01 04:54:07 -04:00
patch 8.1.1819: :pedit does not work with a popup preview window
Problem: :pedit does not work with a popup preview window. Solution: Avoid aborting with an error. (fixes #4777) Also double check that after prepare_tagpreview() the current window is not a popup window.
This commit is contained in:
@@ -7083,7 +7083,7 @@ do_exedit(
|
|||||||
int need_hide;
|
int need_hide;
|
||||||
int exmode_was = exmode_active;
|
int exmode_was = exmode_active;
|
||||||
|
|
||||||
if (ERROR_IF_POPUP_WINDOW)
|
if (eap->cmdidx != CMD_pedit && ERROR_IF_POPUP_WINDOW)
|
||||||
return;
|
return;
|
||||||
/*
|
/*
|
||||||
* ":vi" command ends Ex mode.
|
* ":vi" command ends Ex mode.
|
||||||
@@ -8798,9 +8798,11 @@ ex_pedit(exarg_T *eap)
|
|||||||
|
|
||||||
g_do_tagpreview = p_pvh;
|
g_do_tagpreview = p_pvh;
|
||||||
prepare_tagpreview(TRUE);
|
prepare_tagpreview(TRUE);
|
||||||
|
|
||||||
keep_help_flag = bt_help(curwin_save->w_buffer);
|
keep_help_flag = bt_help(curwin_save->w_buffer);
|
||||||
do_exedit(eap, NULL);
|
do_exedit(eap, NULL);
|
||||||
keep_help_flag = FALSE;
|
keep_help_flag = FALSE;
|
||||||
|
|
||||||
if (curwin != curwin_save && win_valid(curwin_save))
|
if (curwin != curwin_save && win_valid(curwin_save))
|
||||||
{
|
{
|
||||||
/* Return cursor to where we were */
|
/* Return cursor to where we were */
|
||||||
@@ -8808,6 +8810,13 @@ ex_pedit(exarg_T *eap)
|
|||||||
redraw_later(VALID);
|
redraw_later(VALID);
|
||||||
win_enter(curwin_save, TRUE);
|
win_enter(curwin_save, TRUE);
|
||||||
}
|
}
|
||||||
|
# ifdef FEAT_TEXT_PROP
|
||||||
|
else if (WIN_IS_POPUP(curwin))
|
||||||
|
{
|
||||||
|
// can't keep focus in popup window
|
||||||
|
win_enter(firstwin, TRUE);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
g_do_tagpreview = 0;
|
g_do_tagpreview = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -5632,6 +5632,11 @@ search_line:
|
|||||||
redraw_later(VALID);
|
redraw_later(VALID);
|
||||||
win_enter(curwin_save, TRUE);
|
win_enter(curwin_save, TRUE);
|
||||||
}
|
}
|
||||||
|
# ifdef FEAT_TEXT_PROP
|
||||||
|
else if (WIN_IS_POPUP(curwin))
|
||||||
|
// can't keep focus in popup window
|
||||||
|
win_enter(firstwin, TRUE);
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -3693,6 +3693,11 @@ jumpto_tag(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#if defined(FEAT_QUICKFIX) && defined(FEAT_TEXT_PROP)
|
||||||
|
if (WIN_IS_POPUP(curwin))
|
||||||
|
// something went wrong, still in popup, but it can't have focus
|
||||||
|
win_enter(firstwin, TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
erret:
|
erret:
|
||||||
#if defined(FEAT_QUICKFIX)
|
#if defined(FEAT_QUICKFIX)
|
||||||
|
14
src/testdir/dumps/Test_popupwin_previewpopup_6.dump
Normal file
14
src/testdir/dumps/Test_popupwin_previewpopup_6.dump
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|o+0&#ffffff0|n|e| @71
|
||||||
|
|#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54
|
||||||
|
|t|h|r|e@1| @69
|
||||||
|
|f|o|u|r| @70
|
||||||
|
|f|i|v|e| @70
|
||||||
|
|s|i|x| @71
|
||||||
|
|s|e|v|e|n| @69
|
||||||
|
|f|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @52
|
||||||
|
|n|i|n|e| @70
|
||||||
|
|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @54
|
||||||
|
|v|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|:+0#0000000&|p|c|l|o|s|e| @49|1@1|,|3|9| @8|A|l@1|
|
14
src/testdir/dumps/Test_popupwin_previewpopup_7.dump
Normal file
14
src/testdir/dumps/Test_popupwin_previewpopup_7.dump
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|o+0&#ffffff0|n|e| @71
|
||||||
|
|#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54
|
||||||
|
|t|h|r|e@1| @69
|
||||||
|
|f|o|u|r| @70
|
||||||
|
|f|i|v|e| @27|╔+0#0000001#ffd7ff255| |X|t|a|g|f|i|l|e| |═@30|X
|
||||||
|
|s+0#0000000#ffffff0|i|x| @28|║+0#0000001#ffd7ff255|2|0| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
|
||||||
|
|s+0#0000000#ffffff0|e|v|e|n| @26|║+0#0000001#ffd7ff255|t|h|e|w|o|r|d| |i|s| |h|e|r|e| @24| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
|
||||||
|
|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @9|║+0#0000001#ffd7ff255|2@1| @37| +0#0000000#0000001|║+0#0000001#ffd7ff255
|
||||||
|
|n+0#0000000#ffffff0|i|n|e| @27|║+0#0000001#ffd7ff255|2|3| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
|
||||||
|
|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @11|╚+0#0000001#ffd7ff255|═@40|⇲
|
||||||
|
|v+0#0000000#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|:+0#0000000&| @55|1@1|,|3|9| @8|A|l@1|
|
14
src/testdir/dumps/Test_popupwin_previewpopup_8.dump
Normal file
14
src/testdir/dumps/Test_popupwin_previewpopup_8.dump
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|o+0&#ffffff0|n|e| @71
|
||||||
|
|#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54
|
||||||
|
|t|h|r|e@1| @69
|
||||||
|
|f|o|u|r| @70
|
||||||
|
|f|i|v|e| @27|╔+0#0000001#ffd7ff255| |X|h|e|a|d|e|r|.|h| |═@29|X
|
||||||
|
|s+0#0000000#ffffff0|i|x| @28|║+0#0000001#ffd7ff255|1+0#e000002&|0| +0#0000001&@37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
|
||||||
|
|s+0#0000000#ffffff0|e|v|e|n| @26|║+0#0000001#ffd7ff255|s|e|a|r|c|h|e|d| |w|o|r|d| |i|s| |h|e|r|e| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
|
||||||
|
|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @9|║+0#0000001#ffd7ff255|1+0#e000002&|2| +0#0000001&@37| +0#0000000#0000001|║+0#0000001#ffd7ff255
|
||||||
|
|n+0#0000000#ffffff0|i|n|e| @27|║+0#0000001#ffd7ff255|1+0#e000002&|3| +0#0000001&@37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
|
||||||
|
|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @11|╚+0#0000001#ffd7ff255|═@40|⇲
|
||||||
|
|v+0#0000000#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|:+0#0000000&| @55|1@1|,|3|9| @8|A|l@1|
|
@@ -2174,11 +2174,15 @@ func Test_previewpopup()
|
|||||||
\ + ['this is another place']
|
\ + ['this is another place']
|
||||||
\ + range(29, 40),
|
\ + range(29, 40),
|
||||||
\ "Xtagfile")
|
\ "Xtagfile")
|
||||||
|
call writefile(range(1,10)
|
||||||
|
\ + ['searched word is here']
|
||||||
|
\ + range(12, 20),
|
||||||
|
\ "Xheader.h")
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
set tags=Xtags
|
set tags=Xtags
|
||||||
call setline(1, [
|
call setline(1, [
|
||||||
\ 'one',
|
\ 'one',
|
||||||
\ 'two',
|
\ '#include "Xheader.h"',
|
||||||
\ 'three',
|
\ 'three',
|
||||||
\ 'four',
|
\ 'four',
|
||||||
\ 'five',
|
\ 'five',
|
||||||
@@ -2189,6 +2193,9 @@ func Test_previewpopup()
|
|||||||
\ 'this is another word',
|
\ 'this is another word',
|
||||||
\ 'very long line where the word is also another'])
|
\ 'very long line where the word is also another'])
|
||||||
set previewpopup=height:4,width:40
|
set previewpopup=height:4,width:40
|
||||||
|
set path=.
|
||||||
|
call ch_logfile('logfile', 'w')
|
||||||
|
call ch_log('logfile started')
|
||||||
END
|
END
|
||||||
call writefile(lines, 'XtestPreviewPopup')
|
call writefile(lines, 'XtestPreviewPopup')
|
||||||
let buf = RunVimInTerminal('-S XtestPreviewPopup', #{rows: 14})
|
let buf = RunVimInTerminal('-S XtestPreviewPopup', #{rows: 14})
|
||||||
@@ -2209,11 +2216,25 @@ func Test_previewpopup()
|
|||||||
|
|
||||||
call term_sendkeys(buf, ":cd ..\<CR>:\<CR>")
|
call term_sendkeys(buf, ":cd ..\<CR>:\<CR>")
|
||||||
call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_5', {})
|
call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_5', {})
|
||||||
|
call term_sendkeys(buf, ":cd testdir\<CR>")
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":pclose\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_6', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":pedit +/theword Xtagfile\<CR>")
|
||||||
|
call term_sendkeys(buf, ":\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_7', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":pclose\<CR>")
|
||||||
|
call term_sendkeys(buf, ":psearch searched\<CR>")
|
||||||
|
call term_sendkeys(buf, ":\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_8', {})
|
||||||
|
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('Xtags')
|
call delete('Xtags')
|
||||||
call delete('Xtagfile')
|
call delete('Xtagfile')
|
||||||
call delete('XtestPreviewPopup')
|
call delete('XtestPreviewPopup')
|
||||||
|
call delete('Xheader.h')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2
|
" vim: shiftwidth=2 sts=2
|
||||||
|
@@ -773,6 +773,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 */
|
||||||
|
/**/
|
||||||
|
1819,
|
||||||
/**/
|
/**/
|
||||||
1818,
|
1818,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user