当前位置: 首页>>代码示例>>C#>>正文


C# TextBuffer.GetIterAtMark方法代码示例

本文整理汇总了C#中Gtk.TextBuffer.GetIterAtMark方法的典型用法代码示例。如果您正苦于以下问题:C# TextBuffer.GetIterAtMark方法的具体用法?C# TextBuffer.GetIterAtMark怎么用?C# TextBuffer.GetIterAtMark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.TextBuffer的用法示例。


在下文中一共展示了TextBuffer.GetIterAtMark方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdCursorLocation

    protected void UpdCursorLocation(TextBuffer tb)
    {
        TextIter ti = tb.GetIterAtMark(tb.InsertMark);

          cursorLineNo = ti.Line + 1;
          cursorColumnNo = ti.LineOffset + 1;

          // Update cursor position on status bar:

          StatusBarCursorPosLabel.Text = "(" + cursorLineNo.ToString() + ", " +
          cursorColumnNo.ToString() + ")";
    }
开发者ID:bblock,项目名称:PipeWrench,代码行数:12,代码来源:MainWindow.cs

示例2: FormatTextBuffer

 private void FormatTextBuffer(TextBuffer textBuffer, XmlNode linkTextNode)
 {
     XmlNodeList childNodes = linkTextNode.ChildNodes;
        foreach(XmlNode childNode in childNodes)
        {
     if (childNode.Name.Equals("a"))
     {
      XmlAttribute href = childNode.Attributes["href"];
      if (href != null)
      {
       string textTagName = href.Value;
       TextTag textTag = textBuffer.TagTable.Lookup(textTagName);
       if (textTag != null)
       {
        TextMark startTagMark = textBuffer.CreateMark(textTagName, textBuffer.EndIter, true);
        textBuffer.InsertAtCursor(childNode.InnerText);
        TextIter startTagIter = textBuffer.GetIterAtMark(startTagMark);
        TextIter endTagIter = textBuffer.EndIter;
        textBuffer.ApplyTag(textTag, startTagIter, endTagIter);
       }
      }
      else
       textBuffer.InsertAtCursor(childNode.InnerText);
     }
     else
     {
      textBuffer.InsertAtCursor(childNode.InnerText);
     }
        }
        textBuffer.ApplyTag("small-font", textBuffer.StartIter, textBuffer.EndIter);
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:31,代码来源:NotifyWindow.cs

示例3: GetSqlStatementAtCursor

        // Execute first SQL statement at cursor
        public string GetSqlStatementAtCursor(TextBuffer sqlTextBuffer, out TextIter iter)
        {
            TextIter start_iter, end_iter, insert_iter;
            TextIter match_start1, match_end1, match_start2, match_end2;
            TextIter begin_iter, finish_iter;
            string text = String.Empty;
            int char_count = 0;
            TextMark insert_mark;

            insert_mark = sqlTextBuffer.InsertMark;
            insert_iter = sqlTextBuffer.GetIterAtMark (insert_mark);
            start_iter = sqlTextBuffer.GetIterAtOffset (0);

            char_count = sqlTextBuffer.CharCount;
            end_iter = sqlTextBuffer.GetIterAtOffset (char_count);
            iter = end_iter;

            match_start1 = sqlTextBuffer.GetIterAtOffset (0);
            match_end1 = sqlTextBuffer.GetIterAtOffset (char_count);
            match_start2 = sqlTextBuffer.GetIterAtOffset (0);
            match_end2 = sqlTextBuffer.GetIterAtOffset (char_count);

            begin_iter = sqlTextBuffer.GetIterAtOffset (0);
            finish_iter = sqlTextBuffer.GetIterAtOffset (char_count);

            if (start_iter.IsEnd == false)
            {
                if (insert_iter.BackwardSearch (";", TextSearchFlags.TextOnly,
                        out match_start1, out match_end1, start_iter) == true) {
                    begin_iter = match_start1;
                    begin_iter.ForwardChars (1);
                }

                if (insert_iter.ForwardSearch (";",	TextSearchFlags.TextOnly,
                        out match_start2, out match_end2, end_iter) == true) {
                    finish_iter = match_end2;
                    finish_iter.BackwardChars (1);
                }
                iter = finish_iter;
                text = sqlTextBuffer.GetText (begin_iter, finish_iter, false);

                // FIXME: for this to work.  GetSqlStatement has to rewritten to be line-based
                if (text.Length > 0) {
                    // search does not work if what you are searching for is
                    // at the end of the buffer,
                    // this compensates for this
                    int j = text.Length;
                    int cont = 1;
                    for(int i = text.Length - 1; cont == 1 && i >= 0; i--) {
                        char ch = text[i];
                        switch(ch) {
                        case ' ':
                        case ';':
                            j--;
                            break;
                        default:
                            cont = 0;
                            break;
                        }
                    }

                    if (j != text.Length) {
                        string t = text.Substring(0, j);
                        text = t;
                    }
                }
            }

            return text;
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:71,代码来源:SqlQueryView.cs


注:本文中的Gtk.TextBuffer.GetIterAtMark方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。