@@ -1030,13 +1030,11 @@ update_popups(void)
10301030 int total_width ;
10311031 int total_height ;
10321032 int popup_attr ;
1033+ int border_attr [4 ];
1034+ int border_char [8 ] = {'-' , '|' , '-' , '|' , '+' , '+' , '+' , '+' , };
1035+ char_u buf [MB_MAXBYTES ];
10331036 int row ;
1034- int tl_corner_char = '+' ;
1035- char * tr_corner_str = "+" ;
1036- int bl_corner_char = '+' ;
1037- char * br_corner_str = "+" ;
1038- int hor_line_char = '-' ;
1039- char * ver_line_str = "|" ;
1037+ int i ;
10401038
10411039 // Find the window with the lowest zindex that hasn't been updated yet,
10421040 // so that the window with a higher zindex is drawn later, thus goes on
@@ -1070,12 +1068,22 @@ update_popups(void)
10701068
10711069 if (enc_utf8 )
10721070 {
1073- tl_corner_char = 0x2554 ;
1074- tr_corner_str = "\xe2\x95\x97" ;
1075- bl_corner_char = 0x255a ;
1076- br_corner_str = "\xe2\x95\x9d" ;
1077- hor_line_char = 0x2550 ;
1078- ver_line_str = "\xe2\x95\x91" ;
1071+ border_char [0 ] = border_char [2 ] = 0x2550 ;
1072+ border_char [1 ] = border_char [3 ] = 0x2551 ;
1073+ border_char [4 ] = 0x2554 ;
1074+ border_char [5 ] = 0x2557 ;
1075+ border_char [6 ] = 0x255d ;
1076+ border_char [7 ] = 0x255a ;
1077+ }
1078+ for (i = 0 ; i < 8 ; ++ i )
1079+ if (wp -> w_border_char [i ] != 0 )
1080+ border_char [i ] = wp -> w_border_char [i ];
1081+
1082+ for (i = 0 ; i < 4 ; ++ i )
1083+ {
1084+ border_attr [i ] = popup_attr ;
1085+ if (wp -> w_border_highlight [i ] != NULL )
1086+ border_attr [i ] = syn_name2attr (wp -> w_border_highlight [i ]);
10791087 }
10801088
10811089 if (wp -> w_popup_border [0 ] > 0 )
@@ -1085,11 +1093,14 @@ update_popups(void)
10851093 wp -> w_wincol ,
10861094 wp -> w_wincol + total_width ,
10871095 wp -> w_popup_border [3 ] != 0
1088- ? tl_corner_char : hor_line_char ,
1089- hor_line_char , popup_attr );
1096+ ? border_char [ 4 ] : border_char [ 0 ] ,
1097+ border_char [ 0 ], border_attr [ 0 ] );
10901098 if (wp -> w_popup_border [1 ] > 0 )
1091- screen_puts ((char_u * )tr_corner_str , wp -> w_winrow ,
1092- wp -> w_wincol + total_width - 1 , popup_attr );
1099+ {
1100+ buf [mb_char2bytes (border_char [5 ], buf )] = NUL ;
1101+ screen_puts (buf , wp -> w_winrow ,
1102+ wp -> w_wincol + total_width - 1 , border_attr [1 ]);
1103+ }
10931104 }
10941105
10951106 if (wp -> w_popup_padding [0 ] > 0 )
@@ -1108,15 +1119,21 @@ update_popups(void)
11081119 {
11091120 // left border
11101121 if (wp -> w_popup_border [3 ] > 0 )
1111- screen_puts ((char_u * )ver_line_str , row , wp -> w_wincol , popup_attr );
1122+ {
1123+ buf [mb_char2bytes (border_char [3 ], buf )] = NUL ;
1124+ screen_puts (buf , row , wp -> w_wincol , border_attr [3 ]);
1125+ }
11121126 // left padding
11131127 if (wp -> w_popup_padding [3 ] > 0 )
11141128 screen_puts (get_spaces (wp -> w_popup_padding [3 ]), row ,
11151129 wp -> w_wincol + wp -> w_popup_border [3 ], popup_attr );
11161130 // right border
11171131 if (wp -> w_popup_border [1 ] > 0 )
1118- screen_puts ((char_u * )ver_line_str , row ,
1119- wp -> w_wincol + total_width - 1 , popup_attr );
1132+ {
1133+ buf [mb_char2bytes (border_char [1 ], buf )] = NUL ;
1134+ screen_puts (buf , row ,
1135+ wp -> w_wincol + total_width - 1 , border_attr [1 ]);
1136+ }
11201137 // right padding
11211138 if (wp -> w_popup_padding [1 ] > 0 )
11221139 screen_puts (get_spaces (wp -> w_popup_padding [1 ]), row ,
@@ -1142,11 +1159,15 @@ update_popups(void)
11421159 screen_fill (row , row + 1 ,
11431160 wp -> w_wincol ,
11441161 wp -> w_wincol + total_width ,
1145- wp -> w_popup_border [3 ] != 0 ? bl_corner_char : hor_line_char ,
1146- hor_line_char , popup_attr );
1162+ wp -> w_popup_border [3 ] != 0
1163+ ? border_char [7 ] : border_char [2 ],
1164+ border_char [2 ], border_attr [2 ]);
11471165 if (wp -> w_popup_border [1 ] > 0 )
1148- screen_puts ((char_u * )br_corner_str , row ,
1149- wp -> w_wincol + total_width - 1 , popup_attr );
1166+ {
1167+ buf [mb_char2bytes (border_char [6 ], buf )] = NUL ;
1168+ screen_puts (buf , row ,
1169+ wp -> w_wincol + total_width - 1 , border_attr [2 ]);
1170+ }
11501171 }
11511172 }
11521173}
0 commit comments