GNOME Bugzilla – Bug 134674
Regular expression searches
Last modified: 2013-08-19 14:16:34 UTC
GtkSourceView should support regular expression searches natively through some GtkSourceIter API.
WOW... Any idea on how to implement it in an efficient way, i.e. without putting the entire documnt in a buffer?
Well, since we depend on GNU regexes, we can take advantage of re_search_2 which searches on split data, and perform the search on small chunks.
*** Bug 369269 has been marked as a duplicate of this bug. ***
With GRegex, g_match_info_is_partial_match() can be useful. The text of the buffer can be retrieved chunks by chunks with gtk_text_buffer_get_text(). If there is a full match, we return the corresponding GtkTextIter's. If there is a partial match, we take a bigger chunk. For the search and replace feature, the performances should be OK.
Move GtkTextView -> GtkSourceView.
It will be easier to implement in gsv, if GTK_TEXT_SEARCH_VISIBLE_ONLY and GTK_TEXT_SEARCH_TEXT_ONLY are always enabled. In gtk+, we must support all flags combinations.
Implemented in GtkSourceView.