[BUG_FIXED] (Author: FLS) Fix wrap/unwrap line position not being kept bug.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@921 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-06-30 01:30:00 +00:00
parent cac7e4ff24
commit e2a165cc8e
3 changed files with 22 additions and 0 deletions

View File

@ -1171,6 +1171,14 @@ void Notepad_plus::command(int id)
case IDM_VIEW_WRAP:
{
bool isWraped = !_pEditView->isWrap();
//--FLS: ViewMoveAtWrappingDisableFix: Disable wrapping messes up visible lines. Therefore save view position before in IDM_VIEW_WRAP and restore after SCN_PAINTED, as Scintilla-Doc. says
if (!isWraped)
{
_mainEditView.saveCurrentPos();
_mainEditView.setWrapRestoreNeeded(true);
_subEditView.saveCurrentPos();
_subEditView.setWrapRestoreNeeded(true);
}
_mainEditView.wrap(isWraped);
_subEditView.wrap(isWraped);
_toolBar.setCheck(IDM_VIEW_WRAP, isWraped);

View File

@ -547,6 +547,18 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_PAINTED:
{
//--FLS: ViewMoveAtWrappingDisableFix: Disable wrapping messes up visible lines. Therefore save view position before in IDM_VIEW_WRAP and restore after SCN_PAINTED, as doc. says
if (_mainEditView.isWrapRestoreNeeded())
{
_mainEditView.restoreCurrentPos();
_mainEditView.setWrapRestoreNeeded(false);
}
if (_subEditView.isWrapRestoreNeeded())
{
_subEditView.restoreCurrentPos();
_subEditView.setWrapRestoreNeeded(false);
}
notifyView->updateLineNumberWidth();
if (_syncInfo.doSync())
doSynScorll(HWND(notification->nmhdr.hwndFrom));

View File

@ -610,6 +610,8 @@ public:
void setHotspotStyle(Style& styleToSet);
void setTabSettings(Lang *lang);
bool isWrapRestoreNeeded() const {return _wrapRestoreNeeded;};
void setWrapRestoreNeeded(bool isWrapRestoredNeeded) {_wrapRestoreNeeded = isWrapRestoredNeeded;};
/*
pair<size_t, bool> getLineUndoState(size_t currentLine) {
Buffer * buf = getCurrentBuffer();