Changeset 11785
- Timestamp:
- 01/16/15 10:43:48 (10 years ago)
- Location:
- branches/CodeEditor/HeuristicLab.CodeEditor/3.4
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CodeEditor/HeuristicLab.CodeEditor/3.4/CodeEditor.cs
r11743 r11785 209 209 var moveLinesUpCommand = new Input.RoutedCommand(); 210 210 moveLinesUpCommand.InputGestures.Add(new Input.KeyGesture(Input.Key.Up, Input.ModifierKeys.Alt)); 211 var moveLinesUpCommandBinding = new Input.CommandBinding(moveLinesUpCommand, (sender, args) => MoveLines(MovementDirection.Up));211 var moveLinesUpCommandBinding = new Input.CommandBinding(moveLinesUpCommand, (sender, args) => ExecuteMoveLinesCommand(MovementDirection.Up)); 212 212 TextEditor.CommandBindings.Add(moveLinesUpCommandBinding); 213 213 #endregion … … 216 216 var moveLinesDownCommand = new Input.RoutedCommand(); 217 217 moveLinesDownCommand.InputGestures.Add(new Input.KeyGesture(Input.Key.Down, Input.ModifierKeys.Alt)); 218 var moveLinesDownCommandBinding = new Input.CommandBinding(moveLinesDownCommand, (sender, args) => MoveLines(MovementDirection.Down));218 var moveLinesDownCommandBinding = new Input.CommandBinding(moveLinesDownCommand, (sender, args) => ExecuteMoveLinesCommand(MovementDirection.Down)); 219 219 TextEditor.CommandBindings.Add(moveLinesDownCommandBinding); 220 #endregion 221 222 #region GoToLineCommand 223 var goToLineCommand = new Input.RoutedCommand(); 224 goToLineCommand.InputGestures.Add(new Input.KeyGesture(Input.Key.G, Input.ModifierKeys.Control)); 225 var goToLineCommandBinding = new Input.CommandBinding(goToLineCommand, (sender, args) => ExecuteGoToLineCommand()); 226 TextEditor.CommandBindings.Add(goToLineCommandBinding); 220 227 #endregion 221 228 … … 270 277 271 278 private enum MovementDirection { Up, Down } 272 private void MoveLines(MovementDirection movementDirection) {279 private void ExecuteMoveLinesCommand(MovementDirection movementDirection) { 273 280 var textArea = TextEditor.TextArea; 274 281 var selection = textArea.Selection; … … 366 373 } 367 374 375 private void ExecuteGoToLineCommand() { 376 using (var dlg = new GoToLineDialog(TextEditor)) { 377 var result = dlg.ShowDialog(this); 378 if (result == Forms.DialogResult.OK) { 379 int lineNumber = dlg.Line; 380 var line = Doc.GetLineByNumber(lineNumber); 381 int offset = line.Offset; 382 if (TextUtilities.GetLeadingWhitespace(Doc, line).Length > 0) 383 offset = TextUtilities.GetNextCaretPosition(Doc, offset, LogicalDirection.Forward, CaretPositioningMode.WordStart); 384 TextEditor.CaretOffset = offset; 385 } 386 } 387 } 388 368 389 #region Compiler Errors 369 390 public void ShowCompileErrors(CompilerErrorCollection compilerErrors) { -
branches/CodeEditor/HeuristicLab.CodeEditor/3.4/HeuristicLab.CodeEditor-3.4.csproj
r11722 r11785 125 125 <Compile Include="CodeViewer.Designer.cs"> 126 126 <DependentUpon>CodeViewer.cs</DependentUpon> 127 </Compile> 128 <Compile Include="GoToLineDialog.cs"> 129 <SubType>Form</SubType> 130 </Compile> 131 <Compile Include="GoToLineDialog.Designer.cs"> 132 <DependentUpon>GoToLineDialog.cs</DependentUpon> 127 133 </Compile> 128 134 <Compile Include="LanguageFeatures\CodeFolding\CodeFoldingResult.cs" />
Note: See TracChangeset
for help on using the changeset viewer.