Skip to content

Commit

Permalink
for multi-edit mode, show a different string in the status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
stefankueng committed Apr 15, 2023
1 parent c690978 commit 1776a3c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
Binary file modified src/BowPad.rc
Binary file not shown.
33 changes: 25 additions & 8 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2169,6 +2169,7 @@ void CMainWindow::UpdateStatusBar(bool bEverything)
static ResString rsStatusSelection(g_hRes, IDS_STATUSSELECTION); // Sel: %Iu chars | %Iu lines | %ld matches.
static ResString rsStatusSelectionLong(g_hRes, IDS_STATUSSELECTIONLONG); // Selection: %Iu chars | %Iu lines | %ld matches.
static ResString rsStatusSelectionNone(g_hRes, IDS_STATUSSELECTIONNONE); // no selection
static ResString rsStatusMultiEdit(g_hRes, IDS_STATUSMULTIEDIT); // Multiedit: %Iu markers
static ResString rsStatusTTTabSpaces(g_hRes, IDS_STATUSTTTABSPACES); // Insert Tabs or Spaces
static ResString rsStatusTTR2L(g_hRes, IDS_STATUSTTR2L); // Reading order (left-to-right or right-to-left)
static ResString rsStatusTTEncoding(g_hRes, IDS_STATUSTTENCODING); // Encoding: %s
Expand All @@ -2189,6 +2190,7 @@ void CMainWindow::UpdateStatusBar(bool bEverything)
long column = static_cast<long>(m_editor.Scintilla().Column(curPos)) + 1;
auto lengthInBytes = m_editor.Scintilla().Length();
auto bidi = m_editor.Scintilla().Bidirectional();
auto selections = m_editor.Scintilla().Selections();

wchar_t readableLength[100] = {0};
StrFormatByteSize(lengthInBytes, readableLength, _countof(readableLength));
Expand All @@ -2208,14 +2210,29 @@ void CMainWindow::UpdateStatusBar(bool bEverything)
0,
true);
auto sNoSel = CStringUtils::Format(rsStatusSelectionNone, GetSysColor(COLOR_GRAYTEXT));
m_statusBar.SetPart(STATUSBAR_SEL,
selByte ? CStringUtils::Format(rsStatusSelectionLong, numberColor, selByte, numberColor, selLine, (selTextMarkerCount ? 0x008000 : numberColor), selTextMarkerCount) : sNoSel,
selByte ? CStringUtils::Format(rsStatusSelection, numberColor, selByte, numberColor, selLine, (selTextMarkerCount ? 0x008000 : numberColor), selTextMarkerCount) : sNoSel,
CStringUtils::Format(rsStatusTTCurPos, line, column, selByte, selLine, selTextMarkerCount),
250,
200,
0,
true);
if (selections > 1)
{
auto text = CStringUtils::Format(rsStatusMultiEdit, numberColor, selections);
m_statusBar.SetPart(STATUSBAR_SEL,
text,
text,
text,
250,
200,
0,
true);
}
else
{
m_statusBar.SetPart(STATUSBAR_SEL,
selByte ? CStringUtils::Format(rsStatusSelectionLong, numberColor, selByte, numberColor, selLine, (selTextMarkerCount ? 0x008000 : numberColor), selTextMarkerCount) : sNoSel,
selByte ? CStringUtils::Format(rsStatusSelection, numberColor, selByte, numberColor, selLine, (selTextMarkerCount ? 0x008000 : numberColor), selTextMarkerCount) : sNoSel,
CStringUtils::Format(rsStatusTTCurPos, line, column, selByte, selLine, selTextMarkerCount),
250,
200,
0,
true);
}

auto overType = m_editor.Scintilla().Overtype();
m_statusBar.SetPart(STATUSBAR_TYPING_MODE,
Expand Down
1 change: 1 addition & 0 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
#define IDS_CLICKTOCOPYTOCLIPBOARD 278
#define IDS_FILETREE_EMPTY 279
#define IDS_FILETREE_TOO_MANY_FILES 280
#define IDS_STATUSMULTIEDIT 281
#define IDC_SEARCHCOMBO 1000
#define IDC_FINDBTN 1001
#define IDC_REPLACECOMBO 1002
Expand Down

0 comments on commit 1776a3c

Please sign in to comment.