diff options
author | 2020-07-25 19:04:03 -0400 | |
---|---|---|
committer | 2020-07-25 19:04:03 -0400 | |
commit | dfcb98978d6fba1d9a79279d01b05cc2fd184556 (patch) | |
tree | 73c4866ffe16b8d76fe8c2c35f69e7de985aabfb /src/textadept.c | |
parent | 0d5da9856b32cfd1cd91704f32620c00af82b125 (diff) | |
download | textadept-dfcb98978d6fba1d9a79279d01b05cc2fd184556.tar.gz textadept-dfcb98978d6fba1d9a79279d01b05cc2fd184556.zip |
Fixed initial setting of `ui.find.replace_entry_text` in the GUI.
GtkEntries are initialized with the same initial text pointer, which makes it
impossible to initially differentiate between `find_text` and `repl_text` by
their text pointers alone.
Diffstat (limited to 'src/textadept.c')
-rw-r--r-- | src/textadept.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/textadept.c b/src/textadept.c index ac8188c5..c30899e2 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -121,7 +121,7 @@ static GtkWidget *findbox, *find_entry, *repl_entry, *find_label, *repl_label; #define find_text gtk_entry_get_text(GTK_ENTRY(find_entry)) #define repl_text gtk_entry_get_text(GTK_ENTRY(repl_entry)) #define set_entry_text(entry, text) gtk_entry_set_text( \ - GTK_ENTRY(entry == find_entry ? find_entry : repl_entry), text) + GTK_ENTRY(entry == find_text ? find_entry : repl_entry), text) typedef GtkWidget *FindButton; static FindButton find_next, find_prev, replace, replace_all; static GtkWidget *match_case, *whole_word, *regex, *in_files; @@ -474,9 +474,9 @@ static int focus_find(lua_State *L) { static int find_index(lua_State *L) { const char *key = lua_tostring(L, 2); if (strcmp(key, "find_entry_text") == 0) - find_text ? lua_pushstring(L, find_text) : lua_pushliteral(L, ""); + lua_pushstring(L, find_text); else if (strcmp(key, "replace_entry_text") == 0) - repl_text ? lua_pushstring(L, repl_text) : lua_pushliteral(L, ""); + lua_pushstring(L, repl_text); else if (strcmp(key, "match_case") == 0) lua_pushboolean(L, checked(match_case)); else if (strcmp(key, "whole_word") == 0) @@ -2169,6 +2169,8 @@ static GtkWidget *new_combo( gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(combo), 0); gtk_combo_box_set_focus_on_click(GTK_COMBO_BOX(combo), false); *entry = gtk_bin_get_child(GTK_BIN(combo)); + gtk_entry_set_text(GTK_ENTRY(*entry), " "), + gtk_entry_set_text(GTK_ENTRY(*entry), ""); // initialize with non-NULL gtk_entry_set_activates_default(GTK_ENTRY(*entry), true); gtk_label_set_mnemonic_widget(GTK_LABEL(*label), *entry); return combo; |