Character codes in typed text; the site and relay at app.kokkoja.com
With the Text tool, Klammertext's codes give letters a keyboard lacks: ^o" is ö, ^s^ ß, ^a1 ā, ^130ED^ a code point of 4 to 6 digits, ^9053 53EF^ a sequence, ^^ a caret, replaced as each code is completed. The public site and relay moved to app.kokkoja.com; the old name redirects. The Markdown documentation is withdrawn from the release while it is converted to Klammertext; the README's links to it are stale until then. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
34ca33d365
commit
89b4a41b2a
15 files changed
+364
-1273
No files matched your search
@@ -1346,6 +1346,51 @@ class EndToEndTest(unittest.TestCase):
|
||||
firefox.switch_to(host_tab)
|
||||
firefox.go("about:blank")
|
||||
|
||||
def test_character_codes_in_text(self):
|
||||
"""Andy, 2026-10-13: Klammertext's character codes in a text
|
||||
block, replaced as each is completed; the field's own undo
|
||||
survives a replacement."""
|
||||
firefox = self.firefox
|
||||
host_tab = firefox.current_tab()
|
||||
firefox.go(self.address("Late"))
|
||||
self.enter_name("Typist", "start_session")
|
||||
invitation = firefox.run("return document.getElementById('invitation').value;")
|
||||
guest_tab = firefox.new_tab()
|
||||
firefox.go(self.address("Student", join=invitation))
|
||||
self.enter_name("Onlooker", "join_session")
|
||||
self.wait_until(lambda s: s["page"]["number"] == 1 and len(s["participants"]) == 2, "the onlooker")
|
||||
firefox.switch_to(host_tab)
|
||||
field_text = lambda: firefox.run("return document.querySelector('.text_field').value;")
|
||||
|
||||
firefox.run("document.querySelector('[data-tool=text]').click();")
|
||||
firefox.run(TEXT_GESTURE, 0.2, 0.3, 0.2, 0.3)
|
||||
firefox.type_into(".text_field", 'Gr^u"^s^e, ^a` 2^^3, ^OE^uvre, ^00E9^, m^a1, ^130ED^ ^9053 53EF^')
|
||||
self.assertEqual(field_text(), "Grüße, à 2^3, Œuvre, é, mā, 𓃭 道可")
|
||||
self.wait_until(lambda s: s["texts"]["Typist"] and s["texts"]["Typist"][0]["text"] == "Grüße, à 2^3, Œuvre, é, mā, 𓃭 道可",
|
||||
"the text with its codes replaced")
|
||||
# The caret counts UTF-16 units, so the hieroglyph counts twice.
|
||||
self.assertEqual(firefox.run("return document.querySelector('.text_field').selectionStart;"),
|
||||
len("Grüße, à 2^3, Œuvre, é, mā, 𓃭 道可".encode("utf-16-le")) // 2)
|
||||
|
||||
# In the middle of the text too, and only at the caret: the ^
|
||||
# left earlier stays.
|
||||
firefox.run("const f = document.querySelector('.text_field'); f.setSelectionRange(2, 2);")
|
||||
firefox.type_into(".text_field", "^o-")
|
||||
self.assertEqual(field_text(), "Grōüße, à 2^3, Œuvre, é, mā, 𓃭 道可")
|
||||
self.assertEqual(firefox.run("return document.querySelector('.text_field').selectionStart;"), 3)
|
||||
|
||||
# The browser's own undo in the field is not lost by a replacement:
|
||||
# one step gives back the code as typed.
|
||||
firefox.chord("\ue009", "z")
|
||||
self.assertEqual(field_text(), "Gr^o-üße, à 2^3, Œuvre, é, mā, 𓃭 道可")
|
||||
|
||||
firefox.run("document.querySelector('[data-tool=pen]').click();")
|
||||
shown = self.wait_until(lambda s: s["texts"]["Typist"] and "üße" in s["texts"]["Typist"][0]["text"],
|
||||
"the finished block")["texts"]["Typist"][0]["text"]
|
||||
firefox.switch_to(guest_tab)
|
||||
self.wait_until(lambda s: s["texts"].get("Typist") and s["texts"]["Typist"][0]["text"] == shown,
|
||||
"the onlooker to see the same text")
|
||||
|
||||
def test_text_being_typed_stays_on_the_page_left(self):
|
||||
"""Andy, 2026-10-06: a guest was typing when the host pressed New,
|
||||
and the text reappeared on the new page."""
|
||||
|
||||
Reference in new issue
Block a user