Merge lines.love
[?]
Jul 31, 2023, 5:26 PM
KWHC65JIQZP77ZVU2YUF7M7MFZ7OWO3GPGOXJ6Q7JIZPXVVQLKAQCDependencies
- [2]
ONHKBLLCMerge lines.love - [3]
BMGHJX7Gbugfix: search highlight straddling screen lines - [4]
66X36NZNa little more prose describing manual_tests - [5]
73OCE2MCafter much struggle, a brute-force undo - [6]
RU4HIK43Merge lines.love - [7]
OGUV4HSAremove some memory leaks from rendered fragments - [8]
D4B52CQ2Merge lines.love - [9]
CE4LZV4Tdrop last couple of manual tests - [10]
B6DS4GZCMerge lines.love - [11]
JOPVPUSAediting source code from within the app - [12]
ZE7LVQNEimprove a comment - [13]
3QNOKBFMbeginnings of a test harness - [14]
FZBXBUFFbugfix: search - [15]
JDZVBFEIMerge lines.love - [16]
KB7KTSCPMerge lines.love - [17]
LWPFEZBIMerge lines.love - [18]
XX7G2FFJintermingle freehand line drawings with text - [19]
TVCPXAAUrename - [20]
UBA2ZUCPremove a duplicate print to screen - [21]
T4FRZSYLdelete an ancient, unused file - [22]
FS2ITYYHrecord a known issue - [23]
2344TV56Merge lines.love - [24]
GZ5WULJVswitch source side to new screen-line-based render - [25]
N2NUGNN4include a brief reference enabling many useful apps - [26]
LXTTOB33extract a couple of files - [27]
I64IPGJXavoid saving fragments in lines - [28]
SGMA5JLEsave the list of tests in repo - [29]
TLOAPLBJadd a license - [30]
VP5KC4XZMerge lines.love - [31]
ZPQI5UL3bugfix: never use utf8 pos in string.sub - [32]
BLWAYPKVextract a module - [33]
IAWCZRFUextract a variable - [34]
VXORMHMEdelete experimental REPL - [35]
4YDBYBA4clean up memory leak experiments - [36]
6LJZN727handle chords - [37]
TWXPV2AChoist and duplicate a conditional - [38]
Z4XRNDTRfind text - [39]
K74U4BAUMerge lines.love - [40]
KWIVKQQ7Merge lines.love - [41]
SDEY7LFJrename a variable - [42]
BJ5X5O4Alet's prevent the text cursor from ever getting on a drawing - [43]
D2GCFTTTclean up repl functionality - [44]
KMSL74GAsupport selections in the source editor - [45]
2L5MEZV3experiment: new edit namespace - [46]
C2M4RUU5reorganize some comments - [47]
R5QXEHUIsomebody stop me - [48]
VHQCNMARseveral more modules - [49]
2CTN2IEFMerge lines.love - [50]
RSZD5A7Gforgot to add json.lua - [51]
IM7UEBMKbugfix: highlight search patterns on the right line - [52]
AVTNUQYRbasic test-enabled framework - [53]
KKMFQDR4editing source code from within the app - [54]
K2X6G75Zstart writing some tests for drawings - [55]
3PSFWAILMerge lines.love - [56]
OTIBCAUJlove2d scaffold - [57]
HALS7E5Umore clearly skip prints before screen top - [58]
JYZKEDDGMerge lines.love - [59]
2TQUKHBCMerge lines.love - [60]
ORKN6EOBMerge lines.love - [61]
MD3W5IRAnew fork: rip out drawing support - [62]
VHUNJHXBMerge lines.love - [63]
MUJTM6REbring back a level of wrapping - [64]
ZLJYLPOTMerge lines.love - [65]
4SR3Z4Y3document the version of LÖVE I've been using - [66]
BULPIBEGbeginnings of a module for the text editor
Change contents
- file deletion: source_text.lua source_text.lua
end-- render colorized textlocal x = State.leftfor frag in screen_line:gmatch('%S*%s*') doselect_color(frag)App.screen.print(frag, x,y)x = x+App.width(frag)end-- render search highlight or cursorif State.search_term thenendelseif Focus == 'edit' thenif pos <= State.cursor1.pos and pos + frag_len > State.cursor1.pos thenText.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)elseif pos + frag_len == State.cursor1.pos then-- Show cursor at end of line.-- This place also catches end of wrapping screen lines. That doesn't seem worth distinguishing.-- It seems useful to see a cursor whether your eye is on the left or right margin.Text.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)local data = State.lines[State.cursor1.line].datalocal cursor_offset = Text.offset(data, State.cursor1.pos)if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term thenlocal save_selection = State.selection1State.selection1 = {line=line_index, pos=State.cursor1.pos+utf8.len(State.search_term)}local lo, hi = Text.clip_selection(State, line_index, pos, pos+frag_len)Text.draw_highlight(State, line, State.left,y, pos, lo,hi)State.selection1 = save_selection - edit in text.lua at line 33[4.106]→[4.741:887](∅→∅),[4.237]→[4.741:887](∅→∅),[4.608]→[4.741:887](∅→∅),[4.237]→[4.741:887](∅→∅),[4.237]→[4.741:887](∅→∅),[4.608]→[4.741:887](∅→∅)
local lo_px = Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term)) - replacement in source_text.lua at line 27
-- render any link decorations-- render any highlights - edit in source_text.lua at line 29
-- render link decorations - edit in source_text.lua at line 43
-- render fragment - edit in source_text.lua at line 47
if not hide_cursor and line_index == State.cursor1.line then-- render search highlight or cursorif State.search_term thenlocal data = State.lines[State.cursor1.line].datalocal cursor_offset = Text.offset(data, State.cursor1.pos)if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term thenlocal save_selection = State.selection1State.selection1 = {line=line_index, pos=State.cursor1.pos+utf8.len(State.search_term)}local lo, hi = Text.clip_selection(State, line_index, pos, pos+frag_len)Text.draw_highlight(State, line, State.left,y, pos, lo,hi)State.selection1 = save_selectionendelseif Focus == 'edit' thenif pos <= State.cursor1.pos and pos + frag_len > State.cursor1.pos thenText.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)elseif pos + frag_len == State.cursor1.pos then-- Show cursor at end of line.-- This place also catches end of wrapping screen lines. That doesn't seem worth distinguishing.-- It seems useful to see a cursor whether your eye is on the left or right margin.Text.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)endendend - edit in source_text.lua at line 77[4.449]→[4.88290:88326](∅→∅),[4.848]→[4.88290:88326](∅→∅),[4.1390]→[4.88290:88326](∅→∅),[4.88290]→[4.88290:88326](∅→∅),[4.88326]→[4.1391:1539](∅→∅),[4.1539]→[4.88475:88511](∅→∅),[4.88475]→[4.88475:88511](∅→∅),[4.88511]→[4.7:241](∅→∅),[4.241]→[4.1540:1686](∅→∅),[4.88661]→[4.1540:1686](∅→∅),[4.1686]→[4.88798:88834](∅→∅),[4.88798]→[4.88798:88834](∅→∅),[4.88834]→[4.1687:1760](∅→∅),[4.1760]→[4.88898:88952](∅→∅),[4.88898]→[4.88898:88952](∅→∅),[4.88952]→[4.450:546](∅→∅),[4.546]→[4.89066:89102](∅→∅),[4.1847]→[4.89066:89102](∅→∅),[4.89066]→[4.89066:89102](∅→∅)
-- render cursor if necessaryif not hide_cursor and line_index == State.cursor1.line thenif pos <= State.cursor1.pos and pos + frag_len >= State.cursor1.pos thenif State.search_term thenlocal data = State.lines[State.cursor1.line].datalocal cursor_offset = Text.offset(data, State.cursor1.pos)if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term thenlocal lo_px = Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term))App.color(Text_color)love.graphics.print(State.search_term, State.left+lo_px,y)endelseif Focus == 'edit' thenText.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)endendend