switch copy/paste to ctrl- hotkeys
[?]
Jun 3, 2022, 6:52 AM
LS55YKGWKICTQTAHR5KLMNDOL6CDI4ATT3NT5Z2YL5IM3CRQOONQCDependencies
- [2]
NQWWTGXRswitch undo/redo to ctrl- hotkeys - [3]
YPHKZVWMextract a new variable - [4]
22S4LHNKscroll if necessary on paste - [5]
2RXZ3PGObeginning of a new approach to scroll+wrap - [6]
GN3IF4WFbugfix: pasting newlines - [7]
SQLVYKVJrename - [8]
XNFTJHC4split keyboard handling between Text and Drawing - [9]
CG3264MMmove - [10]
VJ77YABHmore efficient undo/redo - [11]
73OCE2MCafter much struggle, a brute-force undo - [12]
JF5L2BBStest harness now supports copy/paste - [13]
HOSPP2ANcrisp font rendering - [14]
KWOJ6XHEcut/copy selected text to clipboard - [15]
RTPXEETLrename - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
OTIBCAUJlove2d scaffold - [*]
Z4XRNDTRfind text
Change contents
- replacement in text.lua at line 430
App.run_after_keychord('M-v')App.run_after_keychord('C-v') - edit in text.lua at line 1382[3.8121]→[3.36:47](∅→∅),[3.3956]→[3.36:47](∅→∅),[3.47]→[3.963:1037](∅→∅),[3.1037]→[3.2703:2733](∅→∅),[3.2733]→[3.1075:1161](∅→∅),[3.1075]→[3.1075:1161](∅→∅),[3.1161]→[3.2734:2764](∅→∅),[3.2764]→[3.1199:1207](∅→∅),[3.1199]→[3.1199:1207](∅→∅),[3.1207]→[3.47:76](∅→∅),[3.47]→[3.47:76](∅→∅),[3.76]→[3.2:138](∅→∅),[3.138]→[3.2197:2275](∅→∅),[3.76]→[3.2197:2275](∅→∅),[3.2275]→[3.2:52](∅→∅),[3.52]→[3.139:177](∅→∅),[3.177]→[3.52:100](∅→∅),[3.52]→[3.52:100](∅→∅),[3.100]→[3.28:113](∅→∅),[3.156]→[3.28:113](∅→∅),[3.113]→[3.178:216](∅→∅),[3.216]→[3.113:181](∅→∅),[3.113]→[3.113:181](∅→∅),[3.181]→[3.217:430](∅→∅),[3.181]→[3.201:209](∅→∅),[3.430]→[3.201:209](∅→∅),[3.201]→[3.201:209](∅→∅),[3.209]→[3.3039:3130](∅→∅),[3.3130]→[3.530:860](∅→∅),[3.530]→[3.530:860](∅→∅),[3.860]→[3.3131:3396](∅→∅),[3.3396]→[3.1141:1259](∅→∅),[3.1141]→[3.1141:1259](∅→∅),[3.1259]→[3.2276:2358](∅→∅),[3.209]→[3.2276:2358](∅→∅)
-- pasteelseif chord == 'M-c' thenlocal s = Text.selection()if s thenApp.setClipboardText(s)endelseif chord == 'M-x' thenlocal s = Text.cut_selection()if s thenApp.setClipboardText(s)endelseif chord == 'M-v' then-- We don't have a good sense of when to scroll, so we'll be conservative-- and sometimes scroll when we didn't quite need to.local before_line = Cursor1.linelocal before = snapshot(before_line)local clipboard_data = App.getClipboardText()local num_newlines = 0 -- hack 1for _,code in utf8.codes(clipboard_data) dolocal c = utf8.char(code)if c == '\n' thenText.insert_return()num_newlines = num_newlines+1elseText.insert_at_cursor(utf8.char(code))endend-- hack 1: if we have too many newlines we definitely need to scrollfor i=before_line,Cursor1.line doLines[i].screen_line_starting_pos = nilText.populate_screen_line_starting_pos(i)endif Cursor1.line-Screen_top1.line+1 + num_newlines > App.screen.height/Line_height thenScreen_top1.line = Cursor1.lineScreen_top1.pos = 1Text.scroll_up_while_cursor_on_screen()end-- hack 2: if we have too much text wrapping we definitely need to scrolllocal clipboard_text = App.newText(love.graphics.getFont(), clipboard_data)local clipboard_width = App.width(clipboard_text)--? print(Cursor_y, Cursor_y*Line_width, Cursor_y*Line_width+Cursor_x, Cursor_y*Line_width+Cursor_x+clipboard_width, Line_width*App.screen.height/Line_height)if Cursor_y*Line_width+Cursor_x + clipboard_width > Line_width*App.screen.height/Line_height thenScreen_top1.line = Cursor1.lineScreen_top1.pos = 1Text.scroll_up_while_cursor_on_screen()endrecord_undo_event({before=before, after=snapshot(before_line, Cursor1.line)}) - edit in main.lua at line 296
end-- clipboardelseif chord == 'C-c' thenlocal s = Text.selection()if s thenApp.setClipboardText(s)endelseif chord == 'C-x' thenlocal s = Text.cut_selection()if s thenApp.setClipboardText(s)endelseif chord == 'C-v' then-- We don't have a good sense of when to scroll, so we'll be conservative-- and sometimes scroll when we didn't quite need to.local before_line = Cursor1.linelocal before = snapshot(before_line)local clipboard_data = App.getClipboardText()local num_newlines = 0 -- hack 1for _,code in utf8.codes(clipboard_data) dolocal c = utf8.char(code)if c == '\n' thenText.insert_return()num_newlines = num_newlines+1elseText.insert_at_cursor(utf8.char(code))endend-- hack 1: if we have too many newlines we definitely need to scrollfor i=before_line,Cursor1.line doLines[i].screen_line_starting_pos = nilText.populate_screen_line_starting_pos(i)endif Cursor1.line-Screen_top1.line+1 + num_newlines > App.screen.height/Line_height thenScreen_top1.line = Cursor1.lineScreen_top1.pos = 1Text.scroll_up_while_cursor_on_screen()end-- hack 2: if we have too much text wrapping we definitely need to scrolllocal clipboard_text = App.newText(love.graphics.getFont(), clipboard_data)local clipboard_width = App.width(clipboard_text)--? print(Cursor_y, Cursor_y*Line_width, Cursor_y*Line_width+Cursor_x, Cursor_y*Line_width+Cursor_x+clipboard_width, Line_width*App.screen.height/Line_height)if Cursor_y*Line_width+Cursor_x + clipboard_width > Line_width*App.screen.height/Line_height thenScreen_top1.line = Cursor1.lineScreen_top1.pos = 1Text.scroll_up_while_cursor_on_screen() - edit in main.lua at line 343[2.646][19.3819]
record_undo_event({before=before, after=snapshot(before_line, Cursor1.line)})-- dispatch to drawing or text