Commit 9eb8782
authored
Rework FindMatchingBrace() interface and implementation (zyedidia#3319)
Instead of passing a single brace pair to FindMatchingBrace(), make it
traverse all brace pairs in buffer.BracePairs on its own.
This has the following advantages:
1. Makes FindMatchingBrace() easier to use, in particular much easier
to use from Lua.
2. Lets FindMatchingBrace() ensure that we use just one matching brace -
the higher-priority one. This fixes the following issues:
([foo]bar)
^
when the cursor is on `[`:
- Both `[]` and `()` pairs are highlighted, whereas the expected
behavior is that only one pair is highlighted - the one that the
JumpToMatchingBrace action would jump to.
- JumpToMatchingBrace action incorrectly jumps to `)` instead of
`]` (which should take higher priority in this case).
In contrast, with `((foo)bar)` it works correctly.1 parent 46e55c8 commit 9eb8782
File tree
3 files changed
+71
-73
lines changed- internal
- action
- buffer
- display
3 files changed
+71
-73
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1394 | 1394 | | |
1395 | 1395 | | |
1396 | 1396 | | |
1397 | | - | |
1398 | | - | |
1399 | | - | |
1400 | | - | |
1401 | | - | |
1402 | | - | |
1403 | | - | |
1404 | | - | |
1405 | | - | |
1406 | | - | |
1407 | | - | |
1408 | | - | |
1409 | | - | |
1410 | | - | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
1411 | 1403 | | |
| 1404 | + | |
| 1405 | + | |
1412 | 1406 | | |
1413 | 1407 | | |
1414 | 1408 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1140 | 1140 | | |
1141 | 1141 | | |
1142 | 1142 | | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
1148 | | - | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
1152 | | - | |
1153 | | - | |
1154 | | - | |
1155 | | - | |
1156 | | - | |
1157 | | - | |
1158 | | - | |
1159 | | - | |
| 1143 | + | |
1160 | 1144 | | |
1161 | | - | |
| 1145 | + | |
1162 | 1146 | | |
1163 | 1147 | | |
1164 | 1148 | | |
1165 | 1149 | | |
1166 | | - | |
1167 | | - | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
| 1150 | + | |
1171 | 1151 | | |
1172 | 1152 | | |
1173 | 1153 | | |
| |||
1176 | 1156 | | |
1177 | 1157 | | |
1178 | 1158 | | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
| 1159 | + | |
1183 | 1160 | | |
1184 | 1161 | | |
1185 | 1162 | | |
1186 | 1163 | | |
1187 | | - | |
| 1164 | + | |
1188 | 1165 | | |
1189 | 1166 | | |
1190 | 1167 | | |
1191 | 1168 | | |
1192 | | - | |
1193 | | - | |
1194 | | - | |
1195 | | - | |
1196 | | - | |
| 1169 | + | |
1197 | 1170 | | |
1198 | 1171 | | |
1199 | 1172 | | |
| |||
1202 | 1175 | | |
1203 | 1176 | | |
1204 | 1177 | | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
| 1178 | + | |
1209 | 1179 | | |
1210 | 1180 | | |
1211 | 1181 | | |
1212 | 1182 | | |
1213 | 1183 | | |
1214 | | - | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
1215 | 1227 | | |
1216 | 1228 | | |
1217 | 1229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
416 | 406 | | |
| 407 | + | |
| 408 | + | |
417 | 409 | | |
418 | 410 | | |
419 | 411 | | |
| |||
0 commit comments