aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/ui.lua2
-rw-r--r--modules/textadept/editing.lua4
-rw-r--r--modules/textadept/find.lua2
-rw-r--r--src/textadept.c4
4 files changed, 9 insertions, 3 deletions
diff --git a/core/ui.lua b/core/ui.lua
index e726d1f4..438d7494 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -331,7 +331,7 @@ end)
-- Sets buffer statusbar text.
events_connect(events.UPDATE_UI, function(updated)
- if updated and updated & 3 == 0 then return end -- ignore scrolling
+ if updated & 3 == 0 then return end -- ignore scrolling
local text = not CURSES and '%s %d/%d %s %d %s %s %s %s' or
'%s %d/%d %s %d %s %s %s %s'
local pos = buffer.selection_n_caret[buffer.main_selection]
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 1830e047..5b39c1bc 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -165,7 +165,7 @@ end, 1) -- need index of 1 because default key handler halts propagation
-- Highlights matching braces.
events.connect(events.UPDATE_UI, function(updated)
- if updated and updated & 3 == 0 then return end -- ignore scrolling
+ if updated & 3 == 0 then return end -- ignore scrolling
local pos = buffer.selection_n_caret[buffer.main_selection]
if M.brace_matches[buffer.char_at[pos]] then
local match = buffer:brace_match(pos, 0)
@@ -187,7 +187,7 @@ end, 1)
-- Highlight all instances of the current or selected word.
events.connect(events.UPDATE_UI, function(updated)
- if not updated or updated & buffer.UPDATE_SELECTION == 0 then return end
+ if updated & buffer.UPDATE_SELECTION == 0 or ui.find.active then return end
local word
if M.highlight_words == M.HIGHLIGHT_CURRENT then
clear_highlighted_words()
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index 520b977e..d5e34ca9 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -57,6 +57,8 @@ local M = ui.find
-- @field in_files_label_text (string, Write-only)
-- The text of the "In files" label.
-- This is primarily used for localization.
+-- @field active (boolean)
+-- Whether or not the Find & Replace pane is active.
-- @field highlight_all_matches (boolean)
-- Whether or not to highlight all occurrences of found text in the current
-- buffer.
diff --git a/src/textadept.c b/src/textadept.c
index 7b8ef5f7..e7f1e8f4 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -131,6 +131,7 @@ static ListStore *find_history, *repl_history;
#define set_label_text(l, t) gtk_label_set_text_with_mnemonic(GTK_LABEL(l), t)
#define set_button_label(b, l) gtk_button_set_label(GTK_BUTTON(b), l)
#define set_option_label(o, _, l) gtk_button_set_label(GTK_BUTTON(o), l)
+#define find_active(w) gtk_widget_get_visible(w)
// GTK command entry.
#define command_entry_focused gtk_widget_has_focus(command_entry)
#elif CURSES
@@ -176,6 +177,7 @@ static ListStore find_history[10], repl_history[10];
copyfree(&option_labels[i], lua_tostring(L, -1)); \
if (!*option) option_labels[i] += 4; \
} while (false)
+#define find_active(w) (w != NULL)
// Curses command entry and statusbar.
static bool command_entry_focused;
int statusbar_length[2];
@@ -490,6 +492,8 @@ static int find_index(lua_State *L) {
lua_pushboolean(L, checked(regex));
else if (strcmp(key, "in_files") == 0)
lua_pushboolean(L, checked(in_files));
+ else if (strcmp(key, "active") == 0)
+ lua_pushboolean(L, find_active(findbox));
else
lua_rawget(L, 1);
return 1;