mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-26 23:34:44 +02:00
Add thousands separator for Summary and Statusbar
Fixes #1329, Fixes #2103
This commit is contained in:
parent
13e44916ed
commit
bd373788ad
@ -26,6 +26,7 @@
|
|||||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <sstream>
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <uxtheme.h>
|
#include <uxtheme.h>
|
||||||
@ -37,6 +38,7 @@
|
|||||||
|
|
||||||
WcharMbcsConvertor* WcharMbcsConvertor::_pSelf = new WcharMbcsConvertor;
|
WcharMbcsConvertor* WcharMbcsConvertor::_pSelf = new WcharMbcsConvertor;
|
||||||
|
|
||||||
|
typedef std::basic_stringstream<TCHAR> generic_stringstream;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -53,6 +55,13 @@ void printStr(const TCHAR *str2print)
|
|||||||
::MessageBox(NULL, str2print, TEXT(""), MB_OK);
|
::MessageBox(NULL, str2print, TEXT(""), MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generic_string commafyInt(size_t n)
|
||||||
|
{
|
||||||
|
generic_stringstream ss;
|
||||||
|
ss.imbue(std::locale(""));
|
||||||
|
ss << n;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
std::string getFileContent(const TCHAR *file2read)
|
std::string getFileContent(const TCHAR *file2read)
|
||||||
{
|
{
|
||||||
|
@ -71,6 +71,7 @@ generic_string getFolderName(HWND parent, const TCHAR *defaultDir = NULL);
|
|||||||
|
|
||||||
void printInt(int int2print);
|
void printInt(int int2print);
|
||||||
void printStr(const TCHAR *str2print);
|
void printStr(const TCHAR *str2print);
|
||||||
|
generic_string commafyInt(size_t n);
|
||||||
|
|
||||||
void writeLog(const TCHAR *logFileName, const char *log2write);
|
void writeLog(const TCHAR *logFileName, const char *log2write);
|
||||||
int filter(unsigned int code, struct _EXCEPTION_POINTERS *ep);
|
int filter(unsigned int code, struct _EXCEPTION_POINTERS *ep);
|
||||||
|
@ -3031,19 +3031,22 @@ void Notepad_plus::updateStatusBar()
|
|||||||
|
|
||||||
long selected_length = _pEditView->getSelectedLength();
|
long selected_length = _pEditView->getSelectedLength();
|
||||||
if (selected_length != -1)
|
if (selected_length != -1)
|
||||||
wsprintf(strSel, TEXT("Sel : %d | %d"), selected_length, selLine);
|
wsprintf(strSel, TEXT("Sel : %s | %s"), commafyInt(selected_length).c_str(), commafyInt(selLine).c_str());
|
||||||
else
|
else
|
||||||
wsprintf(strSel, TEXT("Sel : %s"), TEXT("N/A"));
|
wsprintf(strSel, TEXT("Sel : %s"), TEXT("N/A"));
|
||||||
|
|
||||||
wsprintf(strLnCol, TEXT("Ln : %d Col : %d %s"),\
|
wsprintf(strLnCol, TEXT("Ln : %s Col : %s %s"),
|
||||||
(_pEditView->getCurrentLineNumber() + 1), \
|
commafyInt(_pEditView->getCurrentLineNumber() + 1).c_str(),
|
||||||
(_pEditView->getCurrentColumnNumber() + 1),\
|
commafyInt(_pEditView->getCurrentColumnNumber() + 1).c_str(),
|
||||||
strSel);
|
strSel);
|
||||||
|
|
||||||
_statusBar.setText(strLnCol, STATUSBAR_CUR_POS);
|
_statusBar.setText(strLnCol, STATUSBAR_CUR_POS);
|
||||||
|
|
||||||
TCHAR strDocLen[256];
|
TCHAR strDocLen[256];
|
||||||
wsprintf(strDocLen, TEXT("length : %d lines : %d"), _pEditView->getCurrentDocLen(), _pEditView->execute(SCI_GETLINECOUNT));
|
wsprintf(strDocLen, TEXT("length : %s lines : %s"),
|
||||||
|
commafyInt(_pEditView->getCurrentDocLen()).c_str(),
|
||||||
|
commafyInt(_pEditView->execute(SCI_GETLINECOUNT)).c_str());
|
||||||
|
|
||||||
_statusBar.setText(strDocLen, STATUSBAR_DOC_SIZE);
|
_statusBar.setText(strDocLen, STATUSBAR_DOC_SIZE);
|
||||||
_statusBar.setText(_pEditView->execute(SCI_GETOVERTYPE) ? TEXT("OVR") : TEXT("INS"), STATUSBAR_TYPING_MODE);
|
_statusBar.setText(_pEditView->execute(SCI_GETOVERTYPE) ? TEXT("OVR") : TEXT("INS"), STATUSBAR_TYPING_MODE);
|
||||||
}
|
}
|
||||||
|
@ -1686,10 +1686,8 @@ void Notepad_plus::command(int id)
|
|||||||
characterNumber += curBuf->getFileTime(Buffer::ft_modified);
|
characterNumber += curBuf->getFileTime(Buffer::ft_modified);
|
||||||
characterNumber += TEXT("\r");
|
characterNumber += TEXT("\r");
|
||||||
|
|
||||||
TCHAR fileLenStr[64];
|
|
||||||
generic_sprintf(fileLenStr, TEXT("%I64u"), static_cast<UINT64>( fileLen ) );
|
|
||||||
characterNumber += fileLenLabel;
|
characterNumber += fileLenLabel;
|
||||||
characterNumber += fileLenStr;
|
characterNumber += commafyInt(static_cast<UINT64>(fileLen)).c_str();
|
||||||
characterNumber += TEXT("\r");
|
characterNumber += TEXT("\r");
|
||||||
characterNumber += TEXT("\r");
|
characterNumber += TEXT("\r");
|
||||||
}
|
}
|
||||||
@ -1710,42 +1708,27 @@ void Notepad_plus::command(int id)
|
|||||||
auto nbSelByte = getSelectedBytes();
|
auto nbSelByte = getSelectedBytes();
|
||||||
auto nbRange = getSelectedAreas();
|
auto nbRange = getSelectedAreas();
|
||||||
|
|
||||||
TCHAR nbCharStr[32];
|
|
||||||
TCHAR nbWordStr[16];
|
|
||||||
TCHAR nbByteStr[32];
|
|
||||||
TCHAR nbLineStr[32];
|
|
||||||
TCHAR nbSelStr[32];
|
|
||||||
TCHAR nbSelByteStr[32];
|
|
||||||
TCHAR nbRangeStr[8];
|
|
||||||
|
|
||||||
generic_sprintf(nbCharStr, TEXT("%d"), nbChar);
|
|
||||||
characterNumber += nbCharLabel;
|
characterNumber += nbCharLabel;
|
||||||
characterNumber += nbCharStr;
|
characterNumber += commafyInt(nbChar).c_str();
|
||||||
characterNumber += TEXT("\r");
|
characterNumber += TEXT("\r");
|
||||||
|
|
||||||
generic_sprintf(nbWordStr, TEXT("%d"), nbWord);
|
|
||||||
characterNumber += nbWordLabel;
|
characterNumber += nbWordLabel;
|
||||||
characterNumber += nbWordStr;
|
characterNumber += commafyInt(nbWord).c_str();
|
||||||
characterNumber += TEXT("\r");
|
characterNumber += TEXT("\r");
|
||||||
|
|
||||||
generic_sprintf(nbLineStr, TEXT("%d"), static_cast<int>( nbLine ) );
|
|
||||||
characterNumber += nbLineLabel;
|
characterNumber += nbLineLabel;
|
||||||
characterNumber += nbLineStr;
|
characterNumber += commafyInt(static_cast<int>(nbLine)).c_str();
|
||||||
characterNumber += TEXT("\r");
|
characterNumber += TEXT("\r");
|
||||||
|
|
||||||
generic_sprintf(nbByteStr, TEXT("%d"), nbByte);
|
|
||||||
characterNumber += nbByteLabel;
|
characterNumber += nbByteLabel;
|
||||||
characterNumber += nbByteStr;
|
characterNumber += commafyInt(nbByte).c_str();
|
||||||
characterNumber += TEXT("\r");
|
characterNumber += TEXT("\r");
|
||||||
|
|
||||||
generic_sprintf(nbSelStr, TEXT("%d"), nbSel);
|
characterNumber += commafyInt(nbSel).c_str();
|
||||||
generic_sprintf(nbSelByteStr, TEXT("%d"), nbSelByte);
|
|
||||||
generic_sprintf(nbRangeStr, TEXT("%d"), nbRange);
|
|
||||||
characterNumber += nbSelStr;
|
|
||||||
characterNumber += nbSelLabel1;
|
characterNumber += nbSelLabel1;
|
||||||
characterNumber += nbSelByteStr;
|
characterNumber += commafyInt(nbSelByte).c_str();
|
||||||
characterNumber += nbSelLabel2;
|
characterNumber += nbSelLabel2;
|
||||||
characterNumber += nbRangeStr;
|
characterNumber += commafyInt(nbRange).c_str();
|
||||||
characterNumber += nbRangeLabel;
|
characterNumber += nbRangeLabel;
|
||||||
characterNumber += TEXT("\r");
|
characterNumber += TEXT("\r");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user