[ENHANCE] Enhance the conversion feature by emptying the undo buffer after the conversion.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@131 f5eea248-9336-0410-98b8-ebc06183d4e3
pull/343/head^2
donho 2008-02-16 00:05:54 +00:00
parent 393ded102c
commit 93280d508e
1 changed files with 13 additions and 8 deletions

View File

@ -3295,6 +3295,7 @@ void Notepad_plus::command(int id)
if (um != uni8Bit) if (um != uni8Bit)
{ {
::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0); ::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0);
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
return; return;
} }
@ -3309,6 +3310,7 @@ void Notepad_plus::command(int id)
if (um != uni8Bit) if (um != uni8Bit)
{ {
::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0); ::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0);
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
return; return;
} }
break; break;
@ -3323,6 +3325,7 @@ void Notepad_plus::command(int id)
if (um != uni8Bit) if (um != uni8Bit)
{ {
::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0); ::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0);
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
return; return;
} }
break; break;
@ -3336,6 +3339,7 @@ void Notepad_plus::command(int id)
if (um != uni8Bit) if (um != uni8Bit)
{ {
::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0); ::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0);
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
return; return;
} }
break; break;
@ -3376,6 +3380,7 @@ void Notepad_plus::command(int id)
::CloseClipboard(); ::CloseClipboard();
::GlobalFree(allocClipboardData); ::GlobalFree(allocClipboardData);
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
} }
break; break;
} }
@ -6837,14 +6842,14 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
length = UnicodeConvertor.convert(buffer, length-1); length = UnicodeConvertor.convert(buffer, length-1);
/* set text in target */ /* set text in target */
pSci->execute(SCI_CLEARALL, 0, 0); pSci->execute(SCI_CLEARALL);
pSci->execute(SCI_ADDTEXT, length, (LPARAM)UnicodeConvertor.getNewBuf()); pSci->execute(SCI_ADDTEXT, length, (LPARAM)UnicodeConvertor.getNewBuf());
pSci->execute(SCI_EMPTYUNDOBUFFER, 0, 0); pSci->execute(SCI_EMPTYUNDOBUFFER);
pSci->execute(SCI_SETCODEPAGE, 0, 0); pSci->execute(SCI_SETCODEPAGE);
/* set cursor position */ /* set cursor position */
pSci->execute(SCI_GOTOPOS, 0, 0); pSci->execute(SCI_GOTOPOS);
/* clean buffer */ /* clean buffer */
delete [] buffer; delete [] buffer;
@ -6875,13 +6880,13 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
length = UnicodeConvertor.convert(buffer, length-1); length = UnicodeConvertor.convert(buffer, length-1);
// set text in target // set text in target
pSci->execute(SCI_CLEARALL, 0, 0); pSci->execute(SCI_CLEARALL);
pSci->execute(SCI_ADDTEXT, length, (LPARAM)UnicodeConvertor.getNewBuf()); pSci->execute(SCI_ADDTEXT, length, (LPARAM)UnicodeConvertor.getNewBuf());
pSci->execute(SCI_EMPTYUNDOBUFFER, 0, 0); pSci->execute(SCI_EMPTYUNDOBUFFER);
// set cursor position // set cursor position
pSci->execute(SCI_GOTOPOS, 0, 0); pSci->execute(SCI_GOTOPOS);
// clean buffer // clean buffer
delete [] buffer; delete [] buffer;