patch 8.2.1963: crash when using a popup window with "latin1" encoding
Problem: Crash when using a popup window with "latin1" encoding.
Solution: Don't use ScreenLinesUC when enc_utf8 is false. (closes #7241)
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 435873e..43dbeb5 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -3685,6 +3685,28 @@
call delete('XtestPopupThreeErrors')
endfunc
+func Test_popupwin_latin1_encoding()
+ CheckScreendump
+ CheckUnix
+
+ " When 'encoding' is a single-byte encoding a terminal window will mess up
+ " the display. Check that showing a popup on top of that doesn't crash.
+ let lines =<< trim END
+ set encoding=latin1
+ terminal cat Xmultibyte
+ call popup_create(['one', 'two', 'three', 'four'], #{line: 1, col: 10})
+ END
+ call writefile(lines, 'XtestPopupLatin')
+ call writefile([repeat("\u3042 ", 120)], 'Xmultibyte')
+
+ let buf = RunVimInTerminal('-S XtestPopupLatin', #{rows: 10})
+
+ call term_sendkeys(buf, ":q\<CR>")
+ call StopVimInTerminal(buf)
+ call delete('XtestPopupLatin')
+ call delete('Xmultibyte')
+endfunc
+
func Test_popupwin_atcursor_far_right()
new