From 5d4d1d0ee9f4cc1396eebf4373dbe26455f4aad0 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 16 Jan 2010 02:36:26 +0000 Subject: [PATCH] [BUG_FIXED] Fixed Chinese characters display problem after "find in the current document". git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@596 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index a3b03edfc..86e64fff8 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1642,7 +1642,8 @@ bool Notepad_plus::replaceAllFiles() { if (pBuf->isReadOnly()) continue; _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); - _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8); + int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); + _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); _invisibleEditView._currentBuffer = pBuf; _invisibleEditView.execute(SCI_BEGINUNDOACTION); nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL); @@ -1658,7 +1659,8 @@ bool Notepad_plus::replaceAllFiles() { if (pBuf->isReadOnly()) continue; _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); - _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8); + int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); + _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); _invisibleEditView._currentBuffer = pBuf; _invisibleEditView.execute(SCI_BEGINUNDOACTION); nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL); @@ -1874,7 +1876,8 @@ bool Notepad_plus::replaceInFiles() { Buffer * pBuf = MainFileManager->getBufferByID(id); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); - _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8); + int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); + _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); _invisibleEditView._currentBuffer = pBuf; int nbReplaced = _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, true, fileNames.at(i).c_str()); @@ -1956,7 +1959,8 @@ bool Notepad_plus::findInFiles() { Buffer * pBuf = MainFileManager->getBufferByID(id); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); - _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8); + int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); + _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, true, fileNames.at(i).c_str()); if (!dontClose) @@ -2000,7 +2004,8 @@ bool Notepad_plus::findInOpenedFiles() { pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i)); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); - _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8); + int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); + _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName()); } } @@ -2011,7 +2016,8 @@ bool Notepad_plus::findInOpenedFiles() { pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i)); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); - _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8); + int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); + _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName()); } } @@ -2043,7 +2049,8 @@ bool Notepad_plus::findInCurrentFile() _findReplaceDlg.beginNewFilesSearch(); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); - _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8); + int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); + _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName()); _findReplaceDlg.finishFilesSearch(nbTotal);