save the list of open files across restart

akkartik
Nov 26, 2023, 8:26 PM
SIASJPGRZ55R5AY2Q7QO6CVBPVU5VHXQTSBWJQLXA3RAFFNBSHVQC

Dependencies

  • [2] 6MQCFHXM remember when someone deletes an example
  • [3] VEAVIL4X resize handler
  • [4] VUF2SX7B implement carousel buttons for inserting/switching current pane
  • [5] OOSUBWKX subject people to a tutorial
  • [6] VAVXKWZV aggregate global state inside a 'pane' object
  • [7] 5RUFNRJO start of the visual skeleton
  • [8] MJ6KKFVT give example panes a name
  • [*] R5QXEHUI somebody stop me
  • [*] YV2GBDNW preserve settings across restart
  • [*] ZM7NOBRM new fork: carousel shell

Change contents

  • file addition: 0146-load_panes_from_previous_session (----------)
    [10.2]
    load_panes_from_previous_session = function()
    if Initial_load_filenames == nil then return end
    for _,filename in ipairs(Initial_load_filenames) do
    table.insert(Panes, new_pane())
    Current_pane_index = #Panes
    Current_pane = Panes[Current_pane_index]
    Current_pane.filename = filename
    one_time_load()
    end
    end
  • file addition: 0145-Initial_load_filenames (----------)
    [10.2]
    -- List of filenames loaded from settings that on.initialize will load into Panes.
    -- It's particularly unfortunate that this is a global.
    Initial_load_filenames = nil
  • file addition: 0144-filenames_from_all_panes (----------)
    [10.2]
    filenames_from_all_panes = function()
    local result = {}
    for _,pane in ipairs(Panes) do
    if pane.filename then
    table.insert(result, pane.filename)
    end
    end
    return result
    end
  • edit in 0099-on.load_settings at line 11
    [2.449]
    [11.394]
    Initial_load_filenames = settings.loaded_filenames
  • edit in 0098-on.save_settings at line 7
    [2.539]
    [11.592]
    loaded_filenames = filenames_from_all_panes(),
  • replacement in 0011-on.initialize at line 11
    [3.2043][3.2248:2281](),[3.4030][3.2248:2281](),[3.2084][3.2248:2281]()
    table.insert(Panes, new_pane())
    [3.4030]
    [3.2281]
    load_panes_from_previous_session()
    if #Panes == 0 then
    table.insert(Panes, new_pane())
    end