Merge text.love
[?]
Sep 16, 2023, 7:11 AM
M5JXTW56XOOHCPAXPRERPQHHJUNTLGYTDIKTRGQZVW2HVIBKSI5QCDependencies
- [2]
RIAFJLMZMerge text.love - [3]
R2ASHK5Cfix a bad merge - [4]
73OCE2MCafter much struggle, a brute-force undo - [5]
OGUV4HSAremove some memory leaks from rendered fragments - [6]
QXVD2RIFadd state arg to Drawing.mouse_released - [7]
JCXL74WVbring back everything from commit a68647ae22 - [8]
HYEAFRZ2split mouse_pressed events between Text and Drawing - [9]
3QNOKBFMbeginnings of a test harness - [10]
2L5MEZV3experiment: new edit namespace - [11]
VHUNJHXBMerge lines.love - [12]
VBU5YHLRMerge lines.love - [13]
JOPVPUSAediting source code from within the app - [14]
K74U4BAUMerge lines.love - [15]
3G723RV5Merge text.love - [16]
LYN3L74Wcorrect commit f3abc2cbf2 - [17]
K2X6G75Zstart writing some tests for drawings - [18]
SPNMXTYRhave file API operate on state object - [19]
MD3W5IRAnew fork: rip out drawing support - [20]
UAYCSFSKMerge text.love - [21]
AF253GHLbugfix - [22]
FS2ITYYHrecord a known issue - [23]
CE4LZV4Tdrop last couple of manual tests - [24]
KWIVKQQ7Merge lines.love - [25]
LWPFEZBIMerge lines.love - [26]
RU4HIK43Merge lines.love - [27]
MGJZHZC4Merge lines.love - [28]
34BZ5ZKNMerge lines.love - [29]
IGBTDA6YMerge text.love - [30]
RSZD5A7Gforgot to add json.lua - [31]
R56CKHYZMerge text.love - [32]
2WGHUWE6self-documenting 0 Test_right_margin - [33]
NVSC4N4Kchange a helper slightly - [34]
2CK5QI7Wmake love event names consistent - [35]
FM5LDKGTMerge text.love - [36]
YDUIKWSFMerge text.love - [37]
ONHKBLLCMerge lines.love - [38]
2JLMNZZIMerge text.love - [39]
XX7G2FFJintermingle freehand line drawings with text - [40]
Y5XAFGMWMerge text.love - [41]
2CFLXLIEMerge text.love - [42]
3XNFQDDNMerge lines.love - [43]
VXORMHMEdelete experimental REPL - [44]
AYX33NBCMerge lines.love - [45]
4YDBYBA4clean up memory leak experiments - [46]
AVTNUQYRbasic test-enabled framework - [47]
KKMFQDR4editing source code from within the app - [48]
VOU73AK6Merge lines.love - [49]
VP5KC4XZMerge lines.love - [50]
AKZWDWIAMerge lines.love - [51]
ED4Z6ORCcleaner API for file-system access - [52]
WB6SIB7HMerge lines.love - [53]
RO35V4H4Merge text.love - [54]
2CTN2IEFMerge lines.love - [55]
ZLJYLPOTMerge lines.love - [56]
2TQUKHBCMerge lines.love - [57]
VXRYVZ74Merge text.love - [58]
LXTTOB33extract a couple of files - [59]
7VGDIPLCmore robust state validation - [60]
QD4LOFQRMerge text.love - [61]
N2NUGNN4include a brief reference enabling many useful apps - [62]
B6DS4GZCMerge lines.love - [63]
T4FRZSYLdelete an ancient, unused file - [64]
VHQCNMARseveral more modules - [65]
PJEQCTBLadd state arg to Drawing.update - [66]
PJ5PQAQErecord support for multiple versions - [67]
TLOAPLBJadd a license - [68]
6LJZN727handle chords - [69]
BLWAYPKVextract a module - [70]
KYNGDE2Cconsistent names in a few more places - [71]
BULPIBEGbeginnings of a module for the text editor - [72]
OI4FPFINsupport drawings in the source editor - [73]
APX2PY6Gstop tracking wallclock time - [74]
JRETETTLMerge lines.love - [75]
4SR3Z4Y3document the version of LÖVE I've been using - [76]
36Z442IVback to commit 8123959e52f without code editing - [77]
3PSFWAILMerge lines.love - [78]
U3MJNFUYMerge lines.love - [79]
JZR3QMTNMerge lines.love - [80]
2344TV56Merge lines.love - [81]
C3GUE45IMerge text.love - [82]
SW7BSBMJseveral bugfixes in saving/loading cursor position - [83]
REAIVN7WMerge lines.love - [84]
Q6RXCILQMerge text.love - [85]
ORKN6EOBMerge lines.love - [86]
SGMA5JLEsave the list of tests in repo - [87]
66X36NZNa little more prose describing manual_tests - [88]
X43ZIKR3Merge text.love - [89]
LXFHXL2NMerge text.love - [90]
KMSL74GAsupport selections in the source editor - [91]
H6QZ7GRRmore precise name - [92]
3OTESDW6move drawing.starty into line cache - [93]
BJ5X5O4Alet's prevent the text cursor from ever getting on a drawing - [94]
D2GCFTTTclean up repl functionality - [95]
TVCPXAAUrename - [96]
APYPFFS3call edit rather than App callbacks in tests - [97]
LNUHQOGHstart passing in Editor_state explicitly - [98]
4U4VQWNYMerge lines.love - [99]
ATQO62TFMerge lines.love - [100]
CNCYMM6Amake test initializations a little more obvious - [101]
R5QXEHUIsomebody stop me - [102]
D4B52CQ2Merge lines.love - [103]
OTIBCAUJlove2d scaffold
Change contents
- file deletion: drawing.lua drawing.lua
function Drawing.mouse_release(State, x,y, mouse_button)if line_cache.starty == nil then-- some event cleared starty just this frame-- draw in this frame will soon set starty-- just skip this framereturnendassert(drawing.mode == 'drawing')local pmx, pmy = App.mouse_x(), App.mouse_y()local mx = Drawing.coord(pmx-State.left, State.width)local my = Drawing.coord(pmy-line_cache.starty, State.width)if App.mouse_down(1) thenif Drawing.in_drawing(drawing, line_cache, pmx,pmy, State.left,State.right) thenif drawing.pending.mode == 'freehand' thentable.insert(drawing.pending.points, {x=mx, y=my})elseif drawing.pending.mode == 'move' thendrawing.pending.target_point.x = mxdrawing.pending.target_point.y = myDrawing.relax_constraints(drawing, drawing.pending.target_point_index)endendelseif State.current_drawing_mode == 'move' thenif Drawing.in_drawing(drawing, line_cache, pmx, pmy, State.left,State.right) thendrawing.pending.target_point.x = mxdrawing.pending.target_point.y = myDrawing.relax_constraints(drawing, drawing.pending.target_point_index)endelse-- do nothingendendfunction Drawing.relax_constraints(drawing, p)for _,shape in ipairs(drawing.shapes) doif shape.mode == 'manhattan' thenif shape.p1 == p thenshape.mode = 'line'elseif shape.p2 == p thenshape.mode = 'line'endelseif shape.mode == 'rectangle' or shape.mode == 'square' thenfor _,v in ipairs(shape.vertices) doif v == p thenshape.mode = 'polygon'endendendendendfunction Drawing.mouse_press(State, drawing_index, x,y, mouse_button)love.graphics.circle('line', cx,cy, Drawing.pixels(r, width))elseif shape.mode == 'arc' thenlocal center = drawing.points[shape.center]if mx < 0 or mx >= 256 or my < 0 or my >= drawing.h thenreturnendshape.end_angle = geom.angle_with_hint(center.x,center.y, mx,my, shape.end_angle)local cx,cy = px(center.x), py(center.y)love.graphics.arc('line', 'open', cx,cy, Drawing.pixels(shape.radius, width), shape.start_angle, shape.end_angle, 360)elseif shape.mode == 'move' then-- nothing pending; changes are immediately committedelseif shape.mode == 'name' then-- nothing pending; changes are immediately committedelseprint(shape.mode)assert(false)endendfunction Drawing.in_drawing(drawing, line_cache, x,y, left,right)if line_cache.starty == nil then return false end -- outside current pagelocal width = right-leftreturn y >= line_cache.starty and y < line_cache.starty + Drawing.pixels(drawing.h, width) and x >= left and x < rightendlocal r = round(geom.dist(center.x, center.y, mx, my))local cx,cy = px(center.x), py(center.y) - file deletion: source_text.lua source_text.lua
if show_line_numbers thenApp.color(Line_number_color)love.graphics.print(line_index, State.left-Line_number_width*App.width('m')+10,y)endinitialize_color()function Text.draw(State, line_index, y, startpos, hide_cursor, show_line_numbers)local line = State.lines[line_index]local line_cache = State.line_cache[line_index]line_cache.starty = yline_cache.startpos = startpos - file deletion: source_edit.lua source_edit.lua
edit.put_cursor_on_next_text_line(State)for i=1,math.floor(-dy) doText.down(State)endedit.put_cursor_on_next_text_line(State)for i=1,math.floor(dy) doText.up(State)endelseif dy < 0 thenState.cursor1 = {line=State.screen_bottom1.line, pos=State.screen_bottom1.pos}y, screen_bottom1.pos = Text.draw(State, line_index, y, startpos, hide_cursor, show_line_numbers)--? print('=> y', y)elseif line.mode == 'drawing' theny = y+Drawing_padding_topDrawing.draw(State, line_index, y)y = y + Drawing.pixels(line.h, State.width) + Drawing_padding_bottomelseprint(line.mode)assert(false)local buttonx = State.left-Margin_left+4if show_line_numbers thenbuttonx = 4 -- HACK: position draw buttons at a fixed x on screenendbutton(State, 'draw', {x=buttonx, y=y+4, w=12,h=12, color={1,1,0},icon = icon.insert_drawing,onpress1 = function()Drawing.before = snapshot(State, line_index-1, line_index)table.insert(State.lines, line_index, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}})table.insert(State.line_cache, line_index, {})if State.cursor1.line >= line_index thenState.cursor1.line = State.cursor1.line+1endschedule_save(State)record_undo_event(State, {before=Drawing.before, after=snapshot(State, line_index-1, line_index+1)})end,})function edit.draw(State, hide_cursor, show_line_numbers)State.button_handlers = {}App.color(Text_color)function edit.put_cursor_on_next_text_line(State)while true doif State.cursor1.line >= #State.lines thenbreakendif State.lines[State.cursor1.line].mode == 'text' thenbreakendState.cursor1.line = State.cursor1.line+1State.cursor1.pos = 1endendedit.put_cursor_on_next_text_line(State)endendfunction edit.invalid1(State, loc1)left = math.floor(left), -- left margin for text; line numbers go to the left of thisright = math.floor(right), - file deletion: source.lua source.lua
edit.draw(Editor_state, --[[hide cursor?]] Show_file_navigator, --[[show line numbers]] true)if Show_log_browser_side then-- dividerApp.color(Divider_color)love.graphics.rectangle('fill', App.screen.width/2-1,Menu_status_bar_height, 3,App.screen.height)--love.window.setTitle('text.love - source - '..Editor_state.filename) - file deletion: commands.lua commands.lua
source.switch_to_file(s..'.lua')love.window.setTitle('lines.love - source - '..Editor_state.filename)reset_file_navigator()endfunction move_candidate_to_front(s)local index = array.find(File_navigation.all_candidates, s)assert(index)table.remove(File_navigation.all_candidates, index)table.insert(File_navigation.all_candidates, 1, s)endfunction reset_file_navigator()Show_file_navigator = falseFile_navigation.index = 1File_navigation.filter = ''File_navigation.candidates = File_navigation.all_candidatesend - edit in edit.lua at line 103[4.5600]→[4.4022:4066](∅→∅),[4.5600]→[4.4022:4066](∅→∅),[4.5422]→[4.3999:4021](∅→∅),[4.5422]→[4.3999:4021](∅→∅),[4.5400]→[4.3862:3998](∅→∅),[4.5400]→[4.3862:3998](∅→∅),[4.43]→[4.727:788](∅→∅),[4.43]→[4.727:788](∅→∅),[4.790]→[4.790:795](∅→∅),[4.754]→[4.790:795](∅→∅),[4.790]→[4.790:795](∅→∅),[4.7565]→[4.3689:3861](∅→∅),[4.7565]→[4.3689:3861](∅→∅)
App.screen.width - Test_margin_right,Test_margin_right = 0-- Insulate tests from some key globals so I don't have to change the vast-- majority of tests when they're modified for the real app.if State.next_save and State.next_save < Current_time thenendState.search_backup = {cursor={line=State.cursor1.line, pos=State.cursor1.pos},screen_top={line=State.screen_top1.line, pos=State.screen_top1.pos},}