diff --git a/Codist/Helpers/TextEditorHelper.cs b/Codist/Helpers/TextEditorHelper.cs index 2bfaac18..f14c7252 100644 --- a/Codist/Helpers/TextEditorHelper.cs +++ b/Codist/Helpers/TextEditorHelper.cs @@ -104,15 +104,15 @@ public static bool Mark(this IPropertyOwner owner, TKey mark) { #region Selection public static void ExpandSelectionToLine(this ITextView view) { - view.ExpandSelectionToLine(true); + view.ExpandSelectionToLine(false); } - public static void ExpandSelectionToLine(this ITextView view, bool includeLineBreak) { + public static void ExpandSelectionToLine(this ITextView view, bool excludeLineBreak) { var start = view.TextSnapshot.GetLineFromPosition(view.Selection.Start.Position).Start; var end = view.Selection.End.Position; var endLine = view.TextSnapshot.GetLineFromPosition(end); if (endLine.Start != end) { // if selection not ended in line break, expand to line break - end = includeLineBreak ? endLine.EndIncludingLineBreak : endLine.End; + end = excludeLineBreak ? endLine.End : endLine.EndIncludingLineBreak; } view.Selection.Select(new SnapshotSpan(start, end), false); } diff --git a/Codist/SmartBars/SmartBar.CommonEdit.cs b/Codist/SmartBars/SmartBar.CommonEdit.cs index e50266af..0b81b817 100644 --- a/Codist/SmartBars/SmartBar.CommonEdit.cs +++ b/Codist/SmartBars/SmartBar.CommonEdit.cs @@ -25,7 +25,7 @@ partial class SmartBar static void ExecuteAndFind(CommandContext ctx, string command, string text) { if (ctx.RightClick) { - ctx.View.ExpandSelectionToLine(false); + ctx.View.ExpandSelectionToLine(true); } ctx.KeepToolBar(false); TextEditorHelper.ExecuteEditorCommand(command);