comparison src/popupmenu.c @ 18560:81272918c0ea v8.1.2274

patch 8.1.2274: newlines in 'balloonexpr' result only work in the GUI Commit: https://github.com/vim/vim/commit/d1c1c823892d0713065934256f48e7f4e6609f99 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 9 16:59:14 2019 +0100 patch 8.1.2274: newlines in 'balloonexpr' result only work in the GUI Problem: Newlines in 'balloonexpr' result only work in the GUI. Solution: Also recognize newlines in the terminal. (closes https://github.com/vim/vim/issues/5193)
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Nov 2019 17:00:03 +0100
parents ba5d8c5d77d7
children 7369756d05de
comparison
equal deleted inserted replaced
18559:f983bf313b4d 18560:81272918c0ea
1128 int height; 1128 int height;
1129 int line; 1129 int line;
1130 int item_idx; 1130 int item_idx;
1131 int indent = 0; 1131 int indent = 0;
1132 int max_cells = 0; 1132 int max_cells = 0;
1133 int max_height = Rows / 2 - 2; 1133 int max_height = Rows / 2 - 1;
1134 int long_item_count = 0; 1134 int long_item_count = 0;
1135 int split_long_items = FALSE; 1135 int split_long_items = FALSE;
1136 1136
1137 ga_init2(&ga, sizeof(balpart_T), 20); 1137 ga_init2(&ga, sizeof(balpart_T), 20);
1138 p = mesg; 1138 p = mesg;
1148 ++ga.ga_len; 1148 ++ga.ga_len;
1149 while (*p != NUL) 1149 while (*p != NUL)
1150 { 1150 {
1151 if (*p == '"') 1151 if (*p == '"')
1152 quoted = !quoted; 1152 quoted = !quoted;
1153 else if (*p == '\n')
1154 break;
1153 else if (*p == '\\' && p[1] != NUL) 1155 else if (*p == '\\' && p[1] != NUL)
1154 ++p; 1156 ++p;
1155 else if (!quoted) 1157 else if (!quoted)
1156 { 1158 {
1157 if ((*p == ',' && p[1] == ' ') || *p == '{' || *p == '}') 1159 if ((*p == ',' && p[1] == ' ') || *p == '{' || *p == '}')
1168 } 1170 }
1169 item->cells += ptr2cells(p); 1171 item->cells += ptr2cells(p);
1170 p += mb_ptr2len(p); 1172 p += mb_ptr2len(p);
1171 } 1173 }
1172 item->bytelen = p - item->start; 1174 item->bytelen = p - item->start;
1175 if (*p == '\n')
1176 ++p;
1173 if (item->cells > max_cells) 1177 if (item->cells > max_cells)
1174 max_cells = item->cells; 1178 max_cells = item->cells;
1175 long_item_count += (item->cells - 1) / BALLOON_MIN_WIDTH; 1179 long_item_count += (item->cells - 1) / BALLOON_MIN_WIDTH;
1176 } 1180 }
1177 1181