From fe9286f41c18a872c4af846a62858da7ee3437d4 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 27 Dec 2021 09:35:34 -0500 Subject: [PATCH] Fix small selection issues after uncomment --- IDE/src/ui/SourceEditWidgetContent.bf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/IDE/src/ui/SourceEditWidgetContent.bf b/IDE/src/ui/SourceEditWidgetContent.bf index c9b2486f..f9363bf5 100644 --- a/IDE/src/ui/SourceEditWidgetContent.bf +++ b/IDE/src/ui/SourceEditWidgetContent.bf @@ -2390,6 +2390,19 @@ namespace IDE.ui return true; } + void FixSelection() + { + if (!HasSelection()) + return; + if (CursorTextPos >= mSelection.Value.MaxPos) + CursorTextPos = mSelection.Value.MaxPos; + if (mSelection.Value.MaxPos - mSelection.Value.MinPos <= 1) + { + mSelection = null; + return; + } + } + public bool ToggleComment(bool? doComment = null) { if (CheckReadOnly()) @@ -2519,6 +2532,8 @@ namespace IDE.ui if (prevSelection == null) mSelection = null; + FixSelection(); + return true; }