go through and fix similar issues
[?]
Jun 14, 2022, 3:15 PM
CPZGQT72EBP3SEDBPDWQRK5IUGA664PHXNP2GOHJLP43PKPWF25ACDependencies
- [2]
4VKEE43Zbugfix - [3]
CUIV2LE5some typos - [4]
5FW7YOFThighlight selection while dragging - [5]
AYE2VEGJextract a couple of methods - [6]
BOFNXP5Gclicking now moves the cursor even on long, wrapped lines - [7]
PR4KIAZDfirst stab at equally hacky cursor down support - [8]
V5MJRFOZbugfix: down arrow doesn't scroll up unnecessarily - [9]
ZPUQSPQPextract a few methods - [10]
5L7K4GBDclicking to the right of a wrapped line - [11]
HOSPP2ANcrisp font rendering - [12]
XNFTJHC4split keyboard handling between Text and Drawing - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
BJ5X5O4Alet's prevent the text cursor from ever getting on a drawing
Change contents
- replacement in text.lua at line 467
local s = string.sub(Lines[Cursor1.line].data, screen_line_starting_pos)local screen_line_starting_byte_offset = utf8.offset(Lines[Cursor1.line].data, screen_line_starting_pos)assert(screen_line_starting_byte_offset)local s = string.sub(Lines[Cursor1.line].data, screen_line_starting_byte_offset) - replacement in text.lua at line 487
local s = string.sub(Lines[Cursor1.line].data, new_screen_line_starting_pos)local new_screen_line_starting_byte_offset = utf8.offset(Lines[Cursor1.line].data, new_screen_line_starting_pos)assert(new_screen_line_starting_byte_offset)local s = string.sub(Lines[Cursor1.line].data, new_screen_line_starting_byte_offset) - replacement in text.lua at line 527
local s = string.sub(Lines[Cursor1.line].data, new_screen_line_starting_pos)local new_screen_line_starting_byte_offset = utf8.offset(Lines[Cursor1.line].data, new_screen_line_starting_pos)assert(new_screen_line_starting_byte_offset)local s = string.sub(Lines[Cursor1.line].data, new_screen_line_starting_byte_offset) - replacement in text.lua at line 698
--? print('iter', y, screen_line_index, screen_line_starting_pos, string.sub(line.data, screen_line_starting_pos))local screen_line_starting_byte_offset = utf8.offset(line.data, screen_line_starting_pos)assert(screen_line_starting_byte_offset)--? print('iter', y, screen_line_index, screen_line_starting_pos, string.sub(line.data, screen_line_starting_byte_offset)) - edit in text.lua at line 710
local screen_line_starting_byte_offset = utf8.offset(line.data, screen_line_starting_pos)assert(screen_line_starting_byte_offset) - edit in manual_tests at line 1[15.1][15.2]
-- static properties of the codeAll strings are UTF-8. Bytes within them are not characters.I try to label byte offsets as _offset, and character positions as _pos.For example, string.sub should never use a _pos to substring, only an _offset.Wish I had some static typing here. We're not going to try to write tests to catch issues like this.-- manual tests