rgieseke / textredux

Text-based interfaces for Textadept
http://rgieseke.github.io/textredux/
Other
59 stars 11 forks source link

Implementation of select_directory #39

Closed triplejam closed 5 years ago

triplejam commented 5 years ago

May need some small changes. Ctrl+d is for when some navigating is still needed. Not sure if using that could cause problems in combination with snapopen.

triplejam commented 5 years ago

If this is good so far, could possibly remove './' from the filter so the currently opened directory could be selected.

rgieseke commented 5 years ago

Great! Do you have a usage example?

triplejam commented 5 years ago

Just for testing I used:

local function show_dir_name(path, exists, list)
  local function impl()
    local output_str = '  The directory is  ' .. path
    local show_dir_impl = ui.dialogs.msgbox {
      title = 'Directory name',
      text = output_str,
      button1 = 'Ok'
    }
  end
  if exists then
    impl()
  else
    if lfs.mkdir(path) then
      impl()
    end
  end
  list:close()
end

keys['amm'] = function() --Change keybinding if you want
  textredux.fs.select_directory(show_dir_name, _USERHOME)
end
triplejam commented 5 years ago

Also perhaps if ../ is selected while in folder './foo/bar', then './foo/bar/..' should be changed to just './foo'

rgieseke commented 5 years ago

That works great! What about using Ctrl-Right-Arrow as a default shortcut for going into a directory? Ctrl-d closes a buffer in the buffer-list.

rgieseke commented 5 years ago

Awesome, is this ready to be merged?

triplejam commented 5 years ago

Yes. I think this is good for now. Will implement anything else for it at a later point.

rgieseke commented 5 years ago

Great, thanks!