To: vim_dev@googlegroups.com Subject: Patch 8.1.1444 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1444 Problem: Not using double line characters for popup border. Solution: Use double line characters if using utf-8. Files: src/screen.c, src/testdir/test_popupwin.vim, src/testdir/dumps/Test_popupwin_21.dump, *** ../vim-8.1.1443/src/screen.c 2019-06-01 20:16:33.717894147 +0200 --- src/screen.c 2019-06-01 20:32:41.547148400 +0200 *************** *** 1031,1036 **** --- 1031,1042 ---- int total_height; int popup_attr; int row; + int tl_corner_char = '+'; + char *tr_corner_str = "+"; + int bl_corner_char = '+'; + char *br_corner_str = "+"; + int hor_line_char = '-'; + char *ver_line_str = "|"; // Find the window with the lowest zindex that hasn't been updated yet, // so that the window with a higher zindex is drawn later, thus goes on *************** *** 1062,1077 **** + wp->w_height + wp->w_popup_padding[2] + wp->w_popup_border[2]; popup_attr = get_wcr_attr(wp); if (wp->w_popup_border[0] > 0) { // top border screen_fill(wp->w_winrow, wp->w_winrow + 1, wp->w_wincol, wp->w_wincol + total_width, ! wp->w_popup_border[3] != 0 ? '+' : '-', ! '-', popup_attr); if (wp->w_popup_border[1] > 0) ! screen_puts((char_u *)"+", wp->w_winrow, wp->w_wincol + total_width - 1, popup_attr); } --- 1068,1094 ---- + wp->w_height + wp->w_popup_padding[2] + wp->w_popup_border[2]; popup_attr = get_wcr_attr(wp); + if (enc_utf8) + { + tl_corner_char = 0x2554; + tr_corner_str = "\xe2\x95\x97"; + bl_corner_char = 0x255a; + br_corner_str = "\xe2\x95\x9d"; + hor_line_char = 0x2550; + ver_line_str = "\xe2\x95\x91"; + } + if (wp->w_popup_border[0] > 0) { // top border screen_fill(wp->w_winrow, wp->w_winrow + 1, wp->w_wincol, wp->w_wincol + total_width, ! wp->w_popup_border[3] != 0 ! ? tl_corner_char : hor_line_char, ! hor_line_char, popup_attr); if (wp->w_popup_border[1] > 0) ! screen_puts((char_u *)tr_corner_str, wp->w_winrow, wp->w_wincol + total_width - 1, popup_attr); } *************** *** 1091,1104 **** { // left border if (wp->w_popup_border[3] > 0) ! screen_puts((char_u *)"|", row, wp->w_wincol, popup_attr); // left padding if (wp->w_popup_padding[3] > 0) screen_puts(get_spaces(wp->w_popup_padding[3]), row, wp->w_wincol + wp->w_popup_border[3], popup_attr); // right border if (wp->w_popup_border[1] > 0) ! screen_puts((char_u *)"|", row, wp->w_wincol + total_width - 1, popup_attr); // right padding if (wp->w_popup_padding[1] > 0) --- 1108,1121 ---- { // left border if (wp->w_popup_border[3] > 0) ! screen_puts((char_u *)ver_line_str, row, wp->w_wincol, popup_attr); // left padding if (wp->w_popup_padding[3] > 0) screen_puts(get_spaces(wp->w_popup_padding[3]), row, wp->w_wincol + wp->w_popup_border[3], popup_attr); // right border if (wp->w_popup_border[1] > 0) ! screen_puts((char_u *)ver_line_str, row, wp->w_wincol + total_width - 1, popup_attr); // right padding if (wp->w_popup_padding[1] > 0) *************** *** 1125,1134 **** screen_fill(row , row + 1, wp->w_wincol, wp->w_wincol + total_width, ! wp->w_popup_border[3] != 0 ? '+' : '-', ! '-', popup_attr); if (wp->w_popup_border[1] > 0) ! screen_puts((char_u *)"+", row, wp->w_wincol + total_width - 1, popup_attr); } } --- 1142,1151 ---- screen_fill(row , row + 1, wp->w_wincol, wp->w_wincol + total_width, ! wp->w_popup_border[3] != 0 ? bl_corner_char : hor_line_char, ! hor_line_char, popup_attr); if (wp->w_popup_border[1] > 0) ! screen_puts((char_u *)br_corner_str, row, wp->w_wincol + total_width - 1, popup_attr); } } *** ../vim-8.1.1443/src/testdir/test_popupwin.vim 2019-06-01 20:16:33.717894147 +0200 --- src/testdir/test_popupwin.vim 2019-06-01 20:38:07.241320699 +0200 *************** *** 60,79 **** if !CanRunVimInTerminal() return endif - call writefile([ - \ "call setline(1, range(1, 100))", - \ "call popup_create('hello border', {'line': 2, 'col': 3, 'border': []})", - \ "call popup_create('hello padding', {'line': 2, 'col': 23, 'padding': []})", - \ "call popup_create('hello both', {'line': 2, 'col': 43, 'border': [], 'padding': []})", - \ "call popup_create('border TL', {'line': 6, 'col': 3, 'border': [1, 0, 0, 4]})", - \ "call popup_create('paddings', {'line': 6, 'col': 23, 'padding': [1, 3, 2, 4]})", - \], 'XtestPopupBorder') - let buf = RunVimInTerminal('-S XtestPopupBorder', {'rows': 15}) - call VerifyScreenDump(buf, 'Test_popupwin_20', {}) ! " clean up ! call StopVimInTerminal(buf) ! call delete('XtestPopupBorder') let with_border_or_padding = { \ 'line': 2, --- 60,81 ---- if !CanRunVimInTerminal() return endif ! for iter in range(0, 1) ! call writefile([iter == 1 ? '' : 'set enc=latin1', ! \ "call setline(1, range(1, 100))", ! \ "call popup_create('hello border', {'line': 2, 'col': 3, 'border': []})", ! \ "call popup_create('hello padding', {'line': 2, 'col': 23, 'padding': []})", ! \ "call popup_create('hello both', {'line': 2, 'col': 43, 'border': [], 'padding': []})", ! \ "call popup_create('border TL', {'line': 6, 'col': 3, 'border': [1, 0, 0, 4]})", ! \ "call popup_create('paddings', {'line': 6, 'col': 23, 'padding': [1, 3, 2, 4]})", ! \], 'XtestPopupBorder') ! let buf = RunVimInTerminal('-S XtestPopupBorder', {'rows': 15}) ! call VerifyScreenDump(buf, 'Test_popupwin_2' .. iter, {}) ! ! call StopVimInTerminal(buf) ! call delete('XtestPopupBorder') ! endfor let with_border_or_padding = { \ 'line': 2, *** ../vim-8.1.1443/src/testdir/dumps/Test_popupwin_21.dump 2019-06-01 20:44:42.182843427 +0200 --- src/testdir/dumps/Test_popupwin_21.dump 2019-06-01 20:38:17.157261244 +0200 *************** *** 0 **** --- 1,15 ---- + >1+0&#ffffff0| @73 + |2| |╔+0#0000001#ffd7ff255|═@11|╗| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|╔+0#0000001#ffd7ff255|═@11|╗| +0#0000000#ffffff0@18 + |3| |║+0#0000001#ffd7ff255|h|e|l@1|o| |b|o|r|d|e|r|║| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255|h|e|l@1|o| |p|a|d@1|i|n|g| | +0#0000000#ffffff0@4|║+0#0000001#ffd7ff255| @11|║| +0#0000000#ffffff0@18 + |4| |╚+0#0000001#ffd7ff255|═@11|╝| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|║+0#0000001#ffd7ff255| |h|e|l@1|o| |b|o|t|h| |║| +0#0000000#ffffff0@18 + |5| @40|║+0#0000001#ffd7ff255| @11|║| +0#0000000#ffffff0@18 + |6| |╔+0#0000001#ffd7ff255|═@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|╚+0#0000001#ffd7ff255|═@11|╝| +0#0000000#ffffff0@18 + |7| |║+0#0000001#ffd7ff255|b|o|r|d|e|r| |T|L| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@3|p|a|d@1|i|n|g|s| @2| +0#0000000#ffffff0@37 + |8| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@37 + |9| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@37 + |1|0| @72 + |1@1| @72 + |1|2| @72 + |1|3| @72 + |1|4| @72 + @57|1|,|1| @10|T|o|p| *** ../vim-8.1.1443/src/version.c 2019-06-01 20:16:33.717894147 +0200 --- src/version.c 2019-06-01 20:44:49.266797382 +0200 *************** *** 769,770 **** --- 769,772 ---- { /* Add new patch number below this line */ + /**/ + 1444, /**/ -- hundred-and-one symptoms of being an internet addict: 80. At parties, you introduce your spouse as your "service provider." /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///