[gtksourceview] SearchContext: add a note to the implementation overview
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] SearchContext: add a note to the implementation overview
- Date: Sun, 29 Dec 2013 23:07:19 +0000 (UTC)
commit dfddc66a40eb563a7b0fb19afc5598c2168d6207
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Dec 30 00:03:08 2013 +0100
SearchContext: add a note to the implementation overview
I thought that navigating through the occurrences with
gtk_text_iter_forward_to_tag_toggle() was a bit over-engineered, and
that it would have been much simpler to always search again in the
buffer. But with some retrospect, in this case, multiple-lines regex
matches would not have been possible.
gtksourceview/gtksourcesearchcontext.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index 1ce42b6..fef92ef 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -74,8 +74,8 @@
* at position 1, you will get the occurrence [2:4], not [1:3]. This is a
* prerequisite for regular expression searches. The pattern ".*" matches the
* entire line. If the cursor is at the middle of the line, you don't want the
- * rest of the line as the occurrence, you want an entire line. As a side note,
- * regular expression searches can also match multiple lines.
+ * rest of the line as the occurrence, you want an entire line. (As a side note,
+ * regular expression searches can also match multiple lines.)
*
* In the GtkSourceView source code, there is an example of how to use the
* search and replace API: see the tests/test-search.c file. It is a mini
@@ -153,6 +153,9 @@
* choices:
* - Write more unit tests, understand correctly the code and fix it.
* - Rewrite the code to implement the simpler solution explained above :-)
+ * But with the simpler solution, multiple-lines regex search matches (see
+ * below) would not be possible for going to the previous occurrence (or the
+ * buffer must always be scanned from the beginning).
*
* Known issue
* -----------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]