[vte] app: Add tooltip with the regex compile error on the search entry
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] app: Add tooltip with the regex compile error on the search entry
- Date: Sat, 26 Dec 2015 11:27:46 +0000 (UTC)
commit c2a0b3e8bf1c1bfe8709565c3a1d6b099dec7464
Author: Christian Persch <chpe gnome org>
Date: Sat Dec 26 12:27:22 2015 +0100
app: Add tooltip with the regex compile error on the search entry
When compiling the regex fails, set the error message as tooltip
on the search entry; when it succeeds, clear the tooltip.
src/app.vala | 3 +++
src/vteregex.cc | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index e06d884..0dcb3b9 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -156,17 +156,20 @@ class SearchPopover : Gtk.Popover
}
regex_pattern = pattern;
+ search_entry.set_tooltip_text(null);
} catch (Error e) {
#if WITH_PCRE2
regex = null;
#endif
gregex = null;
+ search_entry.set_tooltip_text(e.message);
}
} else {
#if WITH_PCRE2
regex = null;
#endif
gregex = null;
+ search_entry.set_tooltip_text(null);
}
#if WITH_PCRE2
diff --git a/src/vteregex.cc b/src/vteregex.cc
index 4b56b37..16dc0fa 100644
--- a/src/vteregex.cc
+++ b/src/vteregex.cc
@@ -191,9 +191,9 @@ vte_regex_new(const char *pattern,
&errcode, &erroffset,
NULL);
- if (code == 0) {
+ if (code == nullptr) {
set_gerror_from_pcre_error(errcode, error);
- g_prefix_error(error, "Failed to compile pattern to regex at %" G_GSIZE_FORMAT ":",
+ g_prefix_error(error, "Failed to compile pattern to regex at offset %" G_GSIZE_FORMAT ":",
erroffset);
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]