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/branches/WX_2_8_BRANCH@53440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -381,7 +381,7 @@ void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
if (GetCaret()->IsVisible())
|
||||
{
|
||||
((wxRichTextCaret*) GetCaret())->DoDraw(& dc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -472,7 +472,6 @@ void wxRichTextCtrl::OnLeftClick(wxMouseEvent& event)
|
||||
long oldCaretPos = m_caretPosition;
|
||||
|
||||
MoveCaret(position, caretAtLineStart);
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
if (event.ShiftDown())
|
||||
{
|
||||
@@ -602,7 +601,6 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
|
||||
ExtendSelection(m_caretPosition, position, wxRICHTEXT_SHIFT_DOWN);
|
||||
|
||||
MoveCaret(position, caretAtLineStart);
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -670,6 +668,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
|
||||
if (event.GetKeyCode() == WXK_RETURN)
|
||||
{
|
||||
SetDefaultStyleToCursorStyle();
|
||||
BeginBatchUndo(_("Insert Text"));
|
||||
|
||||
long newPos = m_caretPosition;
|
||||
@@ -686,7 +685,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);
|
||||
|
||||
@@ -728,7 +726,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
|
||||
m_caretPosition = -1;
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
ScrollIntoView(m_caretPosition, WXK_LEFT);
|
||||
@@ -775,7 +772,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
|
||||
m_caretPosition = -1;
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
wxRichTextEvent cmdEvent(
|
||||
@@ -937,6 +933,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
SetDefaultStyleToCursorStyle();
|
||||
BeginBatchUndo(_("Insert Text"));
|
||||
|
||||
long newPos = m_caretPosition;
|
||||
@@ -951,7 +948,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
|
||||
EndBatchUndo();
|
||||
|
||||
SetDefaultStyleToCursorStyle();
|
||||
ScrollIntoView(m_caretPosition, WXK_RIGHT);
|
||||
|
||||
GetEventHandler()->ProcessEvent(cmdEvent);
|
||||
@@ -1068,7 +1064,6 @@ bool wxRichTextCtrl::KeyboardNavigate(int keyCode, int flags)
|
||||
if (success)
|
||||
{
|
||||
ScrollIntoView(m_caretPosition, keyCode);
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
return success;
|
||||
@@ -1290,13 +1285,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
|
||||
@@ -1340,13 +1333,11 @@ void wxRichTextCtrl::MoveCaretBack(long oldPosition)
|
||||
// to the previous character position.
|
||||
m_caretPosition = oldPosition - 1;
|
||||
}
|
||||
SetDefaultStyleToCursorStyle();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_caretPosition --;
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
/// Move right
|
||||
@@ -1374,7 +1365,6 @@ bool wxRichTextCtrl::MoveRight(int noPositions, int flags)
|
||||
SetCaretPosition(newPos);
|
||||
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1401,7 +1391,6 @@ bool wxRichTextCtrl::MoveLeft(int noPositions, int flags)
|
||||
SetCaretPosition(newPos);
|
||||
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1490,7 +1479,6 @@ bool wxRichTextCtrl::MoveDown(int noLines, int flags)
|
||||
|
||||
SetCaretPosition(newPos, caretLineStart);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1511,7 +1499,6 @@ bool wxRichTextCtrl::MoveToParagraphEnd(int flags)
|
||||
|
||||
SetCaretPosition(newPos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1532,7 +1519,6 @@ bool wxRichTextCtrl::MoveToParagraphStart(int flags)
|
||||
|
||||
SetCaretPosition(newPos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1555,7 +1541,6 @@ bool wxRichTextCtrl::MoveToLineEnd(int flags)
|
||||
|
||||
SetCaretPosition(newPos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1580,7 +1565,6 @@ bool wxRichTextCtrl::MoveToLineStart(int flags)
|
||||
|
||||
SetCaretPosition(newPos, para->GetRange().GetStart() != lineRange.GetStart());
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1599,7 +1583,6 @@ bool wxRichTextCtrl::MoveHome(int flags)
|
||||
|
||||
SetCaretPosition(-1);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1620,7 +1603,6 @@ bool wxRichTextCtrl::MoveEnd(int flags)
|
||||
|
||||
SetCaretPosition(endPos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1659,7 +1641,6 @@ bool wxRichTextCtrl::PageDown(int noPages, int flags)
|
||||
|
||||
SetCaretPosition(pos, para->GetRange().GetStart() != lineRange.GetStart());
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1776,7 +1757,6 @@ bool wxRichTextCtrl::WordLeft(int WXUNUSED(n), int flags)
|
||||
|
||||
SetCaretPosition(pos, para->GetRange().GetStart() != pos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1798,7 +1778,6 @@ bool wxRichTextCtrl::WordRight(int WXUNUSED(n), int flags)
|
||||
|
||||
SetCaretPosition(pos, para->GetRange().GetStart() != pos);
|
||||
PositionCaret();
|
||||
SetDefaultStyleToCursorStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2102,7 +2081,6 @@ bool wxRichTextCtrl::SelectWord(long position)
|
||||
if (positionStart >= 0)
|
||||
{
|
||||
MoveCaret(positionStart-1, true);
|
||||
SetDefaultStyleToCursorStyle();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2220,6 +2198,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 )
|
||||
@@ -2319,6 +2298,7 @@ void wxRichTextCtrl::Paste()
|
||||
{
|
||||
if (CanPaste())
|
||||
{
|
||||
SetDefaultStyleToCursorStyle();
|
||||
BeginBatchUndo(_("Paste"));
|
||||
|
||||
long newPos = m_caretPosition;
|
||||
@@ -2432,7 +2412,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