From acbd39e3e838fe49b17e32fe254af9ea12b4f81b Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sat, 26 Sep 2026 11:01:21 +0100 Subject: Declare marks: cursors that stay before inserted text `state from: mark in note` is a cursor that stays before text inserted at its position; `cursor in` goes after it, as a caret does. Everything a cursor takes, a mark takes too. The notes example's mark is now one, and its reference model agrees: typing at the mark leaves it in place. --- tests/check.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/check.py b/tests/check.py index c4484c4..7f94235 100644 --- a/tests/check.py +++ b/tests/check.py @@ -445,7 +445,8 @@ class NotesModel: def insert(self, text): p = self.at self.note = self.note[:p] + text + self.note[p:] - self.at, self.mark = [c + len(text) if c >= p else c for c in (self.at, self.mark)] + self.at = self.at + len(text) if self.at >= p else self.at + self.mark = self.mark + len(text) if self.mark > p else self.mark # a mark stays at the insertion point def remove(self, a, b): self.note = self.note[:a] + self.note[b:] -- cgit v1.2.3