[gnote] Fix a regression in the URL detection introduced in 0.5.0
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] Fix a regression in the URL detection introduced in 0.5.0
- Date: Fri, 19 Jun 2009 18:07:57 -0400 (EDT)
commit 26449802d19b8c9ce88a8855fce9c3f219e27f7c
Author: Hubert Figuiere <hub figuiere net>
Date: Fri Jun 19 17:48:24 2009 -0400
Fix a regression in the URL detection introduced in 0.5.0
when the URL is in a list or withing text with non-ASCII
characters.
NEWS | 4 ++++
src/watchers.cpp | 6 ++++--
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index b5e3813..49c60d2 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@
Fixes:
+ * Fix a regression in the URL detection introduced in 0.5.0
+ when the URL is in a list or withing text with non-ASCII
+ characters.
+
Translations:
* Updated translations:
diff --git a/src/watchers.cpp b/src/watchers.cpp
index a5c0095..91d4fc5 100644
--- a/src/watchers.cpp
+++ b/src/watchers.cpp
@@ -519,7 +519,8 @@ namespace gnote {
// must construct the Glib::ustring from a char *.
// otherwise it expect the num of chars (UTF-8) instead of bytes.
// here we compute the index of the URL. It is anchor - start - match.
- Glib::ustring segment(p, input.data() - p - match1.size());
+ Glib::ustring::size_type len = input.data() - p - match1.size();
+ Glib::ustring segment(p, p + len);
start_cpy.forward_chars (segment.size());
end = start_cpy;
@@ -1036,7 +1037,8 @@ namespace gnote {
if (!is_patronymic_name (match)) {
Gtk::TextIter start_cpy = start;
- Glib::ustring segment(std::string(p, input.data() - p - match.size()));
+ Glib::ustring::size_type len = input.data() - p - match.size();
+ Glib::ustring segment(p, p + len);
start_cpy.forward_chars (segment.length());
DBG_OUT("Highlighting wikiword: '%s' at offset %d",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]