aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-26 11:01:21 +0100
committereunhhu <[email protected]>2026-09-26 11:01:21 +0100
commitacbd39e3e838fe49b17e32fe254af9ea12b4f81b (patch)
tree64a91b85cd4249f52e6f1ab5faae0142627c599a /tests
parent91332801ff2334cd887df3971f944b60bebf729c (diff)
downloadaup-acbd39e3e838fe49b17e32fe254af9ea12b4f81b.tar.gz
aup-acbd39e3e838fe49b17e32fe254af9ea12b4f81b.zip
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/check.py3
1 files changed, 2 insertions, 1 deletions
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:]