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


C# IEditor.DeleteText方法代码示例

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


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

示例1: Run


//.........这里部分代码省略.........
                    {
                        if (match.Index >= iColumn)
                            break;

                        newX = match.Index;
                    }
                }

                // :: new position is not found in the line
                if (newX < 0)
                {
                    if (alt || line != null)
                        return;

                    if (right)
                    {
                        if (++iLine >= editor.Count)
                            return;

                        iColumn = -1;
                    }
                    else
                    {
                        if (--iLine < 0)
                            return;

                        iColumn = int.MaxValue;
                    }

                    continue;
                }

                if (operation == Operation.Step)
                {
                    // :: step
                    if (line == null)
                    {
                        editor.GoTo(newX, iLine);
                        editor.UnselectText();
                        editor.Redraw();
                    }
                    else
                    {
                        //_100819_142053 Mantis#1464 Here was a kludge

                        line.UnselectText();
                        line.Caret = newX;
                    }
                }
                else if (operation == Operation.Select)
                {
                    // :: select
                    if (alt)
                        SelectColumn(editor, right, iLine, caret.X, newX);
                    else
                        SelectStream(editor, line, right, caret, new Point(newX, iLine));
                }
                else
                {
                    // :: delete
                    if (line == null)
                    {
                        if (!right && newX == 0 && caret.X > 0 && currentLine.Length == 0)
                        {
                            // "Cursor beyond end of line" and the line is empty
                            editor.UnselectText();
                            editor.GoToColumn(0);
                        }
                        else
                        {
                            // select the step text and delete it
                            if (!editor.SelectionExists)
                            {
                                if (right)
                                    editor.SelectText(caret.X, caret.Y, newX - 1, iLine);
                                else
                                    editor.SelectText(newX, iLine, caret.X - 1, caret.Y);
                            }
                            editor.DeleteText();
                        }
                        editor.Redraw();
                    }
                    else
                    {
                        if (line.SelectionSpan.Length <= 0)
                        {
                            if (right)
                                line.SelectText(caret.X, newX);
                            else
                                line.SelectText(newX, caret.X);
                        }
                        newX = line.SelectionSpan.Start;
                        line.SelectedText = string.Empty;
                        line.Caret = newX;
                    }
                }

                return;
            }
        }
开发者ID:pezipink,项目名称:FarNet,代码行数:101,代码来源:TheCommand.cs


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