Hi,

Some time ago, during the discussion for focusing the "last active"
widget when the last document is closed, I found that invoking Search
Next/Previous Message via keybinding will not work if there are no open
documents. As it turns out, cb_func_search_action() checks for an open
document, and lets only Search FiF if there isn't any. Here is a fix.
It not very pretty, with multiply return-s, it would be nicer to place
the doc-related code and keys in a default: case of the new switch.

-- 
E-gards: Jimmy
>From 6d0db7ca5f39585a8c1da6de16601a90b461dd6c Mon Sep 17 00:00:00 2001
From: Dimitar Zhekov <dimitar.zhe...@gmail.com>
Date: Mon, 14 Oct 2013 20:51:33 +0300
Subject: [PATCH] fix previous/next message keys to work without docs

---
 src/keybindings.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/keybindings.c b/src/keybindings.c
index 415e6b6..f854760 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -1420,10 +1420,15 @@ static gboolean cb_func_search_action(guint key_id)
 	GeanyDocument *doc = document_get_current();
 	ScintillaObject *sci;
 
-	if (key_id == GEANY_KEYS_SEARCH_FINDINFILES)
+	/* these work without docs */
+	switch (key_id)
 	{
-		on_find_in_files1_activate(NULL, NULL);	/* works without docs too */
-		return TRUE;
+		case GEANY_KEYS_SEARCH_FINDINFILES :
+			on_find_in_files1_activate(NULL, NULL);	return TRUE;
+		case GEANY_KEYS_SEARCH_NEXTMESSAGE :
+			on_next_message1_activate(NULL, NULL); return TRUE;
+		case GEANY_KEYS_SEARCH_PREVIOUSMESSAGE :
+			on_previous_message1_activate(NULL, NULL); return TRUE;
 	}
 	if (!doc)
 		return TRUE;
-- 
1.8.4.rc3

_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel

Reply via email to