A chapter is a list too, and deleting stops moving things

Deleting a note moved everything else. A row leaving is the same problem as
a row arriving, in reverse: a line's position counts the rows above it, so a
note deleted above a line left the line counting rows that were no longer
there, and everything under it appeared to jump up past it. withoutRow
renumbers the list a row leaves, and every place one leaves says so -- the
bin, a move, a chapter being removed. Arrivals land at the top: an old
position belongs to an arrangement that has moved on.

A line could not be dragged under another line. Two lines in the same gap
carry the same position, and the comparator claimed "a separator comes
first" without asking what the other one was -- both directions at once for
that case. A comparator that contradicts itself has no defined result, so
the sort returned them in whichever order it happened to walk.

A chapter is always in the user's own order and can be arranged like any
other list: its notes wear handles under the same switch as the list beside
them and are dragged among themselves, strips at both ends included. The two
lists keep apart by scope -- a chapter unfolded under its row holds rows
inside a row of the notebook's list, so the nearest row above the pointer
cannot say which list a drag belongs to. The sort menu is gone inside a
chapter: the mode belongs to the notebook, and a menu there would offer a
choice that cannot be honoured.

The chapters suite no longer assumes the first chapter row is the one that
matters. A chapter is a row in the arrangement and can be anywhere in it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
marcandClaude Opus 5 committed 2026-08-17 12:37:02 +02:00
1 parent 312c4e190e
commit f01522aa6f
10 files changed
+528 -85

No files matched your search

+29
View File
@@ -332,6 +332,14 @@ devices get different starts, because they want different things:
The row under the finger is found with `elementFromPoint`, not with enter/leave
handlers — a finger generates no `pointerover` on anything it did not press.
**Two lines in the same gap keep the order they were written in.** A separator's
position counts the rows above it, so two lines with nothing between them carry
the same number, and only the order they are stored in can tell them apart. The
comparator used to say "a separator comes first" without asking what the other
one was — claiming both directions at once for that case. A comparator that
contradicts itself has no defined result, and a line dragged under another sprang
back above it every time.
**A drop lands the row under the one it was released on, and only ever there.**
Dropping above a row and dropping below the row before it are the same move
described twice, so every gap could be aimed at from two sides — which made a
@@ -1105,6 +1113,27 @@ still reads newest-first — untouched rows all carry position 0 and fall back t
it — so nothing is lost by starting there, while starting in "last changed" made
both separators and dragging look broken until the sort menu was found.
**Inside a chapter the order is always the user's own.** The mode belongs to the
notebook and governs the notebook's own list; a chapter is a place someone made
and filled by hand, and filing a note into one only means something if it stays
where it was put. So a chapter has no sort menu of its own, its lines always
show, and its rows can always be dragged — with the *same* switch as the list
beside it, because two switches for two lists looked at together is one too many.
The two lists keep out of each other's way by scope: a chapter unfolded under its
row holds rows *inside* a row of the notebook's list, so "the nearest row above
the pointer" cannot say which list a drag belongs to.
**A row leaving is the same problem as a row arriving, in reverse.** Deleting a
note above a line left the line counting rows that were no longer there, so
everything under it appeared to jump up past it — which is what made deleting
feel as though it scrambled the notebook. `withoutRow` renumbers the list the row
is leaving, and every place a row leaves one says so: the bin, a move to another
notebook or chapter, and a chapter being removed. Restoring from the bin and
moving into a list are arrivals, and arrive at the top like anything else — an
old position belongs to an arrangement that has moved on. Removing a chapter is
both at once: its row leaves the count, and the notes it held arrive at the top
in the order they had inside it.
**A new note is put at the very top, and the list is renumbered to say so.**
Left to the tie-break it landed near the top by age, which is not the same thing:
a separator's position counts the rows above it, so a row appearing without a