@@ -1172,6 +1172,16 @@ private void AddedLineAboveCommand(object sender, ExecutedRoutedEventArgs e)
1172
1172
PassedTextControl . Select ( replaceCaret , 0 ) ;
1173
1173
}
1174
1174
1175
+ private void DuplicateSelectedLine ( object sender , ExecutedRoutedEventArgs e )
1176
+ {
1177
+ int replaceCaret = PassedTextControl . CaretIndex ;
1178
+ int selectionLength = PassedTextControl . SelectionLength ;
1179
+ SelectLine ( ) ;
1180
+ string lineText = PassedTextControl . SelectedText ;
1181
+ PassedTextControl . SelectedText = lineText + Environment . NewLine + lineText ;
1182
+ PassedTextControl . Select ( replaceCaret + ( Environment . NewLine . Length + lineText . Length ) , selectionLength ) ;
1183
+ }
1184
+
1175
1185
private void MarginsMenuItem_Checked ( object sender , RoutedEventArgs e )
1176
1186
{
1177
1187
if ( sender is not MenuItem marginsMenuItem )
@@ -1820,6 +1830,10 @@ private void SetupRoutedCommands()
1820
1830
RoutedCommand AddedLineAbove = new ( ) ;
1821
1831
_ = AddedLineAbove . InputGestures . Add ( new KeyGesture ( Key . Enter , ModifierKeys . Control ) ) ;
1822
1832
_ = CommandBindings . Add ( new CommandBinding ( AddedLineAbove , AddedLineAboveCommand ) ) ;
1833
+
1834
+ RoutedCommand duplicateLine = new ( ) ;
1835
+ _ = duplicateLine . InputGestures . Add ( new KeyGesture ( Key . D , ModifierKeys . Control ) ) ;
1836
+ _ = CommandBindings . Add ( new CommandBinding ( duplicateLine , DuplicateSelectedLine ) ) ;
1823
1837
}
1824
1838
1825
1839
private void SingleLineCmdCanExecute ( object sender , CanExecuteRoutedEventArgs e )
0 commit comments