summaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-24 14:56:00 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-24 14:56:00 -0500
commit8c5eb397121c7fb3fa7feb2391d7c9b674b4190b (patch)
treecee9002f9e748eb4ca1861dd137abf366ac0ecba /command.c
parentb9079377328e9abeb20950ac144a7ebd98fde88e (diff)
file selector much nicer interface
Diffstat (limited to 'command.c')
-rw-r--r--command.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/command.c b/command.c
index 442989b..40636b6 100644
--- a/command.c
+++ b/command.c
@@ -19,6 +19,7 @@ char const *command_to_str(Command c) {
void command_execute(Ted *ted, Command c, i64 argument) {
TextBuffer *buffer = ted->active_buffer;
+ FileSelector *file_selector = &ted->file_selector;
Settings *settings = &ted->settings;
@@ -37,10 +38,12 @@ void command_execute(Ted *ted, Command c, i64 argument) {
if (buffer) buffer_cursor_move_right(buffer, argument);
break;
case CMD_UP:
- if (buffer) buffer_cursor_move_up(buffer, argument);
+ if (file_selector->open) file_selector_up(file_selector, argument);
+ else if (buffer) buffer_cursor_move_up(buffer, argument);
break;
case CMD_DOWN:
- if (buffer) buffer_cursor_move_down(buffer, argument);
+ if (file_selector->open) file_selector_down(file_selector, argument);
+ else if (buffer) buffer_cursor_move_down(buffer, argument);
break;
case CMD_SELECT_LEFT:
if (buffer) buffer_select_left(buffer, argument);