From 63c335959e2b9b6f5df801fa540f7203a840e92b Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Wed, 24 Aug 2022 07:06:27 -0700 Subject: [PATCH] Draw selection info in the status bar --- IDE/src/ui/StatusBar.bf | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/IDE/src/ui/StatusBar.bf b/IDE/src/ui/StatusBar.bf index 51d9ed40..9c6188f6 100644 --- a/IDE/src/ui/StatusBar.bf +++ b/IDE/src/ui/StatusBar.bf @@ -270,7 +270,6 @@ namespace IDE.ui g.SetFont(DarkTheme.sDarkTheme.mSmallFont); bool showIndex = gApp.mSettings.mEnableDevMode; - EditWidget activeEditWidget = null; var activeDocument = gApp.GetActiveDocumentPanel(); if (activeDocument is SourceViewPanel) @@ -300,10 +299,37 @@ namespace IDE.ui using (g.PushColor(DarkTheme.COLOR_TEXT)) { - if (showIndex) + float leftX = 0; + if (activeEditWidget?.mEditWidgetContent.HasSelection() == true) + { + int lineCount = 1; + + var data = activeEditWidget.mEditWidgetContent.mData; + var sel = activeEditWidget.mEditWidgetContent.mSelection.GetValueOrDefault(); + for (int i in sel.MinPos..= mWidth - GS!(142)) + { + g.DrawString(StackStringFormat!("Ln {0}:{1}", lineAndColumn.mLine + 1, lineAndColumn.mColumn + 1), mWidth - GS!(32), 0, .Right); + } + else + { + g.DrawString(StackStringFormat!("Ln {0}", lineAndColumn.mLine + 1), Math.Max(leftX + GS!(8), mWidth - GS!(150)), 0); + g.DrawString(StackStringFormat!("Col {0}", lineAndColumn.mColumn + 1), mWidth - GS!(78), 0); + } } }