|
|
@ -369,171 +369,128 @@ impl App {
|
|
|
|
if self.config.general.read_only && !msg.is_read_only() {
|
|
|
|
if self.config.general.read_only && !msg.is_read_only() {
|
|
|
|
self.log_error("Cannot execute code in read-only mode.".into())
|
|
|
|
self.log_error("Cannot execute code in read-only mode.".into())
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
use ExternalMsg::*;
|
|
|
|
match msg {
|
|
|
|
match msg {
|
|
|
|
ExternalMsg::ExplorePwd => self.explore_pwd(),
|
|
|
|
ExplorePwd => self.explore_pwd(),
|
|
|
|
ExternalMsg::ExploreParentsAsync => {
|
|
|
|
ExploreParentsAsync => self.explore_parents_async(),
|
|
|
|
self.explore_parents_async()
|
|
|
|
ExplorePwdAsync => self.explore_pwd_async(),
|
|
|
|
}
|
|
|
|
Refresh => self.refresh(),
|
|
|
|
ExternalMsg::ExplorePwdAsync => self.explore_pwd_async(),
|
|
|
|
ClearScreen => self.clear_screen(),
|
|
|
|
ExternalMsg::Refresh => self.refresh(),
|
|
|
|
FocusFirst => self.focus_first(true),
|
|
|
|
ExternalMsg::ClearScreen => self.clear_screen(),
|
|
|
|
FocusLast => self.focus_last(),
|
|
|
|
ExternalMsg::FocusFirst => self.focus_first(true),
|
|
|
|
FocusPrevious => self.focus_previous(),
|
|
|
|
ExternalMsg::FocusLast => self.focus_last(),
|
|
|
|
FocusPreviousByRelativeIndex(i) => {
|
|
|
|
ExternalMsg::FocusPrevious => self.focus_previous(),
|
|
|
|
|
|
|
|
ExternalMsg::FocusPreviousByRelativeIndex(i) => {
|
|
|
|
|
|
|
|
self.focus_previous_by_relative_index(i)
|
|
|
|
self.focus_previous_by_relative_index(i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ExternalMsg::FocusPreviousByRelativeIndexFromInput => {
|
|
|
|
FocusPreviousByRelativeIndexFromInput => {
|
|
|
|
self.focus_previous_by_relative_index_from_input()
|
|
|
|
self.focus_previous_by_relative_index_from_input()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::FocusNext => self.focus_next(),
|
|
|
|
FocusNext => self.focus_next(),
|
|
|
|
ExternalMsg::FocusNextByRelativeIndex(i) => {
|
|
|
|
FocusNextByRelativeIndex(i) => {
|
|
|
|
self.focus_next_by_relative_index(i)
|
|
|
|
self.focus_next_by_relative_index(i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::FocusNextByRelativeIndexFromInput => {
|
|
|
|
FocusNextByRelativeIndexFromInput => {
|
|
|
|
self.focus_next_by_relative_index_from_input()
|
|
|
|
self.focus_next_by_relative_index_from_input()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::FocusPath(p) => self.focus_path(&p, true),
|
|
|
|
FocusPath(p) => self.focus_path(&p, true),
|
|
|
|
ExternalMsg::FocusPathFromInput => self.focus_path_from_input(),
|
|
|
|
FocusPathFromInput => self.focus_path_from_input(),
|
|
|
|
ExternalMsg::FocusByIndex(i) => self.focus_by_index(i),
|
|
|
|
FocusByIndex(i) => self.focus_by_index(i),
|
|
|
|
ExternalMsg::FocusByIndexFromInput => {
|
|
|
|
FocusByIndexFromInput => self.focus_by_index_from_input(),
|
|
|
|
self.focus_by_index_from_input()
|
|
|
|
FocusByFileName(n) => self.focus_by_file_name(&n, true),
|
|
|
|
}
|
|
|
|
ChangeDirectory(dir) => self.change_directory(&dir, true),
|
|
|
|
ExternalMsg::FocusByFileName(n) => {
|
|
|
|
Enter => self.enter(),
|
|
|
|
self.focus_by_file_name(&n, true)
|
|
|
|
Back => self.back(),
|
|
|
|
}
|
|
|
|
LastVisitedPath => self.last_visited_path(),
|
|
|
|
ExternalMsg::ChangeDirectory(dir) => {
|
|
|
|
NextVisitedPath => self.next_visited_path(),
|
|
|
|
self.change_directory(&dir, true)
|
|
|
|
FollowSymlink => self.follow_symlink(),
|
|
|
|
}
|
|
|
|
UpdateInputBuffer(op) => self.update_input_buffer(op),
|
|
|
|
ExternalMsg::Enter => self.enter(),
|
|
|
|
UpdateInputBufferFromKey => {
|
|
|
|
ExternalMsg::Back => self.back(),
|
|
|
|
|
|
|
|
ExternalMsg::LastVisitedPath => self.last_visited_path(),
|
|
|
|
|
|
|
|
ExternalMsg::NextVisitedPath => self.next_visited_path(),
|
|
|
|
|
|
|
|
ExternalMsg::FollowSymlink => self.follow_symlink(),
|
|
|
|
|
|
|
|
ExternalMsg::UpdateInputBuffer(op) => {
|
|
|
|
|
|
|
|
self.update_input_buffer(op)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalMsg::UpdateInputBufferFromKey => {
|
|
|
|
|
|
|
|
self.update_input_buffer_from_key(key)
|
|
|
|
self.update_input_buffer_from_key(key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::BufferInput(input) => self.buffer_input(&input),
|
|
|
|
BufferInput(input) => self.buffer_input(&input),
|
|
|
|
ExternalMsg::BufferInputFromKey => {
|
|
|
|
BufferInputFromKey => self.buffer_input_from_key(key),
|
|
|
|
self.buffer_input_from_key(key)
|
|
|
|
SetInputBuffer(input) => self.set_input_buffer(input),
|
|
|
|
}
|
|
|
|
RemoveInputBufferLastCharacter => {
|
|
|
|
ExternalMsg::SetInputBuffer(input) => {
|
|
|
|
|
|
|
|
self.set_input_buffer(input)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalMsg::RemoveInputBufferLastCharacter => {
|
|
|
|
|
|
|
|
self.remove_input_buffer_last_character()
|
|
|
|
self.remove_input_buffer_last_character()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::RemoveInputBufferLastWord => {
|
|
|
|
RemoveInputBufferLastWord => {
|
|
|
|
self.remove_input_buffer_last_word()
|
|
|
|
self.remove_input_buffer_last_word()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::ResetInputBuffer => self.reset_input_buffer(),
|
|
|
|
ResetInputBuffer => self.reset_input_buffer(),
|
|
|
|
ExternalMsg::SwitchMode(mode) => self.switch_mode(&mode),
|
|
|
|
SwitchMode(mode) => self.switch_mode(&mode),
|
|
|
|
ExternalMsg::SwitchModeKeepingInputBuffer(mode) => {
|
|
|
|
SwitchModeKeepingInputBuffer(mode) => {
|
|
|
|
self.switch_mode_keeping_input_buffer(&mode)
|
|
|
|
self.switch_mode_keeping_input_buffer(&mode)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::SwitchModeBuiltin(mode) => {
|
|
|
|
SwitchModeBuiltin(mode) => self.switch_mode_builtin(&mode),
|
|
|
|
self.switch_mode_builtin(&mode)
|
|
|
|
SwitchModeBuiltinKeepingInputBuffer(mode) => {
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalMsg::SwitchModeBuiltinKeepingInputBuffer(mode) => {
|
|
|
|
|
|
|
|
self.switch_mode_builtin_keeping_input_buffer(&mode)
|
|
|
|
self.switch_mode_builtin_keeping_input_buffer(&mode)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::SwitchModeCustom(mode) => {
|
|
|
|
SwitchModeCustom(mode) => self.switch_mode_custom(&mode),
|
|
|
|
self.switch_mode_custom(&mode)
|
|
|
|
SwitchModeCustomKeepingInputBuffer(mode) => {
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalMsg::SwitchModeCustomKeepingInputBuffer(mode) => {
|
|
|
|
|
|
|
|
self.switch_mode_custom_keeping_input_buffer(&mode)
|
|
|
|
self.switch_mode_custom_keeping_input_buffer(&mode)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::PopMode => self.pop_mode(),
|
|
|
|
PopMode => self.pop_mode(),
|
|
|
|
ExternalMsg::PopModeKeepingInputBuffer => {
|
|
|
|
PopModeKeepingInputBuffer => {
|
|
|
|
self.pop_mode_keeping_input_buffer()
|
|
|
|
self.pop_mode_keeping_input_buffer()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::SwitchLayout(mode) => self.switch_layout(&mode),
|
|
|
|
SwitchLayout(mode) => self.switch_layout(&mode),
|
|
|
|
ExternalMsg::SwitchLayoutBuiltin(mode) => {
|
|
|
|
SwitchLayoutBuiltin(mode) => self.switch_layout_builtin(&mode),
|
|
|
|
self.switch_layout_builtin(&mode)
|
|
|
|
SwitchLayoutCustom(mode) => self.switch_layout_custom(&mode),
|
|
|
|
}
|
|
|
|
Call(cmd) => self.call(cmd),
|
|
|
|
ExternalMsg::SwitchLayoutCustom(mode) => {
|
|
|
|
CallSilently(cmd) => self.call_silently(cmd),
|
|
|
|
self.switch_layout_custom(&mode)
|
|
|
|
BashExec(cmd) => self.bash_exec(cmd),
|
|
|
|
}
|
|
|
|
BashExecSilently(cmd) => self.bash_exec_silently(cmd),
|
|
|
|
ExternalMsg::Call(cmd) => self.call(cmd),
|
|
|
|
CallLua(func) => self.call_lua(func),
|
|
|
|
ExternalMsg::CallSilently(cmd) => self.call_silently(cmd),
|
|
|
|
CallLuaSilently(func) => self.call_lua_silently(func),
|
|
|
|
ExternalMsg::BashExec(cmd) => self.bash_exec(cmd),
|
|
|
|
LuaEval(code) => self.lua_eval(code),
|
|
|
|
ExternalMsg::BashExecSilently(cmd) => {
|
|
|
|
LuaEvalSilently(code) => self.lua_eval_silently(code),
|
|
|
|
self.bash_exec_silently(cmd)
|
|
|
|
Select => self.select(),
|
|
|
|
}
|
|
|
|
SelectAll => self.select_all(),
|
|
|
|
ExternalMsg::CallLua(func) => self.call_lua(func),
|
|
|
|
SelectPath(p) => self.select_path(p),
|
|
|
|
ExternalMsg::CallLuaSilently(func) => {
|
|
|
|
UnSelect => self.un_select(),
|
|
|
|
self.call_lua_silently(func)
|
|
|
|
UnSelectAll => self.un_select_all(),
|
|
|
|
}
|
|
|
|
UnSelectPath(p) => self.un_select_path(p),
|
|
|
|
ExternalMsg::LuaEval(code) => self.lua_eval(code),
|
|
|
|
ToggleSelection => self.toggle_selection(),
|
|
|
|
ExternalMsg::LuaEvalSilently(code) => {
|
|
|
|
ToggleSelectAll => self.toggle_select_all(),
|
|
|
|
self.lua_eval_silently(code)
|
|
|
|
ToggleSelectionByPath(p) => self.toggle_selection_by_path(p),
|
|
|
|
}
|
|
|
|
ClearSelection => self.clear_selection(),
|
|
|
|
ExternalMsg::Select => self.select(),
|
|
|
|
AddNodeFilter(f) => self.add_node_filter(f),
|
|
|
|
ExternalMsg::SelectAll => self.select_all(),
|
|
|
|
AddNodeFilterFromInput(f) => self.add_node_filter_from_input(f),
|
|
|
|
ExternalMsg::SelectPath(p) => self.select_path(p),
|
|
|
|
RemoveNodeFilter(f) => self.remove_node_filter(f),
|
|
|
|
ExternalMsg::UnSelect => self.un_select(),
|
|
|
|
RemoveNodeFilterFromInput(f) => {
|
|
|
|
ExternalMsg::UnSelectAll => self.un_select_all(),
|
|
|
|
|
|
|
|
ExternalMsg::UnSelectPath(p) => self.un_select_path(p),
|
|
|
|
|
|
|
|
ExternalMsg::ToggleSelection => self.toggle_selection(),
|
|
|
|
|
|
|
|
ExternalMsg::ToggleSelectAll => self.toggle_select_all(),
|
|
|
|
|
|
|
|
ExternalMsg::ToggleSelectionByPath(p) => {
|
|
|
|
|
|
|
|
self.toggle_selection_by_path(p)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalMsg::ClearSelection => self.clear_selection(),
|
|
|
|
|
|
|
|
ExternalMsg::AddNodeFilter(f) => self.add_node_filter(f),
|
|
|
|
|
|
|
|
ExternalMsg::AddNodeFilterFromInput(f) => {
|
|
|
|
|
|
|
|
self.add_node_filter_from_input(f)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalMsg::RemoveNodeFilter(f) => self.remove_node_filter(f),
|
|
|
|
|
|
|
|
ExternalMsg::RemoveNodeFilterFromInput(f) => {
|
|
|
|
|
|
|
|
self.remove_node_filter_from_input(f)
|
|
|
|
self.remove_node_filter_from_input(f)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExternalMsg::ToggleNodeFilter(f) => self.toggle_node_filter(f),
|
|
|
|
ToggleNodeFilter(f) => self.toggle_node_filter(f),
|
|
|
|
ExternalMsg::RemoveLastNodeFilter => {
|
|
|
|
RemoveLastNodeFilter => self.remove_last_node_filter(),
|
|
|
|
self.remove_last_node_filter()
|
|
|
|
ResetNodeFilters => self.reset_node_filters(),
|
|
|
|
}
|
|
|
|
ClearNodeFilters => self.clear_node_filters(),
|
|
|
|
ExternalMsg::ResetNodeFilters => self.reset_node_filters(),
|
|
|
|
AddNodeSorter(f) => self.add_node_sorter(f),
|
|
|
|
ExternalMsg::ClearNodeFilters => self.clear_node_filters(),
|
|
|
|
RemoveNodeSorter(f) => self.remove_node_sorter(f),
|
|
|
|
ExternalMsg::AddNodeSorter(f) => self.add_node_sorter(f),
|
|
|
|
ReverseNodeSorter(f) => self.reverse_node_sorter(f),
|
|
|
|
ExternalMsg::RemoveNodeSorter(f) => self.remove_node_sorter(f),
|
|
|
|
ToggleNodeSorter(f) => self.toggle_node_sorter(f),
|
|
|
|
ExternalMsg::ReverseNodeSorter(f) => {
|
|
|
|
RemoveLastNodeSorter => self.remove_last_node_sorter(),
|
|
|
|
self.reverse_node_sorter(f)
|
|
|
|
ReverseNodeSorters => self.reverse_node_sorters(),
|
|
|
|
}
|
|
|
|
ResetNodeSorters => self.reset_node_sorters(),
|
|
|
|
ExternalMsg::ToggleNodeSorter(f) => self.toggle_node_sorter(f),
|
|
|
|
ClearNodeSorters => self.clear_node_sorters(),
|
|
|
|
ExternalMsg::RemoveLastNodeSorter => {
|
|
|
|
EnableMouse => self.enable_mouse(),
|
|
|
|
self.remove_last_node_sorter()
|
|
|
|
DisableMouse => self.disable_mouse(),
|
|
|
|
}
|
|
|
|
ToggleMouse => self.toggle_mouse(),
|
|
|
|
ExternalMsg::ReverseNodeSorters => self.reverse_node_sorters(),
|
|
|
|
StartFifo(f) => self.start_fifo(f),
|
|
|
|
ExternalMsg::ResetNodeSorters => self.reset_node_sorters(),
|
|
|
|
StopFifo => self.stop_fifo(),
|
|
|
|
ExternalMsg::ClearNodeSorters => self.clear_node_sorters(),
|
|
|
|
ToggleFifo(f) => self.toggle_fifo(f),
|
|
|
|
ExternalMsg::EnableMouse => self.enable_mouse(),
|
|
|
|
LogInfo(l) => self.log_info(l),
|
|
|
|
ExternalMsg::DisableMouse => self.disable_mouse(),
|
|
|
|
LogSuccess(l) => self.log_success(l),
|
|
|
|
ExternalMsg::ToggleMouse => self.toggle_mouse(),
|
|
|
|
LogWarning(l) => self.log_warning(l),
|
|
|
|
ExternalMsg::StartFifo(f) => self.start_fifo(f),
|
|
|
|
LogError(l) => self.log_error(l),
|
|
|
|
ExternalMsg::StopFifo => self.stop_fifo(),
|
|
|
|
Quit => self.quit(),
|
|
|
|
ExternalMsg::ToggleFifo(f) => self.toggle_fifo(f),
|
|
|
|
PrintPwdAndQuit => self.print_pwd_and_quit(),
|
|
|
|
ExternalMsg::LogInfo(l) => self.log_info(l),
|
|
|
|
PrintFocusPathAndQuit => self.print_focus_path_and_quit(),
|
|
|
|
ExternalMsg::LogSuccess(l) => self.log_success(l),
|
|
|
|
PrintSelectionAndQuit => self.print_selection_and_quit(),
|
|
|
|
ExternalMsg::LogWarning(l) => self.log_warning(l),
|
|
|
|
PrintResultAndQuit => self.print_result_and_quit(),
|
|
|
|
ExternalMsg::LogError(l) => self.log_error(l),
|
|
|
|
PrintAppStateAndQuit => self.print_app_state_and_quit(),
|
|
|
|
ExternalMsg::Quit => self.quit(),
|
|
|
|
Debug(path) => self.debug(path),
|
|
|
|
ExternalMsg::PrintPwdAndQuit => self.print_pwd_and_quit(),
|
|
|
|
Terminate => bail!(""),
|
|
|
|
ExternalMsg::PrintFocusPathAndQuit => {
|
|
|
|
|
|
|
|
self.print_focus_path_and_quit()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalMsg::PrintSelectionAndQuit => {
|
|
|
|
|
|
|
|
self.print_selection_and_quit()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalMsg::PrintResultAndQuit => self.print_result_and_quit(),
|
|
|
|
|
|
|
|
ExternalMsg::PrintAppStateAndQuit => {
|
|
|
|
|
|
|
|
self.print_app_state_and_quit()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalMsg::Debug(path) => self.debug(path),
|
|
|
|
|
|
|
|
ExternalMsg::Terminate => bail!(""),
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}?
|
|
|
|
}?
|
|
|
|
.refresh_selection()
|
|
|
|
.refresh_selection()
|
|
|
|