merge bugfix

akkartik
Sep 5, 2024, 8:53 PM
CZ6X73VY6CKBHNLFLWA4DXLYVIWI5W4WPDIHJL3N6OBMTXQDC3RQC

Dependencies

Change contents

  • file deletion: source_select.lua (----------)source_select.lua (----------)
    [4.2][4.30050:30091](),[4.30091][4.23288:23288](),[4.2][4.30050:30091]()
    function Text.cut_selection_and_record_undo_event(State)
    Text.delete_selection_and_record_undo_event(State)
    function Text.delete_selection_and_record_undo_event(State)
    if State.selection1.line == nil then return end
    local minl,maxl = minmax(State.selection1.line, State.cursor1.line)
    local before = snapshot(State, minl, maxl)
    Text.delete_selection_without_undo(State)
    record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)})
    end
    function Text.delete_selection_without_undo(State)
    if State.selection1.line == nil then return end
    -- min,max = sorted(State.selection1,State.cursor1)
    local minl,minp = State.selection1.line,State.selection1.pos
    local maxl,maxp = State.cursor1.line,State.cursor1.pos
    if minl > maxl then
    minl,maxl = maxl,minl
    minp,maxp = maxp,minp
    elseif minl == maxl then
    if minp > maxp then
    minp,maxp = maxp,minp
    end
    end
    -- update State.cursor1 and State.selection1
    State.cursor1.line = minl
    State.cursor1.pos = minp
    if Text.lt1(State.cursor1, State.screen_top1) then
    State.screen_top1.line = State.cursor1.line
    State.screen_top1.pos = Text.pos_at_start_of_screen_line(State, State.cursor1)
    end
    State.selection1 = {}
    -- delete everything between min (inclusive) and max (exclusive)
    Text.clear_screen_line_cache(State, minl)
    local min_offset = Text.offset(State.lines[minl].data, minp)
    local max_offset = Text.offset(State.lines[maxl].data, maxp)
    if minl == maxl then
    --? print('minl == maxl')
    State.lines[minl].data = State.lines[minl].data:sub(1, min_offset-1)..State.lines[minl].data:sub(max_offset)
    return
    end
    return result
    end
    if State.selection1.line == nil then return end
    local result = Text.selection(State)
  • file deletion: source_text.lua (----------)source_text.lua (----------)
    [4.2][4.147125:147164](),[4.147164][4.83786:83786](),[4.2][4.147125:147164]()
    Text.delete_selection_and_record_undo_event(State)
    Text.delete_selection_and_record_undo_event(State)
    schedule_save(State)
    return
    end
    schedule_save(State)
    return
    end
  • file deletion: source_edit.lua (----------)source_edit.lua (----------)
    [4.2][4.165788:165827](),[4.165827][4.152503:152503](),[4.2][4.165788:165827]()
    Drawing.before = nil
    Text.delete_selection_and_record_undo_event(State)
    local s = Text.cut_selection_and_record_undo_event(State)
    if s then
    end
    schedule_save(State)