Commit 3948d4a
committed
fix(keymap): accessible-keymaps follows parent keymaps (breadth-first)
`accessible-keymaps` used a depth-first walk that deliberately stopped at a
keymap's parent ("parent keymap, don't descend"), so prefix maps reachable only
through the parent were omitted -- e.g. a child and parent both binding C-c to
different prefix maps listed one [3] entry instead of GNU's two.
Rewrite it to mirror GNU `Faccessible_keymaps` (keymap.c): a breadth-first walk
over a growing (prefix, map) queue, scanning each map's bindings via a new
map_keymap-style walker that follows the parent chain (reporting embedded prefix
maps as bindings without descending). Enqueue a map again under a
longer/unrelated prefix but skip it when an already-queued strict-prefix path
reaches the same map -- GNU's cycle rule, which reproduces GNU's duplicate
listings and terminates on self-referential parents. Also picks up char-table
bindings the old DFS missed.
Update the guard unit test (which asserted the non-GNU no-descend behavior) to
expect the parent's prefix map. Verified against GNU: combo case now
([] [3] [3]); BFS ordering ([] [3] [24] [3 4]) matches.
Fixes keymap_parent_accessible_keymaps_combo.1 parent c9e9bc7 commit 3948d4a
3 files changed
Lines changed: 88 additions & 53 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
214 | | - | |
215 | | - | |
| 213 | + | |
216 | 214 | | |
217 | 215 | | |
218 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3281 | 3281 | | |
3282 | 3282 | | |
3283 | 3283 | | |
3284 | | - | |
3285 | | - | |
3286 | | - | |
3287 | | - | |
3288 | | - | |
3289 | | - | |
3290 | | - | |
3291 | | - | |
3292 | | - | |
3293 | | - | |
3294 | | - | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
3295 | 3297 | | |
3296 | | - | |
3297 | | - | |
3298 | | - | |
3299 | | - | |
3300 | | - | |
3301 | | - | |
3302 | | - | |
3303 | | - | |
3304 | | - | |
3305 | | - | |
3306 | | - | |
3307 | | - | |
3308 | | - | |
3309 | | - | |
| 3298 | + | |
3310 | 3299 | | |
3311 | | - | |
3312 | | - | |
3313 | | - | |
3314 | | - | |
| 3300 | + | |
3315 | 3301 | | |
3316 | | - | |
3317 | | - | |
3318 | | - | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
3319 | 3309 | | |
3320 | | - | |
3321 | | - | |
3322 | | - | |
3323 | | - | |
3324 | | - | |
3325 | | - | |
3326 | | - | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
3327 | 3315 | | |
3328 | | - | |
3329 | 3316 | | |
3330 | | - | |
3331 | | - | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
3332 | 3362 | | |
3333 | | - | |
3334 | 3363 | | |
3335 | 3364 | | |
3336 | | - | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
3337 | 3368 | | |
3338 | 3369 | | |
3339 | 3370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
593 | | - | |
| 593 | + | |
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
602 | | - | |
603 | 602 | | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
608 | 614 | | |
609 | 615 | | |
610 | 616 | | |
| |||
0 commit comments