Fixed replacing
This commit is contained in:
parent
2437dc3da2
commit
dec19edcdb
|
@ -42,13 +42,13 @@ gm_searchable_text_view_find_next(GtkTextView *text_view, const gchar *str,
|
|||
|
||||
if (buffer) {
|
||||
if (!gtk_text_buffer_get_selection_bounds(buffer, &start, &end)) {
|
||||
// For editables, search from the insertion position
|
||||
if (gtk_text_view_get_editable(text_view)) {
|
||||
// For cursor_visibles, search from the insertion position
|
||||
if (gtk_text_view_get_cursor_visible(text_view)) {
|
||||
gtk_text_buffer_get_iter_at_mark(buffer, &end,
|
||||
gtk_text_buffer_get_insert(buffer));
|
||||
} else {
|
||||
// For non editables, search from start (or end, depending on
|
||||
// the search direction
|
||||
// For non cursor_visibles, search from start (or end,
|
||||
// depending on2 the search direction
|
||||
if (flags & GM_SEARCHABLE_SEARCH_FORWARDS) {
|
||||
gtk_text_buffer_get_start_iter(buffer, &end);
|
||||
} else {
|
||||
|
@ -278,13 +278,13 @@ gm_searchable_replace(GmSearchable *self, const gchar *replace) {
|
|||
text_view = gm_searchable_interface_get_text_view(self, iface);
|
||||
|
||||
if (text_view && gtk_text_view_get_editable(text_view)) {
|
||||
return gm_searchable_text_view_replace(text_view, replace, flags);
|
||||
return gm_searchable_text_view_replace(text_view, replace);
|
||||
} else {
|
||||
g_return_val_if_reached(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return (* iface->replace) (self, replace, flags);
|
||||
return (* iface->replace) (self, replace);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -47,9 +47,8 @@ gboolean gm_searchable_find_next(GmSearchable *self, const gchar *str,
|
|||
GmSearchableSearchFlags flags);
|
||||
|
||||
gboolean gm_searchable_can_replace(GmSearchable *self);
|
||||
gboolean gm_searchable_replace(GmSearchable *self, gchar const *str,
|
||||
GmSearchableSearchFlags flags);
|
||||
gboolean gm_searchable_replace(GmSearchable *self, gchar const *replace);
|
||||
gboolean gm_searchable_replace_all(GmSearchable *self, gchar const *str,
|
||||
GmSearchableSearchFlags flags);
|
||||
gchar const *replace, GmSearchableSearchFlags flags);
|
||||
|
||||
#endif /* __GM_SEARCHABLE_H__ */
|
||||
|
|
Reference in New Issue