From 638b667398201d00989c055d90637ffce20bd1d3 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 8 Feb 2009 21:46:56 -0500 Subject: Do not do any find/replace when there is no find text. --- core/ext/find.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/ext') 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() -- cgit v1.2.3