[NEW_FEATURE] Add Word count feature in Summary command.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@670 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
52a0e7971d
commit
bb7cb36df9
|
@ -2411,32 +2411,15 @@ size_t Notepad_plus::getSelectedBytes()
|
|||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
void Notepad_plus::updateStatusBar()
|
||||
int Notepad_plus::wordCount()
|
||||
{
|
||||
UniMode u = _pEditView->getCurrentBuffer()->getUnicodeMode();
|
||||
TCHAR strLnCol[64];
|
||||
|
||||
int areas = getSelectedAreas();
|
||||
int sizeofChar = (isFormatUnicode(u)) ? 2 : 1;
|
||||
wsprintf(strLnCol, TEXT("Ln : %d Col : %d Sel : %d (%d bytes) in %d ranges"),\
|
||||
(_pEditView->getCurrentLineNumber() + 1), \
|
||||
(_pEditView->getCurrentColumnNumber() + 1),\
|
||||
getSelectedCharNumber(u), getSelectedBytes() * sizeofChar,\
|
||||
areas);
|
||||
|
||||
_statusBar.setText(strLnCol, STATUSBAR_CUR_POS);
|
||||
|
||||
TCHAR strDonLen[64];
|
||||
size_t numLines = _pEditView->execute(SCI_GETLINECOUNT);
|
||||
wsprintf(strDonLen, TEXT("%d chars %d bytes %d lines"),\
|
||||
getCurrentDocCharCount(numLines, u),\
|
||||
_pEditView->execute(SCI_GETLENGTH) * sizeofChar + getBOMSize(u),\
|
||||
numLines);
|
||||
_statusBar.setText(strDonLen, STATUSBAR_DOC_SIZE);
|
||||
_statusBar.setText(_pEditView->execute(SCI_GETOVERTYPE) ? TEXT("OVR") : TEXT("INS"), STATUSBAR_TYPING_MODE);
|
||||
FindOption env;
|
||||
env._str2Search = TEXT("[^ \\\\.,;:!?()+\\-\\*/=\\]\\[{}&~\"'`|@$%§<>\\^]+");
|
||||
//printStr(env._str2Search.c_str());
|
||||
env._searchType = FindRegex;
|
||||
return _findReplaceDlg.processAll(ProcessCountAll, &env, true);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void Notepad_plus::updateStatusBar()
|
||||
{
|
||||
|
@ -4204,6 +4187,7 @@ void Notepad_plus::loadCommandlineParams(const TCHAR * commandLine, CmdLineParam
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Notepad_plus::setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *filter)
|
||||
{
|
||||
generic_string fltr;
|
||||
|
|
|
@ -579,6 +579,7 @@ private:
|
|||
bool noOpenedDoc() const;
|
||||
bool goToPreviousIndicator(int indicID2Search, bool isWrap = true) const;
|
||||
bool goToNextIndicator(int indicID2Search, bool isWrap = true) const;
|
||||
int wordCount();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1021,25 +1021,28 @@ void Notepad_plus::command(int id)
|
|||
characterNumber += TEXT("\r");
|
||||
}
|
||||
TCHAR *nbCharLabel = TEXT("Characters (without blanks): ");
|
||||
TCHAR *nbWordLabel = TEXT("Words: ");
|
||||
TCHAR *nbLineLabel = TEXT("Lines: ");
|
||||
TCHAR *nbByteLabel = TEXT("Current document length: ");
|
||||
TCHAR *nbLineLabel = TEXT("Total lines: ");
|
||||
TCHAR *nbSelLabel1 = TEXT(" selected characters (");
|
||||
TCHAR *nbSelLabel2 = TEXT(" bytes) in ");
|
||||
TCHAR *nbRangeLabel = TEXT(" ranges");
|
||||
|
||||
UniMode um = _pEditView->getCurrentBuffer()->getUnicodeMode();
|
||||
int nbChar = getCurrentDocCharCount(um);
|
||||
int nbWord = wordCount();
|
||||
size_t nbLine = _pEditView->execute(SCI_GETLINECOUNT);
|
||||
int nbByte = _pEditView->execute(SCI_GETLENGTH);
|
||||
int nbSel = getSelectedCharNumber(um);
|
||||
int nbSelByte = getSelectedBytes();
|
||||
int nbRange = getSelectedAreas();
|
||||
|
||||
TCHAR nbCharStr[64];
|
||||
TCHAR nbByteStr[64];
|
||||
TCHAR nbLineStr[64];
|
||||
TCHAR nbSelStr[64];
|
||||
TCHAR nbSelByteStr[64];
|
||||
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);
|
||||
|
@ -1047,9 +1050,9 @@ void Notepad_plus::command(int id)
|
|||
characterNumber += nbCharStr;
|
||||
characterNumber += TEXT("\r");
|
||||
|
||||
generic_sprintf(nbByteStr, TEXT("%d"), nbByte);
|
||||
characterNumber += nbByteLabel;
|
||||
characterNumber += nbByteStr;
|
||||
generic_sprintf(nbWordStr, TEXT("%d"), nbWord);
|
||||
characterNumber += nbWordLabel;
|
||||
characterNumber += nbWordStr;
|
||||
characterNumber += TEXT("\r");
|
||||
|
||||
generic_sprintf(nbLineStr, TEXT("%d"), nbLine);
|
||||
|
@ -1057,6 +1060,11 @@ void Notepad_plus::command(int id)
|
|||
characterNumber += nbLineStr;
|
||||
characterNumber += TEXT("\r");
|
||||
|
||||
generic_sprintf(nbByteStr, TEXT("%d"), nbByte);
|
||||
characterNumber += nbByteLabel;
|
||||
characterNumber += nbByteStr;
|
||||
characterNumber += TEXT("\r");
|
||||
|
||||
generic_sprintf(nbSelStr, TEXT("%d"), nbSel);
|
||||
generic_sprintf(nbSelByteStr, TEXT("%d"), nbSelByte);
|
||||
generic_sprintf(nbRangeStr, TEXT("%d"), nbRange);
|
||||
|
|
Loading…
Reference in New Issue