move
[?]
May 29, 2022, 5:27 AM
CG3264MMJTTSCJWUA2EMTBOPTDB2NZIJ7XICKHWUTZ4UWLFP7POACDependencies
- [2]
G6OYAYHUpaste in text with M-v - [3]
DAENUOGVeliminate assumptions that line length == size in bytes - [4]
2ZYV7D3Whandle tab characters - [5]
XNFTJHC4split keyboard handling between Text and Drawing - [6]
2HW3HUCGM-left/M-right for word-based motions - [7]
DLQMM265scroll past first page - [8]
KECEMMMRextract couple of functions - [9]
2RXZ3PGObeginning of a new approach to scroll+wrap - [*]
BULPIBEGbeginnings of a module for the text editor
Change contents
- edit in text.lua at line 899
--== shortcuts that mutate text - edit in text.lua at line 915[3.1006]→[3.1006:1036](∅→∅),[3.1036]→[3.1:17](∅→∅),[3.17]→[3.1461:1492](∅→∅),[3.1461]→[3.1461:1492](∅→∅),[3.1492]→[3.18:35](∅→∅),[3.35]→[3.1:725](∅→∅),[3.725]→[2.79:252](∅→∅),[2.252]→[3.725:733](∅→∅),[3.725]→[3.725:733](∅→∅),[3.35]→[3.1924:1954](∅→∅),[3.733]→[3.1924:1954](∅→∅),[3.1924]→[3.1924:1954](∅→∅),[3.1954]→[3.1823:1843](∅→∅),[3.1843]→[3.1973:2002](∅→∅),[3.1973]→[3.1973:2002](∅→∅),[3.2002]→[3.1844:1901](∅→∅)
elseif chord == 'left' thenText.left()elseif chord == 'right' thenText.right()-- left/right by one word-- C- hotkeys reserved for drawings, so we'll use M-elseif chord == 'M-left' thenwhile true doText.left()if Cursor1.pos == 1 then break endassert(Cursor1.pos > 1)local offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)assert(offset > 1)if Lines[Cursor1.line].data:sub(offset-1,offset-1) == ' ' thenbreakendendelseif chord == 'M-right' thenwhile true doText.right()if Cursor1.pos > utf8.len(Lines[Cursor1.line].data) then break endlocal offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)if Lines[Cursor1.line].data:sub(offset,offset) == ' ' thenbreakendend-- pasteelseif chord == 'M-v' thenlocal s = love.system.getClipboardText()for _,code in utf8.codes(s) doText.insert_at_cursor(utf8.char(code))endelseif chord == 'home' thenCursor1.pos = 1elseif chord == 'end' thenCursor1.pos = utf8.len(Lines[Cursor1.line].data) + 1 - edit in text.lua at line 971
-- pasteelseif chord == 'M-v' thenlocal s = love.system.getClipboardText()for _,code in utf8.codes(s) doText.insert_at_cursor(utf8.char(code))end--== shortcuts that move the cursorelseif chord == 'left' thenText.left()elseif chord == 'right' thenText.right()-- left/right by one word-- C- hotkeys reserved for drawings, so we'll use M-elseif chord == 'M-left' thenwhile true doText.left()if Cursor1.pos == 1 then break endassert(Cursor1.pos > 1)local offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)assert(offset > 1)if Lines[Cursor1.line].data:sub(offset-1,offset-1) == ' ' thenbreakendendelseif chord == 'M-right' thenwhile true doText.right()if Cursor1.pos > utf8.len(Lines[Cursor1.line].data) then break endlocal offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)if Lines[Cursor1.line].data:sub(offset,offset) == ' ' thenbreakendendelseif chord == 'home' thenCursor1.pos = 1elseif chord == 'end' thenCursor1.pos = utf8.len(Lines[Cursor1.line].data) + 1