[tomboy] Don't create links inside of links
- From: Aaron Borden <adborden src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tomboy] Don't create links inside of links
- Date: Sat, 20 Aug 2011 21:38:58 +0000 (UTC)
commit 77dc2ab38bedc0f3ef067dfda5431e8cc93bddaf
Author: Aaron Borden <adborden live com>
Date: Fri Jun 10 14:18:29 2011 -0700
Don't create links inside of links
https://bugzilla.gnome.org/show_bug.cgi?id=627060
Tomboy/NoteTag.cs | 5 +++++
Tomboy/Watchers.cs | 13 ++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/Tomboy/NoteTag.cs b/Tomboy/NoteTag.cs
index 1e56b3f..410113b 100644
--- a/Tomboy/NoteTag.cs
+++ b/Tomboy/NoteTag.cs
@@ -699,6 +699,11 @@ namespace Tomboy
return false;
}
+ public bool HasLinkTag (Gtk.TextIter iter)
+ {
+ return iter.HasTag (LinkTag) || iter.HasTag (UrlTag) || iter.HasTag (BrokenLinkTag);
+ }
+
public DepthNoteTag GetDepthTag(int depth, Pango.Direction direction)
{
string name = "depth:" + depth + ":" + direction;
diff --git a/Tomboy/Watchers.cs b/Tomboy/Watchers.cs
index 4c906d8..f700925 100644
--- a/Tomboy/Watchers.cs
+++ b/Tomboy/Watchers.cs
@@ -755,7 +755,7 @@ namespace Tomboy
return;
// Don't create links inside URLs
- if (title_start.HasTag (Note.TagTable.UrlTag))
+ if (Note.TagTable.HasLinkTag (title_start))
return;
Logger.Debug ("Matching Note title '{0}' at {1}-{2}...",
@@ -930,16 +930,19 @@ namespace Tomboy
match = match.NextMatch ()) {
System.Text.RegularExpressions.Group group = match.Groups [1];
- Logger.Debug ("Highlighting wikiword: '{0}' at offset {1}",
- group,
- group.Index);
-
Gtk.TextIter start_cpy = start;
start_cpy.ForwardChars (group.Index);
end = start_cpy;
end.ForwardChars (group.Length);
+ if (Note.TagTable.HasLinkTag (start_cpy))
+ break;
+
+ Logger.Debug ("Highlighting wikiword: '{0}' at offset {1}",
+ group,
+ group.Index);
+
if (Manager.Find (group.ToString ()) == null) {
Buffer.ApplyTag (broken_link_tag, start_cpy, end);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]