Merge text.love

[?]
Nov 27, 2022, 9:20 PM
AT3LVCMPK7SSIEHF3JI6XTA5XNO7HFI3AOHYNX4Y24QKJ2NS6DDQC

Dependencies

  • [2] RXNR3U5E Merge text.love
  • [3] VO2ZVTWK Merge lines.love
  • [4] SCOXD4EO Merge lines.love
  • [5] 4YDBYBA4 clean up memory leak experiments
  • [6] K2X6G75Z start writing some tests for drawings
  • [7] JOPVPUSA editing source code from within the app
  • [8] D4B52CQ2 Merge lines.love
  • [9] VHUNJHXB Merge lines.love
  • [10] BLWAYPKV extract a module
  • [11] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing
  • [12] 3QNOKBFM beginnings of a test harness
  • [13] D2GCFTTT clean up repl functionality
  • [14] LXTTOB33 extract a couple of files
  • [15] XX7G2FFJ intermingle freehand line drawings with text
  • [16] 2L5MEZV3 experiment: new edit namespace
  • [17] RSZD5A7G forgot to add json.lua
  • [18] MOAEVTKJ clean up a few more loose ends
  • [19] GUOQRUL7 Merge lines.love
  • [20] UEE5W7WJ document one more shortcut
  • [21] ATQO62TF Merge lines.love
  • [22] 36Z442IV back to commit 8123959e52f without code editing
  • [23] BULPIBEG beginnings of a module for the text editor
  • [24] 73OCE2MC after much struggle, a brute-force undo
  • [25] 6LJZN727 handle chords
  • [26] MD3W5IRA new fork: rip out drawing support
  • [27] KKMFQDR4 editing source code from within the app
  • [28] VXORMHME delete experimental REPL
  • [29] TLOAPLBJ add a license
  • [30] T4FRZSYL delete an ancient, unused file
  • [31] VHQCNMAR several more modules
  • [32] AVTNUQYR basic test-enabled framework
  • [33] KMSL74GA support selections in the source editor
  • [34] VBU5YHLR Merge lines.love
  • [35] D4FEFHQC flesh out Readme
  • [36] 66X36NZN a little more prose describing manual_tests
  • [37] TVCPXAAU rename
  • [38] E5FYDACS a likely source of issues
  • [39] OTIBCAUJ love2d scaffold
  • [40] R5QXEHUI somebody stop me
  • [41] FS2ITYYH record a known issue
  • [42] ETXNVRPT Merge lines.love
  • [43] VP5KC4XZ Merge lines.love
  • [44] 32V6ZHQB Merge lines.love
  • [45] 2CTN2IEF Merge lines.love
  • [46] CE4LZV4T drop last couple of manual tests
  • [47] RPGTBMMM Merge lines.love
  • [48] OGUV4HSA remove some memory leaks from rendered fragments
  • [49] HAZLW5K7 Merge text.love
  • [50] BH7BT36L ctrl+a: select entire buffer
  • [51] 3PSFWAIL Merge lines.love

Change contents

  • file deletion: source_edit.lua (----------)source_edit.lua (----------)
    [5.2][5.165788:165827](),[5.2][5.165788:165827](),[5.165827][5.152503:152503]()
    elseif chord == 'C-a' then
    State.selection1 = {line=1, pos=1}
    State.cursor1 = {line=#State.lines, pos=utf8.len(State.lines[#State.lines].data)+1, posB=nil}
    elseif chord == 'C-c' then
    local s = Text.selection(State)
    if s then
    App.setClipboardText(s)
    end
    elseif chord == 'C-x' then
    for _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scroll
    local s = Text.cut_selection(State, State.left, State.right)
    if s then
    App.setClipboardText(s)
    end
    schedule_save(State)
    elseif chord == 'C-v' then
    for _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scroll
    -- We don't have a good sense of when to scroll, so we'll be conservative
    -- and sometimes scroll when we didn't quite need to.
    local before_line = State.cursor1.line
    local before = snapshot(State, before_line)
    local clipboard_data = App.getClipboardText()
    for _,code in utf8.codes(clipboard_data) do
    local c = utf8.char(code)
    if c == '\n' then
    Text.insert_return(State)
    else
    Text.insert_at_cursor(State, c)
    end
    end
    if Text.cursor_out_of_screen(State) then
    Text.snap_cursor_to_bottom_of_screen(State, State.left, State.right)
    end
    schedule_save(State)
    record_undo_event(State, {before=before, after=snapshot(State, before_line, State.cursor1.line)})
    chord ~= 'C-a' and chord ~= 'C-c' and chord ~= 'C-x' and chord ~= 'backspace' and backspace ~= 'delete' and not App.is_cursor_movement(chord) then
    Text.delete_selection(State, State.left, State.right)
    end
  • file deletion: colorize.lua (----------)colorize.lua (----------)
    [5.2][5.209133:209169](),[5.2][5.209133:209169](),[5.209169][5.207220:207220]()
    if edge.suffix and rfind(frag, edge.suffix, nil, --[[plain]] true) == #frag - #edge.suffix + 1 then
    Current_state = edge.target
    break
    end
    end
    end
    function trim(s)
    return s:gsub('^%s+', ''):gsub('%s+$', '')
    end
    function ltrim(s)
    return s:gsub('^%s+', '')
    end
    function rtrim(s)
    return s:gsub('%s+$', '')
    end
    dstring=String_color,
    block_string=String_color,
    block_comment=Comment_color,
    }
    Current_state = 'normal'
    function initialize_color()
    --? print('new line')
    Current_state = 'normal'
    end
    function select_color(frag)
    --? print('before', '^'..frag..'$', Current_state)
    switch_color_based_on_prefix(frag)
    --? print('using color', Current_state, Colors[Current_state])
    App.color(Colors[Current_state])
    switch_color_based_on_suffix(frag)
    --? print('state after suffix', Current_state)
    end
    function switch_color_based_on_prefix(frag)
    if Next_state[Current_state] == nil then
    return
    end
    frag = rtrim(frag)
    for _,edge in pairs(Next_state[Current_state]) do
    if edge.prefix and find(frag, edge.prefix, nil, --[[plain]] true) == 1 then
    Current_state = edge.target
    break
    end
    end
    end
    function switch_color_based_on_suffix(frag)
    if Next_state[Current_state] == nil then
    return
    end
    frag = rtrim(frag)
    for _,edge in pairs(Next_state[Current_state]) do
    comment=Comment_color,
    sstring=String_color,
    Comment_color = {r=0, g=0, b=1}
    String_color = {r=0, g=0.5, b=0.5}
    Divider_color = {r=0.7, g=0.7, b=0.7}
    Colors = {
    normal=Text_color,
    block_string={
    {suffix=']]', target='normal'},
    },
    block_comment={
    {suffix=']]', target='normal'},
    },
    -- comments are a sink
    }
    {prefix='[[', target='block_string'}, -- only single line for now
    },
    dstring={
    {suffix='"', target='normal'},
    },
    sstring={
    {suffix="'", target='normal'},
    },
    {prefix='--[[', target='block_comment'}, -- only single-line for now
    {prefix='--', target='comment'},
    {prefix='"', target='dstring'},
    {prefix="'", target='sstring'},
  • resurrect zombie in README.md at line 33
    [5.91][5.665:739](),[5.91][5.665:739]()
    * mouse drag or `shift` + movement to select text, `ctrl+a` to select all