summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/degesch.c b/degesch.c
index 5dce5a9..b7adad7 100644
--- a/degesch.c
+++ b/degesch.c
@@ -10655,6 +10655,7 @@ bind_common_keys (struct app_context *ctx)
for (int i = 0; i <= 9; i++)
input_bind_meta (self, '0' + i, "goto-buffer");
+ input_bind_meta (self, '\t', "switch-buffer");
input_bind_meta (self, 'm', "insert-attribute");
input_bind_meta (self, 'h', "display-full-log");
input_bind_meta (self, 'e', "edit-input");
@@ -10708,6 +10709,20 @@ on_readline_next_buffer (int count, int key)
}
static int
+on_readline_switch_buffer (int count, int key)
+{
+ (void) count;
+ (void) key;
+
+ struct app_context *ctx = g_ctx;
+ if (ctx->last_buffer)
+ buffer_activate (ctx, ctx->last_buffer);
+ else
+ input_ding (&ctx->input);
+ return 0;
+}
+
+static int
on_readline_display_backlog (int count, int key)
{
(void) count;
@@ -10843,6 +10858,7 @@ app_readline_init (void)
rl_add_defun ("previous-buffer", on_readline_previous_buffer, -1);
rl_add_defun ("next-buffer", on_readline_next_buffer, -1);
rl_add_defun ("goto-buffer", on_readline_goto_buffer, -1);
+ rl_add_defun ("switch-buffer", on_readline_switch_buffer, -1);
rl_add_defun ("display-backlog", on_readline_display_backlog, -1);
rl_add_defun ("display-full-log", on_readline_display_full_log, -1);
rl_add_defun ("edit-input", on_readline_edit_input, -1);
@@ -10907,6 +10923,20 @@ on_editline_next_buffer (EditLine *editline, int key)
}
static unsigned char
+on_editline_switch_buffer (EditLine *editline, int key)
+{
+ (void) editline;
+ (void) key;
+
+ struct app_context *ctx = g_ctx;
+ if (ctx->last_buffer)
+ buffer_activate (ctx, ctx->last_buffer);
+ else
+ input_ding (&ctx->input);
+ return CC_NORM;
+}
+
+static unsigned char
on_editline_display_backlog (EditLine *editline, int key)
{
(void) editline;
@@ -11062,6 +11092,7 @@ app_editline_init (struct input *self)
{ "goto-buffer", "Go to buffer", on_editline_goto_buffer },
{ "previous-buffer", "Previous buffer", on_editline_previous_buffer },
{ "next-buffer", "Next buffer", on_editline_next_buffer },
+ { "switch-buffer", "Switch buffer", on_editline_switch_buffer },
{ "display-backlog", "Show backlog", on_editline_display_backlog },
{ "display-full-log", "Show full log", on_editline_display_full_log },
{ "edit-input", "Edit input", on_editline_edit_input },