[gnote] Remove exclusion list for prefixes in WikiWords (Tomboy Bug #392627) (tb-backport)



commit efa9c01882f7240837abb6caa4277689aa9eead0
Author: Hubert Figuiere <hub figuiere net>
Date:   Thu Jul 16 21:45:41 2009 -0400

    Remove exclusion list for prefixes in WikiWords (Tomboy Bug #392627) (tb-backport)

 src/watchers.cpp |   49 +++++++++++--------------------------------------
 src/watchers.hpp |    1 -
 2 files changed, 11 insertions(+), 39 deletions(-)
---
diff --git a/src/watchers.cpp b/src/watchers.cpp
index cbea675..101689d 100644
--- a/src/watchers.cpp
+++ b/src/watchers.cpp
@@ -978,30 +978,6 @@ namespace gnote {
     }
   }
 
-  static const char * PATRONYMIC_PREFIXES[] = { 
-    "Mc", 
-    "Mac", 
-    "Le", 
-    "La", 
-    "De", 
-    "Van",
-    NULL
-  };
-
-  bool NoteWikiWatcher::is_patronymic_name (const std::string & word)
-  {
-    const char **prefix = PATRONYMIC_PREFIXES;
-    while(*prefix) {
-      if (sharp::string_starts_with(word, *prefix) &&
-          isupper(word [strlen(*prefix)])) {
-        return true;
-      }
-      prefix++;
-    }
-
-    return false;
-  }
-
   void NoteWikiWatcher::apply_wikiword_to_block (Gtk::TextIter start, Gtk::TextIter end)
   {
     NoteBuffer::get_block_extents (start,
@@ -1019,23 +995,20 @@ namespace gnote {
 
     while(m_regex.FindAndConsume(&input, &match)) {
 
-      if (!is_patronymic_name (match)) {
-      
-        Gtk::TextIter start_cpy = start;
-        Glib::ustring::size_type len = input.data() - p - match.size();
-        Glib::ustring segment(p, p + len);
-        start_cpy.forward_chars (segment.length());
+      Gtk::TextIter start_cpy = start;
+      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",
-                match.c_str(), segment.length());
+      DBG_OUT("Highlighting wikiword: '%s' at offset %d",
+              match.c_str(), segment.length());
 
-        end = start_cpy;
-        segment = match;
-        end.forward_chars (segment.length());
+      end = start_cpy;
+      segment = match;
+      end.forward_chars (segment.length());
 
-        if (!manager().find(match)) {
-          get_buffer()->apply_tag (m_broken_link_tag, start_cpy, end);
-        }
+      if (!manager().find(match)) {
+        get_buffer()->apply_tag (m_broken_link_tag, start_cpy, end);
       }
     }
   }
diff --git a/src/watchers.hpp b/src/watchers.hpp
index f2028d5..1a934bc 100644
--- a/src/watchers.hpp
+++ b/src/watchers.hpp
@@ -213,7 +213,6 @@ namespace gnote {
       }
   private:
     void on_enable_wikiwords_changed(Preferences *, GConfEntry *);
-    static bool is_patronymic_name (const std::string & word);
     void apply_wikiword_to_block (Gtk::TextIter start, Gtk::TextIter end);
     void on_delete_range(const Gtk::TextIter &,const Gtk::TextIter &);
     void on_insert_text(const Gtk::TextIter &, const Glib::ustring &, int);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]