A right-to-left single-char sel followed by typing leaves cursor the same.

Fixes https://gitlab.com/kicad/code/kicad/issues/11349
This commit is contained in:
Jeff Young 2022-04-07 00:09:08 +01:00
parent 9fcc641808
commit dead84e7a1
2 changed files with 10 additions and 2 deletions

View File

@ -37,6 +37,8 @@ SCINTILLA_TRICKS::SCINTILLA_TRICKS( wxStyledTextCtrl* aScintilla, const wxString
m_te( aScintilla ),
m_braces( aBraces ),
m_lastCaretPos( -1 ),
m_lastSelStart( -1 ),
m_lastSelEnd( -1 ),
m_suppressAutocomplete( false ),
m_singleLine( aSingleLine ),
m_returnCallback( aReturnCallback )
@ -337,10 +339,14 @@ void SCINTILLA_TRICKS::onScintillaUpdateUI( wxStyledTextEvent& aEvent )
// Has the caret changed position?
int caretPos = m_te->GetCurrentPos();
int selStart = m_te->GetSelectionStart();
int selEnd = m_te->GetSelectionEnd();
if( m_lastCaretPos != caretPos )
if( m_lastCaretPos != caretPos || m_lastSelStart != selStart || m_lastSelEnd != selEnd )
{
m_lastCaretPos = caretPos;
m_lastSelStart = selStart;
m_lastSelEnd = selEnd;
int bracePos1 = -1;
int bracePos2 = -1;

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2020-2022 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -56,6 +56,8 @@ protected:
wxStyledTextCtrl* m_te;
wxString m_braces;
int m_lastCaretPos;
int m_lastSelStart;
int m_lastSelEnd;
bool m_suppressAutocomplete;
bool m_singleLine; // Treat <return> as OK, and skip special tab
// stop handling (including monospaced font).