aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/ext/find.lua2
-rw-r--r--src/textadept.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/core/ext/find.lua b/core/ext/find.lua
index 5aea4a35..cc7763d6 100644
--- a/core/ext/find.lua
+++ b/core/ext/find.lua
@@ -31,6 +31,7 @@ local escapes = {
-- internally, and should not be set otherwise.
-- @return position of the found text or -1
function find.find(text, next, flags, nowrap, wrapped)
+ if #text == 0 then return end
local buffer = buffer
local locale = textadept.locale
local first_visible_line = buffer.first_visible_line -- for 'no results found'
@@ -209,6 +210,7 @@ end
-- @param flags The number mask identical to the one in 'find'.
-- @see find.find
function find.replace_all(ftext, rtext, flags)
+ if #ftext == 0 then return end
local buffer = buffer
if find.in_files then find.in_files = false end
buffer:begin_undo_action()
diff --git a/src/textadept.c b/src/textadept.c
index d2836397..ee2f4da6 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -973,6 +973,7 @@ static void find_add_to_history(const char *text, GtkListStore *store) {
static void button_clicked(GtkWidget *button, gpointer) {
const char *find_text = gtk_entry_get_text(GTK_ENTRY(find_entry));
const char *repl_text = gtk_entry_get_text(GTK_ENTRY(replace_entry));
+ if (strlen(find_text) == 0) return;
if (button == fnext_button || button == fprev_button) {
find_add_to_history(find_text, find_store);
l_find(find_text, button == fnext_button);