summaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-10 10:17:06 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-11 14:50:02 -0500
commit4f2a012a5dbad755bd621a3308a306afd4589fd5 (patch)
tree84cce3eb1da5f4140e8b83ed307aa361a9cacf1b /command.c
parentc67be90a777430e73c4817d1612cf9eb41b2ad87 (diff)
make find+replace more convenient
Diffstat (limited to 'command.c')
-rw-r--r--command.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/command.c b/command.c
index 19c291e..1d628b0 100644
--- a/command.c
+++ b/command.c
@@ -98,7 +98,18 @@ void command_execute(Ted *ted, Command c, i64 argument) {
break;
case CMD_TAB:
- buffer_insert_char_at_cursor(buffer, '\t');
+ if (ted->replace && ted->active_buffer == &ted->find_buffer) {
+ ted->active_buffer = &ted->replace_buffer;
+ buffer_select_all(ted->active_buffer);
+ } else {
+ buffer_insert_char_at_cursor(buffer, '\t');
+ }
+ break;
+ case CMD_BACKTAB:
+ if (ted->replace && ted->active_buffer == &ted->replace_buffer) {
+ ted->active_buffer = &ted->find_buffer;
+ buffer_select_all(ted->active_buffer);
+ }
break;
case CMD_NEWLINE:
case CMD_NEWLINE_BACK: