delete some seemingly redundant code

akkartik
Jul 8, 2024, 9:11 PM
HPP3MEH2VINRT7LAF7QIIDVA76GBO4CN3R5UIF2P4M3RH3DOBL5QC

Dependencies

  • [2] G3DLS5OU audit all asserts
  • [3] ILOA5BYF separate data structure for each line's cache data
  • [4] 73OCE2MC after much struggle, a brute-force undo
  • [5] OI4FPFIN support drawings in the source editor
  • [6] 2L5MEZV3 experiment: new edit namespace
  • [7] 7ZXZGVHM purge obsolete term 'fragment'
  • [8] VJ77YABH more efficient undo/redo
  • [9] TGHAJBES use line cache for drawings as well
  • [10] QCPXQ2E3 add state arg to a few functions
  • [11] WLWNS6FB a bug I've never run into
  • [12] LNUHQOGH start passing in Editor_state explicitly
  • [13] KKMFQDR4 editing source code from within the app
  • [14] KMSL74GA support selections in the source editor

Change contents

  • edit in undo.lua at line 84
    [3.852][3.1:51](),[3.51][2.368:445](),[2.445][3.94:176](),[3.94][3.94:176](),[3.176][2.446:531](),[2.531][3.227:313](),[3.227][3.227:313]()
    function patch_placeholders(line_cache, from, to)
    assert(from.start_line == to.start_line, 'failed to patch undo operation')
    for i=from.end_line,from.start_line,-1 do
    table.remove(line_cache, i)
    end
    assert(#to.lines == to.end_line-to.start_line+1, 'failed to patch undo operation')
    for i=1,#to.lines do
    table.insert(line_cache, to.start_line+i-1, {})
    end
    end
  • edit in source_undo.lua at line 84
    [3.2662][3.2662:2712](),[3.2712][2.2686:2763](),[2.2763][3.2755:2837](),[3.2755][3.2755:2837](),[3.2837][2.2764:2849](),[2.2849][3.2888:2974](),[3.2888][3.2888:2974]()
    function patch_placeholders(line_cache, from, to)
    assert(from.start_line == to.start_line, 'failed to patch undo operation')
    for i=from.end_line,from.start_line,-1 do
    table.remove(line_cache, i)
    end
    assert(#to.lines == to.end_line-to.start_line+1, 'failed to patch undo operation')
    for i=1,#to.lines do
    table.insert(line_cache, to.start_line+i-1, {})
    end
    end
  • edit in source_edit.lua at line 444
    [3.161104][3.161104:161174]()
    patch_placeholders(State.line_cache, event.after, event.before)
  • edit in edit.lua at line 443
    [3.8139][3.1967:2037]()
    patch_placeholders(State.line_cache, event.after, event.before)