Applied patch [ 1906896 ] Fix for bug #1906223 and optimization
Don't set default style to cursor style until entering text Andrej Sinicyn git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53439 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -446,7 +446,6 @@ void wxRichTextCtrl::OnLeftClick(wxMouseEvent& event)
|
||||
long oldCaretPos = m_caretPosition;
|
||||
|
||||
MoveCaret(position, caretAtLineStart);
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
if (event.ShiftDown())
|
||||
{
|
||||
@@ -585,7 +584,6 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
|
||||
ExtendSelection(m_caretPosition, position, wxRICHTEXT_SHIFT_DOWN);
|
||||
|
||||
MoveCaret(position, caretAtLineStart);
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -676,6 +674,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
|
||||
if (event.GetKeyCode() == WXK_RETURN)
|
||||
{
|
||||
SetDefaultStyleToCursorStyle();
|
||||
BeginBatchUndo(_("Insert Text"));
|
||||
|
||||
long newPos = m_caretPosition;
|
||||
@@ -692,7 +691,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
GetBuffer().InsertNewlineWithUndo(newPos+1, this, wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE|wxRICHTEXT_INSERT_INTERACTIVE);
|
||||
|
||||
EndBatchUndo();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
ScrollIntoView(m_caretPosition, WXK_RIGHT);
|
||||
|
||||
@@ -746,7 +744,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
|
||||
m_caretPosition = -1;
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
ScrollIntoView(m_caretPosition, WXK_LEFT);
|
||||
@@ -781,7 +778,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
|
||||
m_caretPosition = -1;
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
wxRichTextEvent cmdEvent(
|
||||
@@ -943,6 +939,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
SetDefaultStyleToCursorStyle();
|
||||
BeginBatchUndo(_("Insert Text"));
|
||||
|
||||
long newPos = m_caretPosition;
|
||||
@@ -957,7 +954,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
|
||||
EndBatchUndo();
|
||||
|
||||
SetDefaultStyleToCursorStyle();
|
||||
ScrollIntoView(m_caretPosition, WXK_RIGHT);
|
||||
|
||||
GetEventHandler()->ProcessEvent(cmdEvent);
|
||||
@@ -1074,7 +1070,6 @@ bool wxRichTextCtrl::KeyboardNavigate(int keyCode, int flags)
|
||||
if (success)
|
||||
{
|
||||
ScrollIntoView(m_caretPosition, keyCode);
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
return success;
|
||||
@@ -1296,13 +1291,11 @@ void wxRichTextCtrl::MoveCaretForward(long oldPosition)
|
||||
m_caretPosition = oldPosition;
|
||||
m_caretAtLineStart = true;
|
||||
}
|
||||
SetDefaultStyleToCursorStyle();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_caretPosition ++;
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
/// Move caret one visual step backward: this may mean setting a flag
|
||||
@@ -1346,13 +1339,11 @@ void wxRichTextCtrl::MoveCaretBack(long oldPosition)
|
||||
// to the previous character position.
|
||||
m_caretPosition = oldPosition - 1;
|
||||
}
|
||||
SetDefaultStyleToCursorStyle();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_caretPosition --;
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
/// Move right
|
||||
@@ -1380,7 +1371,6 @@ bool wxRichTextCtrl::MoveRight(int noPositions, int flags)
|
||||
SetCaretPosition(newPos);
|
||||
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1407,7 +1397,6 @@ bool wxRichTextCtrl::MoveLeft(int noPositions, int flags)
|
||||
SetCaretPosition(newPos);
|
||||
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1496,7 +1485,6 @@ bool wxRichTextCtrl::MoveDown(int noLines, int flags)
|
||||
|
||||
SetCaretPosition(newPos, caretLineStart);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1517,7 +1505,6 @@ bool wxRichTextCtrl::MoveToParagraphEnd(int flags)
|
||||
|
||||
SetCaretPosition(newPos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1538,7 +1525,6 @@ bool wxRichTextCtrl::MoveToParagraphStart(int flags)
|
||||
|
||||
SetCaretPosition(newPos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1561,7 +1547,6 @@ bool wxRichTextCtrl::MoveToLineEnd(int flags)
|
||||
|
||||
SetCaretPosition(newPos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1586,7 +1571,6 @@ bool wxRichTextCtrl::MoveToLineStart(int flags)
|
||||
|
||||
SetCaretPosition(newPos, para->GetRange().GetStart() != lineRange.GetStart());
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1605,7 +1589,6 @@ bool wxRichTextCtrl::MoveHome(int flags)
|
||||
|
||||
SetCaretPosition(-1);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1626,7 +1609,6 @@ bool wxRichTextCtrl::MoveEnd(int flags)
|
||||
|
||||
SetCaretPosition(endPos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1665,7 +1647,6 @@ bool wxRichTextCtrl::PageDown(int noPages, int flags)
|
||||
|
||||
SetCaretPosition(pos, para->GetRange().GetStart() != lineRange.GetStart());
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1782,7 +1763,6 @@ bool wxRichTextCtrl::WordLeft(int WXUNUSED(n), int flags)
|
||||
|
||||
SetCaretPosition(pos, para->GetRange().GetStart() != pos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1804,7 +1784,6 @@ bool wxRichTextCtrl::WordRight(int WXUNUSED(n), int flags)
|
||||
|
||||
SetCaretPosition(pos, para->GetRange().GetStart() != pos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2113,7 +2092,6 @@ bool wxRichTextCtrl::SelectWord(long position)
|
||||
if (positionStart >= 0)
|
||||
{
|
||||
MoveCaret(positionStart-1, true);
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2231,6 +2209,7 @@ void wxRichTextCtrl::DoWriteText(const wxString& value, int flags)
|
||||
{
|
||||
wxString valueUnix = wxTextFile::Translate(value, wxTextFileType_Unix);
|
||||
|
||||
SetDefaultStyleToCursorStyle();
|
||||
GetBuffer().InsertTextWithUndo(m_caretPosition+1, valueUnix, this, wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
|
||||
|
||||
if ( flags & SetValue_SendEvent )
|
||||
@@ -2330,6 +2309,7 @@ void wxRichTextCtrl::Paste()
|
||||
{
|
||||
if (CanPaste())
|
||||
{
|
||||
SetDefaultStyleToCursorStyle();
|
||||
BeginBatchUndo(_("Paste"));
|
||||
|
||||
long newPos = m_caretPosition;
|
||||
@@ -2443,7 +2423,6 @@ void wxRichTextCtrl::SetSelection(long from, long to)
|
||||
}
|
||||
|
||||
DoSetSelection(from, to);
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
void wxRichTextCtrl::DoSetSelection(long from, long to, bool WXUNUSED(scrollCaret))
|
||||
|
Reference in New Issue
Block a user