From 9b274417c5732dccd02f342f4f112addc02a5e37 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?=
Date: Mon, 30 Dec 2024 00:57:06 +0100
Subject: [PATCH] Make pressing / in search activate ACTION_ENTER
You can disable this in the bindings file using: search / none
Closes #6
---
sdn.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sdn.cpp b/sdn.cpp
index 76d60fc..624047a 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -499,6 +499,7 @@ static map g_input_actions {
static map g_search_actions {
{CTRL ('P'), ACTION_UP}, {KEY (UP), ACTION_UP},
{CTRL ('N'), ACTION_DOWN}, {KEY (DOWN), ACTION_DOWN},
+ {'/', ACTION_ENTER},
};
static const map*> g_binding_contexts {
{"normal", &g_normal_actions}, {"input", &g_input_actions},
@@ -1644,6 +1645,11 @@ fun handle (wint_t c) -> bool {
g.editor_on[ACTION_UP] = [] { match_interactive (-1); };
g.editor_on[ACTION_DOWN] = [] { match_interactive (+1); };
g.editor_on[ACTION_INPUT_CONFIRM] = [] { enter (at_cursor ()); };
+ g.editor_on[ACTION_ENTER] = [] {
+ enter (at_cursor ());
+ g.editor_line.clear ();
+ g.editor_cursor = 0;
+ };
break;
case ACTION_RENAME_PREFILL:
g.editor_line = to_wide (current.filename);