implement second, 'output' editor

akkartik
Nov 19, 2023, 4:35 AM
Z5M23NTKKGEACSQJT27DRNS7NEK6OSLR2IOWVAH2C2PRAIU46BIQC

Dependencies

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

Change contents

  • file deletion: 0037-Editor_scrollbar_top (----------)
    [5.2][5.579:628](),[5.628][5.629:629]()
    Editor_scrollbar_top = 0 -- in px
    Editor_scrollbar_bottom = 0
  • file addition: 0044-Output_editor_state (----------)
    [5.2]
    Output_editor_state = nil
  • replacement in 0040-on_editor_scrollbar_area at line 1
    [5.55][5.56:97](),[5.97][5.115:207](),[5.207][5.189:274](),[5.189][5.189:274]()
    on_editor_scrollbar_area = function(x,y)
    if x < Editor_state.right+15 then return end
    if x > Editor_state.right+45 then return end
    if y < Editor_state.top then return end
    if y > Editor_state.bottom then return end
    [5.55]
    [5.274]
    on_editor_scrollbar_area = function(state, x,y)
    if x < state.right+15 then return end
    if x > state.right+45 then return end
    if y < state.top then return end
    if y > state.bottom then return end
  • replacement in 0038-on_editor_scrollbar at line 1
    [5.340][5.341:377](),[5.377][5.208:300](),[5.300][5.469:562](),[5.469][5.469:562]()
    on_editor_scrollbar = function(x,y)
    if x < Editor_state.right+15 then return end
    if x > Editor_state.right+45 then return end
    if y < Editor_scrollbar_top then return end
    if y > Editor_scrollbar_bottom then return end
    [5.340]
    [5.562]
    on_editor_scrollbar = function(state, x,y)
    if x < state.right+15 then return end
    if x > state.right+45 then return end
    if y < state.scrollbar_top then return end
    if y > state.scrollbar_bottom then return end
  • replacement in 0036-adjust_scrollbar at line 1
    [5.739][5.740:898]()
    adjust_scrollbar = function(y)
    local s = (y-Editor_state.top) / (Editor_state.bottom-Editor_state.top)
    local screen_line = s*Editor_state.screen_line_count
    [5.739]
    [5.898]
    adjust_scrollbar = function(state, y)
    local s = (y-state.top) / (state.bottom-state.top)
    local screen_line = s*state.screen_line_count
  • replacement in 0036-adjust_scrollbar at line 5
    [5.914][5.914:1021]()
    for i=1,#Editor_state.lines do
    if Editor_state.line_cache[i].start_screen_line_index > screen_line then
    [5.914]
    [5.1021]
    for i=1,#state.lines do
    if state.line_cache[i].start_screen_line_index > screen_line then
  • replacement in 0036-adjust_scrollbar at line 11
    [5.1052][5.1052:1142]()
    Editor_state.screen_top1 = {line=line, pos=1}
    Editor_state.cursor1 = {line=line, pos=1}
    [5.1052]
    [5.1142]
    state.screen_top1 = {line=line, pos=1}
    state.cursor1 = {line=line, pos=1}
  • replacement in 0034-draw_scrollbar at line 1
    [5.2397][5.2398:2438]()
    draw_scrollbar = function(Editor_state)
    [5.2397]
    [5.2438]
    draw_scrollbar = function(state)
  • replacement in 0034-draw_scrollbar at line 3
    [5.2463][5.2463:2991]()
    love.graphics.line(Editor_state.right+30, Editor_state.top, Editor_state.right+30, Editor_state.bottom)
    love.graphics.line(Editor_state.right+25, Editor_state.top, Editor_state.right+35, Editor_state.top)
    love.graphics.line(Editor_state.right+25, Editor_state.bottom, Editor_state.right+35, Editor_state.bottom)
    local sbtop, sbbot = compute_scrollbar(Editor_state)
    local topy = Editor_state.top + sbtop*(Editor_state.bottom - Editor_state.top)
    local boty = Editor_state.top +sbbot*(Editor_state.bottom - Editor_state.top)
    [5.2463]
    [3.0]
    love.graphics.line(state.right+30, state.top, state.right+30, state.bottom)
    love.graphics.line(state.right+25, state.top, state.right+35, state.top)
    love.graphics.line(state.right+25, state.bottom, state.right+35, state.bottom)
    local sbtop, sbbot = compute_scrollbar(state)
    local topy = state.top + sbtop*(state.bottom - state.top)
    local boty = state.top +sbbot*(state.bottom - state.top)
  • replacement in 0034-draw_scrollbar at line 10
    [3.32][5.32:132](),[5.3030][5.32:132](),[5.95][5.1146:1207](),[5.132][5.1146:1207](),[5.378][5.1146:1207](),[5.3107][5.1146:1207]()
    love.graphics.rectangle('fill', Editor_state.right+15, topy+5, 30, math.max(boty-topy-10, 5), 5,5)
    Editor_scrollbar_top = topy
    Editor_scrollbar_bottom = boty
    [3.32]
    [5.133]
    love.graphics.rectangle('fill', state.right+15, topy+5, 30, math.max(boty-topy-10, 5), 5,5)
    state.scrollbar_top = topy
    state.scrollbar_bottom = boty
  • edit in 0031-on.resize at line 7
    [5.246]
    [5.246]
    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
  • replacement in 0021-draw_menu at line 20
    [4.790][4.790:830]()
    if not status then
    print(result)
    [4.790]
    [4.830]
    print(status, result)
    if result then
    -- could be either output or error
    Output_editor_state.lines = {
    {data=tostring(result)},
    }
    Text.redraw_all(Output_editor_state)
  • replacement in 0017-on.mouse_release at line 2
    [5.2259][5.1208:1356]()
    if Editor_scrollbar_drag then
    adjust_scrollbar(y)
    Editor_scrollbar_drag = nil
    elseif on_editor_scrollbar_area(x,y) then
    adjust_scrollbar(y)
    [5.2259]
    [2.47]
    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)
  • edit in 0017-on.mouse_release at line 9
    [5.1416]
    [5.1416]
    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)
  • replacement in 0016-on.mouse_press at line 5
    [5.1753][5.1422:1530]()
    if on_editor_scrollbar(x,y) then
    Editor_scrollbar_drag = true
    elseif on_editor_scrollbar_area(x,y) then
    [5.1753]
    [5.1530]
    if on_editor_scrollbar(Editor_state, x,y) then
    Editor_state.scrollbar_drag = true
    elseif on_editor_scrollbar_area(Editor_state, x,y) then
  • edit in 0016-on.mouse_press at line 11
    [5.1601]
    [5.1601]
    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
    -- nothing
  • edit in 0012-on.draw at line 10
    [5.1947]
    [5.1947]
    edit.draw(Output_editor_state, Normal_color, --[[hide cursor]] true)
    draw_scrollbar(Output_editor_state)
  • edit in 0011-on.initialize at line 15
    [5.3410]
    [5.2277]
    Output_editor_state = edit.initialize_state(
    Editor_state.bottom+5+10+5, -- top
    nil, -- buttom
    Editor_state.left, Editor_state.right,
    love.graphics.getFont():getHeight(), Line_height)
    Text.redraw_all(Output_editor_state)
  • replacement in 0004-on.update at line 3
    [5.1760][5.1607:1672]()
    if Editor_scrollbar_drag then
    adjust_scrollbar(App.mouse_y())
    [5.1760]
    [5.1672]
    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())