Merge text.love
[?]
Nov 27, 2022, 9:20 PM
AT3LVCMPK7SSIEHF3JI6XTA5XNO7HFI3AOHYNX4Y24QKJ2NS6DDQCDependencies
- [2]
RXNR3U5EMerge text.love - [3]
VO2ZVTWKMerge lines.love - [4]
SCOXD4EOMerge lines.love - [5]
4YDBYBA4clean up memory leak experiments - [6]
K2X6G75Zstart writing some tests for drawings - [7]
JOPVPUSAediting source code from within the app - [8]
D4B52CQ2Merge lines.love - [9]
VHUNJHXBMerge lines.love - [10]
BLWAYPKVextract a module - [11]
BJ5X5O4Alet's prevent the text cursor from ever getting on a drawing - [12]
3QNOKBFMbeginnings of a test harness - [13]
D2GCFTTTclean up repl functionality - [14]
LXTTOB33extract a couple of files - [15]
XX7G2FFJintermingle freehand line drawings with text - [16]
2L5MEZV3experiment: new edit namespace - [17]
RSZD5A7Gforgot to add json.lua - [18]
MOAEVTKJclean up a few more loose ends - [19]
GUOQRUL7Merge lines.love - [20]
UEE5W7WJdocument one more shortcut - [21]
ATQO62TFMerge lines.love - [22]
36Z442IVback to commit 8123959e52f without code editing - [23]
BULPIBEGbeginnings of a module for the text editor - [24]
73OCE2MCafter much struggle, a brute-force undo - [25]
6LJZN727handle chords - [26]
MD3W5IRAnew fork: rip out drawing support - [27]
KKMFQDR4editing source code from within the app - [28]
VXORMHMEdelete experimental REPL - [29]
TLOAPLBJadd a license - [30]
T4FRZSYLdelete an ancient, unused file - [31]
VHQCNMARseveral more modules - [32]
AVTNUQYRbasic test-enabled framework - [33]
KMSL74GAsupport selections in the source editor - [34]
VBU5YHLRMerge lines.love - [35]
D4FEFHQCflesh out Readme - [36]
66X36NZNa little more prose describing manual_tests - [37]
TVCPXAAUrename - [38]
E5FYDACSa likely source of issues - [39]
OTIBCAUJlove2d scaffold - [40]
R5QXEHUIsomebody stop me - [41]
FS2ITYYHrecord a known issue - [42]
ETXNVRPTMerge lines.love - [43]
VP5KC4XZMerge lines.love - [44]
32V6ZHQBMerge lines.love - [45]
2CTN2IEFMerge lines.love - [46]
CE4LZV4Tdrop last couple of manual tests - [47]
RPGTBMMMMerge lines.love - [48]
OGUV4HSAremove some memory leaks from rendered fragments - [49]
HAZLW5K7Merge text.love - [50]
BH7BT36Lctrl+a: select entire buffer - [51]
3PSFWAILMerge lines.love
Change contents
- file deletion: source_edit.lua source_edit.lua
elseif chord == 'C-a' thenState.selection1 = {line=1, pos=1}State.cursor1 = {line=#State.lines, pos=utf8.len(State.lines[#State.lines].data)+1, posB=nil}elseif chord == 'C-c' thenlocal s = Text.selection(State)if s thenApp.setClipboardText(s)endelseif chord == 'C-x' thenfor _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scrolllocal s = Text.cut_selection(State, State.left, State.right)if s thenApp.setClipboardText(s)endschedule_save(State)elseif chord == 'C-v' thenfor _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scroll-- 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 = State.cursor1.linelocal before = snapshot(State, before_line)local clipboard_data = App.getClipboardText()for _,code in utf8.codes(clipboard_data) dolocal c = utf8.char(code)if c == '\n' thenText.insert_return(State)elseText.insert_at_cursor(State, c)endendif Text.cursor_out_of_screen(State) thenText.snap_cursor_to_bottom_of_screen(State, State.left, State.right)endschedule_save(State)record_undo_event(State, {before=before, after=snapshot(State, before_line, State.cursor1.line)})chord ~= 'C-a' and chord ~= 'C-c' and chord ~= 'C-x' and chord ~= 'backspace' and backspace ~= 'delete' and not App.is_cursor_movement(chord) thenText.delete_selection(State, State.left, State.right)end - file deletion: colorize.lua colorize.lua
if edge.suffix and rfind(frag, edge.suffix, nil, --[[plain]] true) == #frag - #edge.suffix + 1 thenCurrent_state = edge.targetbreakendendendfunction trim(s)return s:gsub('^%s+', ''):gsub('%s+$', '')endfunction ltrim(s)return s:gsub('^%s+', '')endfunction rtrim(s)return s:gsub('%s+$', '')enddstring=String_color,block_string=String_color,block_comment=Comment_color,}Current_state = 'normal'function initialize_color()--? print('new line')Current_state = 'normal'endfunction select_color(frag)--? print('before', '^'..frag..'$', Current_state)switch_color_based_on_prefix(frag)--? print('using color', Current_state, Colors[Current_state])App.color(Colors[Current_state])switch_color_based_on_suffix(frag)--? print('state after suffix', Current_state)endfunction switch_color_based_on_prefix(frag)if Next_state[Current_state] == nil thenreturnendfrag = rtrim(frag)for _,edge in pairs(Next_state[Current_state]) doif edge.prefix and find(frag, edge.prefix, nil, --[[plain]] true) == 1 thenCurrent_state = edge.targetbreakendendendfunction switch_color_based_on_suffix(frag)if Next_state[Current_state] == nil thenreturnendfrag = rtrim(frag)for _,edge in pairs(Next_state[Current_state]) docomment=Comment_color,sstring=String_color,Comment_color = {r=0, g=0, b=1}String_color = {r=0, g=0.5, b=0.5}Divider_color = {r=0.7, g=0.7, b=0.7}Colors = {normal=Text_color,block_string={{suffix=']]', target='normal'},},block_comment={{suffix=']]', target='normal'},},-- comments are a sink}{prefix='[[', target='block_string'}, -- only single line for now},dstring={{suffix='"', target='normal'},},sstring={{suffix="'", target='normal'},},{prefix='--[[', target='block_comment'}, -- only single-line for now{prefix='--', target='comment'},{prefix='"', target='dstring'},{prefix="'", target='sstring'}, - resurrect zombie in README.md at line 33
* mouse drag or `shift` + movement to select text, `ctrl+a` to select all