Skip to content

Commit

Permalink
Fix osdn.net issue #39664: Unexpected behavior when moving caret with…
Browse files Browse the repository at this point in the history
… CTRL+arrow keys
  • Loading branch information
sdottaka committed Oct 9, 2019
1 parent 119cd17 commit f37fd16
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions Externals/crystaledit/editlib/ccrystaltextview2.cpp
Expand Up @@ -148,7 +148,6 @@ MoveRight (bool bSelect)
void CCrystalTextView:: void CCrystalTextView::
MoveWordLeft (bool bSelect) MoveWordLeft (bool bSelect)
{ {
int nLength = GetLineLength(m_ptCursorPos.y);
PrepareSelBounds (); PrepareSelBounds ();
if (m_ptDrawSelStart != m_ptDrawSelEnd && !bSelect) if (m_ptDrawSelStart != m_ptDrawSelEnd && !bSelect)
{ {
Expand All @@ -158,16 +157,14 @@ MoveWordLeft (bool bSelect)


if (m_ptCursorPos.x == 0) if (m_ptCursorPos.x == 0)
{ {
if (m_ptCursorPos.y == 0) MoveLeft (bSelect);
return; return;
m_ptCursorPos.y--;
m_ptCursorPos.x = nLength;
} }


if (m_ptCursorPos.x > 0) if (m_ptCursorPos.x > 0)
{ {
const TCHAR *pszChars = GetLineChars(m_ptCursorPos.y); const TCHAR *pszChars = GetLineChars(m_ptCursorPos.y);
m_iterWord.setText(reinterpret_cast<const UChar *>(pszChars), nLength); m_iterWord.setText(reinterpret_cast<const UChar *>(pszChars), GetLineLength(m_ptCursorPos.y));
int nPos = m_iterWord.preceding(m_ptCursorPos.x); int nPos = m_iterWord.preceding(m_ptCursorPos.x);
if (xisspace(pszChars[nPos])) if (xisspace(pszChars[nPos]))
nPos = m_iterWord.preceding(nPos); nPos = m_iterWord.preceding(nPos);
Expand All @@ -192,14 +189,6 @@ MoveWordRight (bool bSelect)
return; return;
} }


if (m_ptCursorPos.x == GetLineLength (m_ptCursorPos.y))
{
if (m_ptCursorPos.y == GetLineCount () - 1)
return;
m_ptCursorPos.y++;
m_ptCursorPos.x = 0;
}

int nLength = GetLineLength (m_ptCursorPos.y); int nLength = GetLineLength (m_ptCursorPos.y);
if (m_ptCursorPos.x == nLength) if (m_ptCursorPos.x == nLength)
{ {
Expand Down

0 comments on commit f37fd16

Please sign in to comment.