aggregate global state inside a 'pane' object

akkartik
Nov 19, 2023, 9:15 PM
VAVXKWZVOFJGWHCWYLTPDKSKKMSJEBKXNKXUW3T6IZAC3HE6HOIQC

Dependencies

  • [2] 6RYGW5H3 bugfix: output border color
  • [3] Z5M23NTK implement second, 'output' editor
  • [4] KMSL74GA support selections in the source editor
  • [5] MZ3DMYPD start sketching out a scrollbar
  • [6] QD4LOFQR Merge text.love
  • [7] 57HKHZ7Z include the tool that's mentioned in representation.md
  • [8] RU4HIK43 Merge lines.love
  • [9] 6LJZN727 handle chords
  • [10] LXTTOB33 extract a couple of files
  • [11] JOPVPUSA editing source code from within the app
  • [12] OL7ZCZWD Merge text.love
  • [13] BLWAYPKV extract a module
  • [14] 36Z442IV back to commit 8123959e52f without code editing
  • [15] 2DVVKKVA flesh out Readme
  • [16] TBTRYEBP Merge lines.love
  • [17] PJ5PQAQE record support for multiple versions
  • [18] 34BZ5ZKN Merge lines.love
  • [19] 66X36NZN a little more prose describing manual_tests
  • [20] N2NUGNN4 include a brief reference enabling many useful apps
  • [21] VEAVIL4X resize handler
  • [22] RSZD5A7G forgot to add json.lua
  • [23] TLOAPLBJ add a license
  • [24] D43U7GQ4 alter on-disk representation (manifest files)
  • [25] BULPIBEG beginnings of a module for the text editor
  • [26] 4SR3Z4Y3 document the version of LÖVE I've been using
  • [27] ORKN6EOB Merge lines.love
  • [28] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing
  • [29] SGMA5JLE save the list of tests in repo
  • [30] K2X6G75Z start writing some tests for drawings
  • [31] WR2WMEPE implement 'Run' button
  • [32] OTIBCAUJ love2d scaffold
  • [33] ZM7NOBRM new fork: carousel shell
  • [34] 73OCE2MC after much struggle, a brute-force undo
  • [35] XX7G2FFJ intermingle freehand line drawings with text
  • [36] 3PSFWAIL Merge lines.love
  • [37] FM5LDKGT Merge text.love
  • [38] 6VJTQKW7 start supporting LÖVE v12
  • [39] SW5GN5LP suggest a default layout for freewheeling apps
  • [40] YF2ATH2Q Merge lines.love
  • [41] AVTNUQYR basic test-enabled framework
  • [42] Q6RXCILQ Merge text.love
  • [43] ED4Z6ORC cleaner API for file-system access
  • [44] D2GCFTTT clean up repl functionality
  • [45] IP4LD33D mouse events for scrollbar
  • [46] 2L5MEZV3 experiment: new edit namespace
  • [47] TVCPXAAU rename
  • [48] VXORMHME delete experimental REPL
  • [49] VHQCNMAR several more modules
  • [50] ZLJYLPOT Merge lines.love
  • [51] VXRYVZ74 Merge text.love
  • [52] 3QNOKBFM beginnings of a test harness
  • [53] VP5KC4XZ Merge lines.love
  • [54] VHUNJHXB Merge lines.love
  • [55] EZHO4TSW new file-system format for freewheeling apps
  • [56] 5RUFNRJO start of the visual skeleton
  • [57] VLTU33KW resolve conflicts
  • [58] KKQKPGCI resolve conflicts
  • [59] CE4LZV4T drop last couple of manual tests
  • [60] R5QXEHUI somebody stop me
  • [61] ICS45BIL editor widget now takes a bottom margin
  • [62] KKMFQDR4 editing source code from within the app
  • [63] 4YDBYBA4 clean up memory leak experiments
  • [64] UEG224LH debug animations
  • [65] FS2ITYYH record a known issue
  • [66] LRDM35CE app running again
  • [67] LWPFEZBI Merge lines.love
  • [68] M5JXTW56 Merge text.love
  • [69] PRE6XPRN responsively increase/decrease font height
  • [70] T4FRZSYL delete an ancient, unused file
  • [71] OGUV4HSA remove some memory leaks from rendered fragments
  • [72] CZQ3NJ4N Merge text0
  • [73] 5OVKHVY6 nice way to make on.* handlers more discoverable
  • [74] 2CFLXLIE Merge text.love
  • [75] D2TYFYG2 Merge text.love
  • [76] CAG7PP5Y Merge text.love
  • [77] TEDSEOCW send editor clicks to the left of the scrollbar

Change contents

  • file deletion: 0044-Output_editor_state (----------)
    [4.2][3.0:48](),[3.48][3.49:49]()
    Output_editor_state = nil
  • file deletion: 0041-Canvas (----------)
    [4.2][4.425:460](),[4.460][4.461:461]()
    Canvas = nil
  • file deletion: 0009-Editor_state (----------)
    [4.2][4.3537:3578](),[4.3578][4.3517:3517]()
    Editor_state = nil
  • file addition: 0046-Global_state (----------)
    [4.2]
    Global_state = {}
  • file addition: 0045-Current_pane (----------)
    [4.2]
    Current_pane = {
    canvas = nil,
    editor_state = nil,
    output_editor_state = nil,
    }
  • replacement in 0042-draw_canvas at line 2
    [4.230][4.230:264]()
    if Canvas == nil then return end
    [4.230]
    [4.264]
    if Current_pane.canvas == nil then return end
  • replacement in 0042-draw_canvas at line 5
    [4.351][4.351:384]()
    love.graphics.draw(Canvas, 0,0)
    [4.351]
    [4.384]
    love.graphics.draw(Current_pane.canvas, 0,0)
  • replacement in 0032-update_font_settings at line 7
    [4.351][4.351:662]()
    Editor_state.top = Menu_bottom + 20
    Editor_state.left = Menu_left + 50 + Line_number_padding
    Editor_state.right = math.min(100+30*App.width('m'), Safe_width*2/3)
    Editor_state.width = Editor_state.right - Editor_state.left
    edit.update_font_settings(Editor_state, font_height)
    Text.redraw_all(Editor_state)
    [4.351]
    [4.662]
    Current_pane.editor_state.top = Menu_bottom + 20
    Current_pane.editor_state.left = Menu_left + 50 + Line_number_padding
    Current_pane.editor_state.right = math.min(100+30*App.width('m'), Safe_width*2/3)
    Current_pane.editor_state.width = Current_pane.editor_state.right - Current_pane.editor_state.left
    edit.update_font_settings(Current_pane.editor_state, font_height)
    Text.redraw_all(Current_pane.editor_state)
  • replacement in 0031-on.resize at line 3
    [4.84][4.84:215](),[4.215][4.666:705](),[4.705][4.215:246](),[4.215][4.215:246](),[4.246][3.1379:1575]()
    Editor_state.right = math.min(100+30*App.width('m'), Safe_width*2/3)
    Editor_state.width = Editor_state.right - Editor_state.left
    Editor_state.bottom = Safe_height/2-5
    Text.redraw_all(Editor_state)
    Output_editor_state.top = Editor_state.bottom+5+10+5
    Output_editor_state.right = Editor_state.right
    Output_editor_state.width = Editor_state.width
    Output_editor_state.bottom = Safe_height - 5
    [4.84]
    [4.246]
    Current_pane.editor_state.right = math.min(100+30*App.width('m'), Safe_width*2/3)
    Current_pane.editor_state.width = Current_pane.editor_state.right - Current_pane.editor_state.left
    Current_pane.editor_state.bottom = Safe_height/2-5
    Text.redraw_all(Current_pane.editor_state)
    Current_pane.output_editor_state.top = Current_pane.editor_state.bottom+5+10+5
    Current_pane.output_editor_state.right = Current_pane.editor_state.right
    Current_pane.output_editor_state.width = Current_pane.editor_state.width
    Current_pane.output_editor_state.bottom = Safe_height - 5
  • replacement in 0028-draw_output_border at line 4
    [4.91][4.91:213]()
    local x1 = Editor_state.left-5-Line_number_padding
    local x2 = Editor_state.right+5
    local y1 = Editor_state.bottom+5+10
    [4.91]
    [4.213]
    local x1 = Current_pane.editor_state.left-5-Line_number_padding
    local x2 = Current_pane.editor_state.right+5
    local y1 = Current_pane.editor_state.bottom+5+10
  • replacement in 0021-draw_menu at line 5
    [4.763][4.763:886]()
    button(Editor_state, 'run', {x=Menu_left+5, y=Menu_top+5, w=App.width('Run')+10, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
    [4.763]
    [4.948]
    button(Global_state, 'run', {x=Menu_left+5, y=Menu_top+5, w=App.width('Run')+10, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
  • replacement in 0021-draw_menu at line 13
    [4.1085][4.475:644]()
    local buf = table.concat(map(Editor_state.lines, function(line) return line.data end), '\n')
    Canvas = love.graphics.newCanvas()
    love.graphics.setCanvas(Canvas)
    [4.1085]
    [4.644]
    local buf = table.concat(map(Current_pane.editor_state.lines, function(line) return line.data end), '\n')
    Current_pane.canvas = love.graphics.newCanvas()
    love.graphics.setCanvas(Current_pane.canvas)
  • replacement in 0021-draw_menu at line 23
    [3.1658][3.1658:1692]()
    Output_editor_state.lines = {
    [3.1658]
    [3.1692]
    Current_pane.output_editor_state.lines = {
  • replacement in 0021-draw_menu at line 26
    [3.1728][3.1728:1769]()
    Text.redraw_all(Output_editor_state)
    [3.1728]
    [4.830]
    Text.redraw_all(Current_pane.output_editor_state)
  • replacement in 0021-draw_menu at line 34
    [4.1019][4.1019:1138]()
    button(Editor_state, 'settings', {x=Safe_width-w-10-5, y=Menu_top+5, w=w+10, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
    [4.1019]
    [4.1138]
    button(Global_state, 'settings', {x=Safe_width-w-10-5, y=Menu_top+5, w=w+10, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
  • replacement in 0021-draw_menu at line 45
    [4.1372][4.1372:1493]()
    button(Editor_state, 'left', {x=0, y=Menu_bottom, w=Menu_left+30, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2},
    [4.1372]
    [4.1493]
    button(Global_state, 'left', {x=0, y=Menu_bottom, w=Menu_left+30, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2},
  • replacement in 0021-draw_menu at line 52
    [4.1734][4.1734:1849]()
    button(Editor_state, 'left', {x=r-30, y=Menu_bottom, w=100, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2},
    [4.1734]
    [4.1849]
    button(Global_state, 'left', {x=r-30, y=Menu_bottom, w=100, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2},
  • replacement in 0020-draw_editor_border at line 3
    [2.220][4.1173:1323](),[4.1173][4.1173:1323]()
    local x1 = Editor_state.left-5-Line_number_padding
    local y1 = Editor_state.top-5
    local x2 = Editor_state.right+5
    local y2 = Editor_state.bottom+5
    [2.220]
    [4.1323]
    local x1 = Current_pane.editor_state.left-5-Line_number_padding
    local y1 = Current_pane.editor_state.top-5
    local x2 = Current_pane.editor_state.right+5
    local y2 = Current_pane.editor_state.bottom+5
  • replacement in 0017-on.mouse_release at line 2
    [4.2259][3.1770:1972](),[3.1972][4.47:133](),[4.1356][4.47:133](),[4.133][4.1362:1416](),[4.1362][4.1362:1416](),[4.1416][3.1973:2171]()
    if Editor_state.scrollbar_drag then
    adjust_scrollbar(Editor_state, y)
    Editor_state.scrollbar_drag = nil
    elseif on_editor_scrollbar_area(Editor_state, x,y) then
    adjust_scrollbar(Editor_state, y)
    elseif x < Editor_state.right + 15 - 5 and y < Editor_state.bottom + 5 + 10 - 5 then
    edit.mouse_release(Editor_state, x,y, mouse_button)
    elseif Output_editor_state.scrollbar_drag then
    adjust_scrollbar(Output_editor_state, y)
    elseif on_editor_scrollbar_area(Output_editor_state, x,y) then
    adjust_scrollbar(Output_editor_state, y)
    [4.2259]
    [4.1416]
    if Current_pane.editor_state.scrollbar_drag then
    adjust_scrollbar(Current_pane.editor_state, y)
    Current_pane.editor_state.scrollbar_drag = nil
    elseif on_editor_scrollbar_area(Current_pane.editor_state, x,y) then
    adjust_scrollbar(Current_pane.editor_state, y)
    elseif x < Current_pane.editor_state.right + 15 - 5 and y < Current_pane.editor_state.bottom + 5 + 10 - 5 then
    edit.mouse_release(Current_pane.editor_state, x,y, mouse_button)
    elseif Current_pane.output_editor_state.scrollbar_drag then
    adjust_scrollbar(Current_pane.output_editor_state, y)
    elseif on_editor_scrollbar_area(Current_pane.output_editor_state, x,y) then
    adjust_scrollbar(Current_pane.output_editor_state, y)
  • replacement in 0016-on.mouse_press at line 2
    [4.2409][4.1654:1739]()
    if mouse_press_consumed_by_any_button_handler(Editor_state, x,y, mouse_button) then
    [4.2409]
    [4.1739]
    if mouse_press_consumed_by_any_button_handler(Global_state, x,y, mouse_button) then
  • replacement in 0016-on.mouse_press at line 5
    [4.1753][3.2172:2314]()
    if on_editor_scrollbar(Editor_state, x,y) then
    Editor_state.scrollbar_drag = true
    elseif on_editor_scrollbar_area(Editor_state, x,y) then
    [4.1753]
    [4.1530]
    if on_editor_scrollbar(Current_pane.editor_state, x,y) then
    Current_pane.editor_state.scrollbar_drag = true
    elseif on_editor_scrollbar_area(Current_pane.editor_state, x,y) then
  • replacement in 0016-on.mouse_press at line 9
    [4.1543][4.135:221](),[4.221][4.1549:1601](),[4.1549][4.1549:1601](),[4.1601][3.2315:2482]()
    elseif x < Editor_state.right + 15 - 5 and y < Editor_state.bottom + 5 + 10 - 5 then
    edit.mouse_press(Editor_state, x,y, mouse_button)
    elseif on_editor_scrollbar(Output_editor_state, x,y) then
    Output_editor_state.scrollbar_drag = true
    elseif on_editor_scrollbar_area(Output_editor_state, x,y) then
    [4.1543]
    [3.2482]
    elseif x < Current_pane.editor_state.right + 15 - 5 and y < Current_pane.editor_state.bottom + 5 + 10 - 5 then
    edit.mouse_press(Current_pane.editor_state, x,y, mouse_button)
    elseif on_editor_scrollbar(Current_pane.output_editor_state, x,y) then
    Current_pane.output_editor_state.scrollbar_drag = true
    elseif on_editor_scrollbar_area(Current_pane.output_editor_state, x,y) then
  • replacement in 0015-on.key_release at line 2
    [4.2551][4.2551:2598]()
    edit.key_release(Editor_state, key, scancode)
    [4.2551]
    [4.2598]
    edit.key_release(Current_pane.editor_state, key, scancode)
  • replacement in 0014-on.text_input at line 2
    [4.2676][4.2676:2710]()
    edit.text_input(Editor_state, t)
    [4.2676]
    [4.2710]
    edit.text_input(Current_pane.editor_state, t)
  • replacement in 0013-on.keychord_press at line 3
    [4.2059][4.2059:2110]()
    update_font_settings(Editor_state.font_height+2)
    [4.2059]
    [4.2110]
    update_font_settings(Current_pane.editor_state.font_height+2)
  • replacement in 0013-on.keychord_press at line 5
    [4.2138][4.2138:2189]()
    update_font_settings(Editor_state.font_height-2)
    [4.2138]
    [4.2189]
    update_font_settings(Current_pane.editor_state.font_height-2)
  • replacement in 0013-on.keychord_press at line 9
    [4.2250][4.2250:2298]()
    edit.keychord_press(Editor_state, chord, key)
    [4.2250]
    [4.2298]
    edit.keychord_press(Current_pane.editor_state, chord, key)
  • replacement in 0013-on.keychord_press at line 11
    [4.2303][4.3111:3115]()
    end
    [4.2303]
    end
  • replacement in 0012-on.draw at line 2
    [4.2921][4.1758:1793]()
    Editor_state.button_handlers = {}
    [4.2921]
    [4.890]
    Global_state.button_handlers = {}
  • replacement in 0012-on.draw at line 7
    [4.1924][4.3008:3033](),[4.3008][4.3008:3033](),[4.3033][4.3116:3146]()
    edit.draw(Editor_state)
    draw_scrollbar(Editor_state)
    [4.1924]
    [4.1925]
    edit.draw(Current_pane.editor_state)
    draw_scrollbar(Current_pane.editor_state)
  • replacement in 0012-on.draw at line 10
    [4.1947][3.2496:2603]()
    edit.draw(Output_editor_state, Normal_color, --[[hide cursor]] true)
    draw_scrollbar(Output_editor_state)
    [4.1947]
    [4.1947]
    edit.draw(Current_pane.output_editor_state, Normal_color, --[[hide cursor]] true)
    draw_scrollbar(Current_pane.output_editor_state)
  • replacement in 0011-on.initialize at line 8
    [4.2084][4.2084:2123]()
    Editor_state = edit.initialize_state(
    [4.2084]
    [4.522]
    Current_pane.editor_state = edit.initialize_state(
  • replacement in 0011-on.initialize at line 14
    [4.800][4.3379:3410](),[4.2276][4.3379:3410](),[4.3379][4.3379:3410](),[4.3410][3.2604:2688]()
    Text.redraw_all(Editor_state)
    Output_editor_state = edit.initialize_state(
    Editor_state.bottom+5+10+5, -- top
    [4.2276]
    [3.2688]
    Text.redraw_all(Current_pane.editor_state)
    Current_pane.output_editor_state = edit.initialize_state(
    Current_pane.editor_state.bottom+5+10+5, -- top
  • replacement in 0011-on.initialize at line 18
    [3.2706][3.2706:2747]()
    Editor_state.left, Editor_state.right,
    [3.2706]
    [3.2747]
    Current_pane.editor_state.left, Current_pane.editor_state.right,
  • replacement in 0011-on.initialize at line 20
    [3.2799][3.2799:2837]()
    Text.redraw_all(Output_editor_state)
    [3.2799]
    [4.2277]
    Text.redraw_all(Current_pane.output_editor_state)
  • replacement in 0004-on.update at line 3
    [4.1760][3.2838:3026]()
    if Editor_state.scrollbar_drag then
    adjust_scrollbar(Editor_state, App.mouse_y())
    elseif Output_editor_state.scrollbar_drag then
    adjust_scrollbar(Output_editor_state, App.mouse_y())
    [4.1760]
    [4.1672]
    if Current_pane.editor_state.scrollbar_drag then
    adjust_scrollbar(Current_pane.editor_state, App.mouse_y())
    elseif Current_pane.output_editor_state.scrollbar_drag then
    adjust_scrollbar(Current_pane.output_editor_state, App.mouse_y())