示例#1
0
        void TagApplied(object sender, Gtk.TagAppliedArgs args)
        {
            bool remove = false;

            if (args.Tag.Name == "gtkspell-misspelled")
            {
                // Remove misspelled tag for links & title
                foreach (Gtk.TextTag tag in args.StartChar.Tags)
                {
                    if (tag != args.Tag &&
                        !NoteTagTable.TagIsSpellCheckable(tag))
                    {
                        remove = true;
                        break;
                    }
                }
            }
            else if (!NoteTagTable.TagIsSpellCheckable(args.Tag))
            {
                remove = true;
            }

            if (remove)
            {
                Buffer.RemoveTag("gtkspell-misspelled",
                                 args.StartChar,
                                 args.EndChar);
            }
        }
示例#2
0
 void OnTagApplied(object sender, Gtk.TagAppliedArgs args)
 {
     if (frozen_cnt == 0)
     {
         if (NoteTagTable.TagIsUndoable(args.Tag))
         {
             AddUndoAction(new TagApplyAction(args.Tag,
                                              args.StartChar,
                                              args.EndChar));
         }
     }
 }
示例#3
0
        void TagApplied(object sender, Gtk.TagAppliedArgs args)
        {
            bool remove = false;

            if (args.Tag.Name == "gtkspell-misspelled")
            {
                // Remove misspelled tag for links & title
                foreach (Gtk.TextTag tag in args.StartChar.Tags)
                {
                    if (tag != args.Tag &&
                        !NoteTagTable.TagIsSpellCheckable(tag))
                    {
                        remove = true;
                        break;
                    }
                }
                // Remove misspelled tag for acronyms (in all caps)
                if (!args.StartChar.EndsWord() && System.Char.IsUpper(args.StartChar.Char, 0))
                {
                    Gtk.TextIter char_iter = args.StartChar;
                    remove = true;
                    while (!char_iter.EndsWord())
                    {
                        if (Char.IsLower(char_iter.Char, 0))
                        {
                            remove = false;
                            break;
                        }
                        else
                        {
                            char_iter.ForwardChar();
                        }
                    }
                }
            }
            else if (!NoteTagTable.TagIsSpellCheckable(args.Tag))
            {
                remove = true;
            }

            if (remove)
            {
                Buffer.RemoveTag("gtkspell-misspelled",
                                 args.StartChar,
                                 args.EndChar);
            }
        }