OSDN Git Service

Plugins: Add DisassembleJVM, DisassembleIL and DisassembleNative plugin (3)
[winmerge-jp/winmerge-jp.git] / Src / GhostTextView.cpp
index 1b89ad6..d16f183 100644 (file)
@@ -7,21 +7,7 @@
 //    WinMerge:  an interactive diff/merge utility
 //    Copyright (C) 1997-2000  Thingamahoochie Software
 //    Author: Dean Grimm
-//
-//    This program is free software; you can redistribute it and/or modify
-//    it under the terms of the GNU General Public License as published by
-//    the Free Software Foundation; either version 2 of the License, or
-//    (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU General Public License for more details.
-//
-//    You should have received a copy of the GNU General Public License
-//    along with this program; if not, write to the Free Software
-//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
+//    SPDX-License-Identifier: GPL-2.0-or-later
 /////////////////////////////////////////////////////////////////////////////
 
 
@@ -52,6 +38,7 @@ CGhostTextView::CGhostTextView()
 , m_ptSavedSelEndPushed{}
 , m_ptLastChangePushed{}
 , m_nTopSubLinePushed(0)
+, m_nOffsetCharPushed(0)
 {
 }
 
@@ -167,8 +154,10 @@ void CGhostTextView::PopCursors ()
                m_nTopSubLine = 0;
        int nDummy;
        GetLineBySubLine( m_nTopSubLine, m_nTopLine, nDummy );
+       const int nMaxLineLength = GetMaxLineLength(m_nTopLine, GetScreenLines());
+       m_nOffsetChar = (m_nOffsetCharPushed < nMaxLineLength) ? m_nOffsetCharPushed : nMaxLineLength;
     RecalcVertScrollBar(true);
-    RecalcHorzScrollBar();
+    InvalidateHorzScrollBar();
 }
 
 void CGhostTextView::PushCursors ()
@@ -196,6 +185,7 @@ void CGhostTextView::PushCursors ()
 
        // and top line positions
        m_nTopSubLinePushed = m_nTopSubLine;
+       m_nOffsetCharPushed = m_nOffsetChar;
 }
 
 
@@ -215,7 +205,7 @@ int CGhostTextView::ComputeApparentLine (int nRealLine) const
 
 void CGhostTextView::GetTextWithoutEmptys (int nStartLine, int nStartChar,
                int nEndLine, int nEndChar, CString &text,
-               CRLFSTYLE nCrlfStyle /*= CRLF_STYLE_AUTOMATIC*/,
+               CRLFSTYLE nCrlfStyle /*= CRLFSTYLE::AUTOMATIC*/,
                bool bExcludeInvisibleLines /*= true*/)
 {
   if (m_pGhostTextBuffer != nullptr)
@@ -234,7 +224,7 @@ void CGhostTextView::GetTextWithoutEmptysInColumnSelection (CString & text, bool
 
        PrepareSelBounds ();
 
-       CString sEol = m_pGhostTextBuffer->GetStringEol (CRLF_STYLE_DOS);
+       CString sEol = m_pGhostTextBuffer->GetStringEol (CRLFSTYLE::DOS);
 
        int nBufSize = 1;
        for (int L = m_ptDrawSelStart.y; L <= m_ptDrawSelEnd.y; L++)