Repository navigation
Commit 195930a
committed
Fix(table): alignment is a ticked group, and a commit can't vanish (#485)
Two defects behind a report I could not reproduce: choosing a column
alignment appearing to do nothing until it is chosen a second time.
The alignment entries were a hidden toggle — choosing the alignment a
column already had cleared it back to none. A column with no alignment
renders identically to a left-aligned one, so on a fresh column that
reads as: choose Align left, nothing changes; choose it again, still
nothing, because the second choice quietly removed what the first one
set. The three entries are now a ticked group with a fourth, Align
default. A new column shows `Align default ✓`, choosing an alignment
only ever sets it, and clearing is a deliberate pick rather than the
side effect of choosing twice.
The second defect is a silent drop. `commitTable` looks the table up in
the syntax tree, and finding no Table node it returned — throwing the
edit away with no feedback. Markdown parsing is incremental, so a table
created or restructured moments earlier can still be outside the parsed
tree, which makes this exactly a "that did nothing; do it again and it
works" bug, and one whose likelihood depends on machine speed and
document size rather than on anything the user can see. It now falls
back to `tableBlockAt`, which reads the table block out of the document
— the run of `|` rows around the position, plus a trailing `zen:cols`
marker — and refuses a lone pipe line, since rewriting prose as a table
would be a worse failure than none.
Not claimed as a reproduction of the report. Driving the packaged app,
the first selection applied every time: fresh `/table` table, keystrokes
60ms apart, and a 4000-paragraph note to starve the parser. What is
fixed here is the behaviour that produces the described symptom, and the
path by which an action can disappear without a trace.
Verified in the app: first pick writes `| :------- |`, a second pick
leaves it alone where it used to revert, and Align default clears it.
Five tests cover the document-scan fallback.
Reported by @uNyanda.1 parent 13c9487 commit 195930a
3 files changed
Lines changed: 82 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| |||
337 | 338 | | |
338 | 339 | | |
339 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
340 | 353 | | |
341 | 354 | | |
342 | 355 | | |
| |||
345 | 358 | | |
346 | 359 | | |
347 | 360 | | |
348 | | - | |
| 361 | + | |
349 | 362 | | |
350 | 363 | | |
351 | | - | |
352 | | - | |
353 | | - | |
| 364 | + | |
| 365 | + | |
354 | 366 | | |
355 | 367 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
431 | 433 | | |
432 | 434 | | |
433 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
98 | 124 | | |
99 | 125 | | |
100 | 126 | | |
| |||
108 | 134 | | |
109 | 135 | | |
110 | 136 | | |
111 | | - | |
| 137 | + | |
112 | 138 | | |
113 | 139 | | |
114 | 140 | | |
| |||
0 commit comments