[BUG_FIXED] Fix conversion min to Maj and Maj to min (or vice et versa) in column selection bug.

[NEW] column selection allows to insertion a string by typing characters in sequence (w/o column mode editor).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@444 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2009-03-31 23:47:49 +00:00
parent 3ecb9a2217
commit 05e55ebf66
3 changed files with 77 additions and 84 deletions

View File

@ -41,6 +41,7 @@ copy /Y LINEDRAW.TTF .\zipped.package.release\ansi\
copy /Y ".\plugins\Config\tidy\*.*" .\zipped.package.release\ansi\plugins\Config\tidy copy /Y ".\plugins\Config\tidy\*.*" .\zipped.package.release\ansi\plugins\Config\tidy
"C:\Program Files\7-Zip\7z.exe" a -tzip -r npp.bin.zip .\zipped.package.release\* "C:\Program Files\7-Zip\7z.exe" a -tzip -r npp.bin.zip .\zipped.package.release\*
"C:\Program Files\7-Zip\7z.exe" a -r npp.bin.7z .\zipped.package.release\*
"C:\Program Files\NSIS\makensis.exe" ..\installer\nppSetup.nsi "C:\Program Files\NSIS\makensis.exe" ..\installer\nppSetup.nsi
cd ..\installer\ cd ..\installer\

View File

@ -238,7 +238,13 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
execute(SCI_BEGINUNDOACTION); execute(SCI_BEGINUNDOACTION);
ColumnModeInfo colInfos = getColumnModeSelectInfo(); ColumnModeInfo colInfos = getColumnModeSelectInfo();
columnReplace(colInfos, (TCHAR)wParam); generic_string str(1, (TCHAR)wParam);
columnReplace(colInfos, str.c_str());
int selStart = execute(SCI_GETSELECTIONSTART)+1;
int selEnd = execute(SCI_GETSELECTIONEND);
execute(SCI_SETSELECTIONSTART, selStart);
execute(SCI_SETSELECTIONEND, selEnd);
execute(SCI_ENDUNDOACTION); execute(SCI_ENDUNDOACTION);
execute(SCI_SETCURRENTPOS,colInfos[colInfos.size()-1].second); execute(SCI_SETCURRENTPOS,colInfos[colInfos.size()-1].second);
@ -1913,6 +1919,7 @@ const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> &
return kwl.c_str(); return kwl.c_str();
} }
void ScintillaEditView::convertSelectedTextTo(bool Case) void ScintillaEditView::convertSelectedTextTo(bool Case)
{ {
unsigned int codepage = _codepage; unsigned int codepage = _codepage;
@ -1924,6 +1931,9 @@ void ScintillaEditView::convertSelectedTextTo(bool Case)
{ {
execute(SCI_BEGINUNDOACTION); execute(SCI_BEGINUNDOACTION);
int selStart = execute(SCI_GETSELECTIONSTART);
int selEnd = execute(SCI_GETSELECTIONEND);
ColumnModeInfo cmi = getColumnModeSelectInfo(); ColumnModeInfo cmi = getColumnModeSelectInfo();
const int len = cmi[0].second - cmi[0].first; const int len = cmi[0].second - cmi[0].first;
char *srcStr = new char[len+1]; char *srcStr = new char[len+1];
@ -1953,6 +1963,9 @@ void ScintillaEditView::convertSelectedTextTo(bool Case)
delete [] srcStr; delete [] srcStr;
delete [] destStr; delete [] destStr;
execute(SCI_SETSELECTIONSTART, selStart);
execute(SCI_SETSELECTIONEND, selEnd);
execute(SCI_ENDUNDOACTION); execute(SCI_ENDUNDOACTION);
return; return;
} }
@ -1961,7 +1974,6 @@ void ScintillaEditView::convertSelectedTextTo(bool Case)
size_t selectionEnd = execute(SCI_GETSELECTIONEND); size_t selectionEnd = execute(SCI_GETSELECTIONEND);
int strSize = ((selectionEnd > selectionStart)?(selectionEnd - selectionStart):(selectionStart - selectionEnd))+1; int strSize = ((selectionEnd > selectionStart)?(selectionEnd - selectionStart):(selectionStart - selectionEnd))+1;
if (strSize) if (strSize)
{ {
char *selectedStr = new char[strSize+1]; char *selectedStr = new char[strSize+1];
@ -1988,6 +2000,7 @@ void ScintillaEditView::convertSelectedTextTo(bool Case)
} }
} }
bool ScintillaEditView::expandWordSelection() bool ScintillaEditView::expandWordSelection()
{ {
int caretPos = execute(SCI_GETCURRENTPOS, 0, 0); int caretPos = execute(SCI_GETCURRENTPOS, 0, 0);
@ -2195,26 +2208,6 @@ void ScintillaEditView::columnReplace(ColumnModeInfo & cmi, int initial, int inc
} }
void ScintillaEditView::columnReplace(const ColumnModeInfo & cmi, const TCHAR ch)
{
for (size_t i = 0 ; i < cmi.size() ; i++)
{
int len = cmi[i].second - cmi[i].first;
generic_string str(len, ch);
execute(SCI_SETTARGETSTART, cmi[i].first);
execute(SCI_SETTARGETEND, cmi[i].second);
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
unsigned int cp = execute(SCI_GETCODEPAGE);
const char *strA = wmc->wchar2char(str.c_str(), cp);
execute(SCI_REPLACETARGET, -1, (LPARAM)strA);
#else
execute(SCI_REPLACETARGET, -1, (LPARAM)str.c_str());
#endif
}
}
void ScintillaEditView::foldChanged(int line, int levelNow, int levelPrev) void ScintillaEditView::foldChanged(int line, int levelNow, int levelPrev)
{ {
if (levelNow & SC_FOLDLEVELHEADERFLAG) //line can be folded if (levelNow & SC_FOLDLEVELHEADERFLAG) //line can be folded

View File

@ -463,7 +463,6 @@ public:
ColumnModeInfo getColumnModeSelectInfo(); ColumnModeInfo getColumnModeSelectInfo();
void columnReplace(ColumnModeInfo & cmi, const TCHAR *str); void columnReplace(ColumnModeInfo & cmi, const TCHAR *str);
void columnReplace(const ColumnModeInfo & cmi, const TCHAR ch);
void columnReplace(ColumnModeInfo & cmi, int initial, int incr, UCHAR format); void columnReplace(ColumnModeInfo & cmi, int initial, int incr, UCHAR format);
void foldChanged(int line, int levelNow, int levelPrev); void foldChanged(int line, int levelNow, int levelPrev);