copy entire buffer when there's no selection

akkartik
Nov 24, 2023, 12:20 AM
YCPA257VEFZTLAMDGZ7ZJTJOFHM36ID3O7OGCBYPAMIA4QAOFWVAC

Dependencies

  • [2] RK2ASPN7 add lots of buttons to the toolbar
  • [3] 5MEJ7XNH lay out buttons based on device dimensions

Change contents

  • replacement in 0066-copy_button at line 19
    [2.4563][2.4563:4656]()
    local s = Text.selection(Current_pane.editor_state)
    if s then App.set_clipboard(s) end
    [2.4563]
    [2.4656]
    local e = Current_pane.editor_state
    local s = Text.selection(e)
    if s == nil then
    -- nothing selected? copy entire editor
    -- workaround while we have no way to save to file
    e.selection1 = {line=1, pos=1}
    e.cursor1 = {line=#e.lines, pos=utf8.len(e.lines[#e.lines].data)+1}
    s = Text.selection(e)
    end
    App.set_clipboard(s)