if (GetCaret())
GetCaret()->Show();
PositionCaret();
+#else
+#if !defined(__WXMAC__)
+ // Causes caret dropouts on Mac
+ PositionCaret();
+#endif
#endif
}
// For now, don't handle shift-click when we're selecting multiple objects.
if (event.ShiftDown() && GetFocusObject() == oldFocusObject && m_selectionState == wxRichTextCtrlSelectionState_Normal)
- {
- if (!m_selection.IsValid())
- ExtendSelection(oldCaretPos, m_caretPosition, wxRICHTEXT_SHIFT_DOWN);
- else
- ExtendSelection(m_caretPosition, m_caretPosition, wxRICHTEXT_SHIFT_DOWN);
- }
+ ExtendSelection(oldCaretPos, m_caretPosition, wxRICHTEXT_SHIFT_DOWN);
else
SelectNone();
}
// Editing
// ----------------------------------------------------------------------------
-void wxRichTextCtrl::Replace(long WXUNUSED(from), long WXUNUSED(to),
+void wxRichTextCtrl::Replace(long from, long to,
const wxString& value)
{
BeginBatchUndo(_("Replace"));
+ SetSelection(from, to);
+
+ wxRichTextAttr attr = GetDefaultStyle();
+
DeleteSelectedContent();
+ SetDefaultStyle(attr);
+
DoWriteText(value, SetValue_SelectionOnly);
EndBatchUndo();