[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:
parent
3ecb9a2217
commit
05e55ebf66
@ -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\
|
||||||
|
@ -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);
|
||||||
@ -249,9 +255,9 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
|||||||
execute(SCI_SETSEL, pos, pos);
|
execute(SCI_SETSEL, pos, pos);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_MOUSEHWHEEL :
|
case WM_MOUSEHWHEEL :
|
||||||
{
|
{
|
||||||
@ -1913,81 +1919,88 @@ 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;
|
||||||
UniMode um = getCurrentBuffer()->getUnicodeMode();
|
UniMode um = getCurrentBuffer()->getUnicodeMode();
|
||||||
if (um != uni8Bit)
|
if (um != uni8Bit)
|
||||||
codepage = CP_UTF8;
|
codepage = CP_UTF8;
|
||||||
|
|
||||||
if (execute(SCI_SELECTIONISRECTANGLE))
|
if (execute(SCI_SELECTIONISRECTANGLE))
|
||||||
{
|
{
|
||||||
execute(SCI_BEGINUNDOACTION);
|
execute(SCI_BEGINUNDOACTION);
|
||||||
|
|
||||||
ColumnModeInfo cmi = getColumnModeSelectInfo();
|
int selStart = execute(SCI_GETSELECTIONSTART);
|
||||||
const int len = cmi[0].second - cmi[0].first;
|
int selEnd = execute(SCI_GETSELECTIONEND);
|
||||||
char *srcStr = new char[len+1];
|
|
||||||
wchar_t *destStr = new wchar_t[len+3];
|
|
||||||
for (size_t i = 0 ; i < cmi.size() ; i++)
|
|
||||||
{
|
|
||||||
int start = cmi[i].first;
|
|
||||||
int end = cmi[i].second;
|
|
||||||
getText(srcStr, start, end);
|
|
||||||
|
|
||||||
int nbChar = ::MultiByteToWideChar(codepage, 0, srcStr, len, destStr, len);
|
ColumnModeInfo cmi = getColumnModeSelectInfo();
|
||||||
|
const int len = cmi[0].second - cmi[0].first;
|
||||||
|
char *srcStr = new char[len+1];
|
||||||
|
wchar_t *destStr = new wchar_t[len+3];
|
||||||
|
for (size_t i = 0 ; i < cmi.size() ; i++)
|
||||||
|
{
|
||||||
|
int start = cmi[i].first;
|
||||||
|
int end = cmi[i].second;
|
||||||
|
getText(srcStr, start, end);
|
||||||
|
|
||||||
for (int j = 0 ; j < nbChar ; j++)
|
int nbChar = ::MultiByteToWideChar(codepage, 0, srcStr, len, destStr, len);
|
||||||
{
|
|
||||||
if (Case == UPPERCASE)
|
|
||||||
destStr[j] = (wchar_t)::CharUpperW((LPWSTR)destStr[j]);
|
|
||||||
else
|
|
||||||
destStr[j] = (wchar_t)::CharLowerW((LPWSTR)destStr[j]);
|
|
||||||
}
|
|
||||||
::WideCharToMultiByte(codepage, 0, destStr, len, srcStr, len, NULL, NULL);
|
|
||||||
|
|
||||||
execute(SCI_SETTARGETSTART, start);
|
for (int j = 0 ; j < nbChar ; j++)
|
||||||
execute(SCI_SETTARGETEND, end);
|
{
|
||||||
execute(SCI_REPLACETARGET, -1, (LPARAM)srcStr);
|
if (Case == UPPERCASE)
|
||||||
}
|
destStr[j] = (wchar_t)::CharUpperW((LPWSTR)destStr[j]);
|
||||||
|
else
|
||||||
|
destStr[j] = (wchar_t)::CharLowerW((LPWSTR)destStr[j]);
|
||||||
|
}
|
||||||
|
::WideCharToMultiByte(codepage, 0, destStr, len, srcStr, len, NULL, NULL);
|
||||||
|
|
||||||
delete [] srcStr;
|
execute(SCI_SETTARGETSTART, start);
|
||||||
delete [] destStr;
|
execute(SCI_SETTARGETEND, end);
|
||||||
|
execute(SCI_REPLACETARGET, -1, (LPARAM)srcStr);
|
||||||
|
}
|
||||||
|
|
||||||
execute(SCI_ENDUNDOACTION);
|
delete [] srcStr;
|
||||||
return;
|
delete [] destStr;
|
||||||
}
|
|
||||||
|
|
||||||
size_t selectionStart = execute(SCI_GETSELECTIONSTART);
|
execute(SCI_SETSELECTIONSTART, selStart);
|
||||||
size_t selectionEnd = execute(SCI_GETSELECTIONEND);
|
execute(SCI_SETSELECTIONEND, selEnd);
|
||||||
|
|
||||||
int strSize = ((selectionEnd > selectionStart)?(selectionEnd - selectionStart):(selectionStart - selectionEnd))+1;
|
|
||||||
|
|
||||||
if (strSize)
|
|
||||||
{
|
|
||||||
char *selectedStr = new char[strSize+1];
|
|
||||||
int strWSize = strSize * 2;
|
|
||||||
wchar_t *selectedStrW = new wchar_t[strWSize+3];
|
|
||||||
|
|
||||||
execute(SCI_GETSELTEXT, 0, (LPARAM)selectedStr);
|
execute(SCI_ENDUNDOACTION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int nbChar = ::MultiByteToWideChar(codepage, 0, selectedStr, strSize, selectedStrW, strWSize);
|
size_t selectionStart = execute(SCI_GETSELECTIONSTART);
|
||||||
|
size_t selectionEnd = execute(SCI_GETSELECTIONEND);
|
||||||
|
|
||||||
|
int strSize = ((selectionEnd > selectionStart)?(selectionEnd - selectionStart):(selectionStart - selectionEnd))+1;
|
||||||
|
if (strSize)
|
||||||
|
{
|
||||||
|
char *selectedStr = new char[strSize+1];
|
||||||
|
int strWSize = strSize * 2;
|
||||||
|
wchar_t *selectedStrW = new wchar_t[strWSize+3];
|
||||||
|
|
||||||
for (int i = 0 ; i < nbChar ; i++)
|
execute(SCI_GETSELTEXT, 0, (LPARAM)selectedStr);
|
||||||
{
|
|
||||||
if (Case == UPPERCASE)
|
|
||||||
selectedStrW[i] = (WCHAR)::CharUpperW((LPWSTR)selectedStrW[i]);
|
|
||||||
else
|
|
||||||
selectedStrW[i] = (WCHAR)::CharLowerW((LPWSTR)selectedStrW[i]);
|
|
||||||
}
|
|
||||||
::WideCharToMultiByte(codepage, 0, selectedStrW, strWSize, selectedStr, strSize, NULL, NULL);
|
|
||||||
|
|
||||||
execute(SCI_REPLACESEL, strSize, (LPARAM)selectedStr);
|
int nbChar = ::MultiByteToWideChar(codepage, 0, selectedStr, strSize, selectedStrW, strWSize);
|
||||||
execute(SCI_SETSEL, selectionStart, selectionEnd);
|
|
||||||
delete [] selectedStr;
|
for (int i = 0 ; i < nbChar ; i++)
|
||||||
delete [] selectedStrW;
|
{
|
||||||
}
|
if (Case == UPPERCASE)
|
||||||
|
selectedStrW[i] = (WCHAR)::CharUpperW((LPWSTR)selectedStrW[i]);
|
||||||
|
else
|
||||||
|
selectedStrW[i] = (WCHAR)::CharLowerW((LPWSTR)selectedStrW[i]);
|
||||||
|
}
|
||||||
|
::WideCharToMultiByte(codepage, 0, selectedStrW, strWSize, selectedStr, strSize, NULL, NULL);
|
||||||
|
|
||||||
|
execute(SCI_REPLACESEL, strSize, (LPARAM)selectedStr);
|
||||||
|
execute(SCI_SETSEL, selectionStart, selectionEnd);
|
||||||
|
delete [] selectedStr;
|
||||||
|
delete [] selectedStrW;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user