Exemple #1
0
 private void ExecuteGoToLineCommand()
 {
     using (var dlg = new GoToLineDialog(TextEditor)) {
         var result = dlg.ShowDialog(this);
         if (result == Forms.DialogResult.OK)
         {
             int lineNumber = dlg.Line;
             var line       = Doc.GetLineByNumber(lineNumber);
             int offset     = line.Offset;
             if (TextUtilities.GetLeadingWhitespace(Doc, line).Length > 0)
             {
                 offset = TextUtilities.GetNextCaretPosition(Doc, offset, LogicalDirection.Forward, CaretPositioningMode.WordBorder);
             }
             TextEditor.CaretOffset = offset;
         }
     }
 }
 private void ExecuteGoToLineCommand() {
   using (var dlg = new GoToLineDialog(TextEditor)) {
     var result = dlg.ShowDialog(this);
     if (result == Forms.DialogResult.OK) {
       int lineNumber = dlg.Line;
       var line = Doc.GetLineByNumber(lineNumber);
       int offset = line.Offset;
       if (TextUtilities.GetLeadingWhitespace(Doc, line).Length > 0)
         offset = TextUtilities.GetNextCaretPosition(Doc, offset, LogicalDirection.Forward, CaretPositioningMode.WordBorder);
       TextEditor.CaretOffset = offset;
     }
   }
 }