X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5cab4a770cee73214cdbea645712652b29db6802..f7ae43f080576ef142d3884073df298294860328:/src/richtext/richtextctrl.cpp diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index 17a0f07790..d9cc795957 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -32,6 +32,7 @@ #include "wx/dcbuffer.h" #include "wx/arrimpl.cpp" #include "wx/fontenum.h" +#include "wx/accel.h" // DLL options compatibility check: #include "wx/app.h" @@ -119,9 +120,9 @@ private: }; #endif -IMPLEMENT_CLASS( wxRichTextCtrl, wxControl ) +IMPLEMENT_DYNAMIC_CLASS( wxRichTextCtrl, wxControl ) -IMPLEMENT_CLASS( wxRichTextEvent, wxNotifyEvent ) +IMPLEMENT_DYNAMIC_CLASS( wxRichTextEvent, wxNotifyEvent ) BEGIN_EVENT_TABLE( wxRichTextCtrl, wxControl ) EVT_PAINT(wxRichTextCtrl::OnPaint) @@ -135,6 +136,7 @@ BEGIN_EVENT_TABLE( wxRichTextCtrl, wxControl ) EVT_MIDDLE_DOWN(wxRichTextCtrl::OnMiddleClick) EVT_LEFT_DCLICK(wxRichTextCtrl::OnLeftDClick) EVT_CHAR(wxRichTextCtrl::OnChar) + EVT_KEY_DOWN(wxRichTextCtrl::OnChar) EVT_SIZE(wxRichTextCtrl::OnSize) EVT_SET_FOCUS(wxRichTextCtrl::OnSetFocus) EVT_KILL_FOCUS(wxRichTextCtrl::OnKillFocus) @@ -215,8 +217,6 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va attributes.SetLineSpacing(10); attributes.SetParagraphSpacingAfter(10); attributes.SetParagraphSpacingBefore(0); - attributes.SetTextEffects(0); - attributes.SetTextEffectFlags(wxTEXT_ATTR_EFFECT_STRIKETHROUGH|wxTEXT_ATTR_EFFECT_CAPITALS); SetBasicStyle(attributes); @@ -255,6 +255,19 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va GetBuffer().AddEventHandler(this); + // Accelerators + wxAcceleratorEntry entries[6]; + + entries[0].Set(wxACCEL_CMD, (int) 'C', wxID_COPY); + entries[1].Set(wxACCEL_CMD, (int) 'X', wxID_CUT); + entries[2].Set(wxACCEL_CMD, (int) 'V', wxID_PASTE); + entries[3].Set(wxACCEL_CMD, (int) 'A', wxID_SELECTALL); + entries[4].Set(wxACCEL_CMD, (int) 'Z', wxID_UNDO); + entries[5].Set(wxACCEL_CMD, (int) 'Y', wxID_REDO); + + wxAcceleratorTable accel(6, entries); + SetAcceleratorTable(accel); + return true; } @@ -289,7 +302,8 @@ void wxRichTextCtrl::DoThaw() LayoutContent(); else SetupScrollbars(); - Refresh(false); + + wxWindow::DoThaw(); } /// Clear all text @@ -446,6 +460,7 @@ void wxRichTextCtrl::OnLeftClick(wxMouseEvent& event) long oldCaretPos = m_caretPosition; MoveCaret(position, caretAtLineStart); + SetDefaultStyleToCursorStyle(); if (event.ShiftDown()) { @@ -584,6 +599,7 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event) ExtendSelection(m_caretPosition, position, wxRICHTEXT_SHIFT_DOWN); MoveCaret(position, caretAtLineStart); + SetDefaultStyleToCursorStyle(); } } } @@ -642,25 +658,163 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) if (event.AltDown()) flags |= wxRICHTEXT_ALT_DOWN; - if (event.GetKeyCode() == WXK_LEFT || - event.GetKeyCode() == WXK_RIGHT || - event.GetKeyCode() == WXK_UP || - event.GetKeyCode() == WXK_DOWN || - event.GetKeyCode() == WXK_HOME || - event.GetKeyCode() == WXK_PAGEUP || - event.GetKeyCode() == WXK_PAGEDOWN || - event.GetKeyCode() == WXK_END || - - event.GetKeyCode() == WXK_NUMPAD_LEFT || - event.GetKeyCode() == WXK_NUMPAD_RIGHT || - event.GetKeyCode() == WXK_NUMPAD_UP || - event.GetKeyCode() == WXK_NUMPAD_DOWN || - event.GetKeyCode() == WXK_NUMPAD_HOME || - event.GetKeyCode() == WXK_NUMPAD_PAGEUP || - event.GetKeyCode() == WXK_NUMPAD_PAGEDOWN || - event.GetKeyCode() == WXK_NUMPAD_END) - { - KeyboardNavigate(event.GetKeyCode(), flags); + if (event.GetEventType() == wxEVT_KEY_DOWN) + { + if (event.GetKeyCode() == WXK_LEFT || + event.GetKeyCode() == WXK_RIGHT || + event.GetKeyCode() == WXK_UP || + event.GetKeyCode() == WXK_DOWN || + event.GetKeyCode() == WXK_HOME || + event.GetKeyCode() == WXK_PAGEUP || + event.GetKeyCode() == WXK_PAGEDOWN || + event.GetKeyCode() == WXK_END || + + event.GetKeyCode() == WXK_NUMPAD_LEFT || + event.GetKeyCode() == WXK_NUMPAD_RIGHT || + event.GetKeyCode() == WXK_NUMPAD_UP || + event.GetKeyCode() == WXK_NUMPAD_DOWN || + event.GetKeyCode() == WXK_NUMPAD_HOME || + event.GetKeyCode() == WXK_NUMPAD_PAGEUP || + event.GetKeyCode() == WXK_NUMPAD_PAGEDOWN || + event.GetKeyCode() == WXK_NUMPAD_END) + { + KeyboardNavigate(event.GetKeyCode(), flags); + return; + } + + long keycode = event.GetKeyCode(); + switch ( keycode ) + { + case WXK_ESCAPE: + case WXK_START: + case WXK_LBUTTON: + case WXK_RBUTTON: + case WXK_CANCEL: + case WXK_MBUTTON: + case WXK_CLEAR: + case WXK_SHIFT: + case WXK_ALT: + case WXK_CONTROL: + case WXK_MENU: + case WXK_PAUSE: + case WXK_CAPITAL: + case WXK_END: + case WXK_HOME: + case WXK_LEFT: + case WXK_UP: + case WXK_RIGHT: + case WXK_DOWN: + case WXK_SELECT: + case WXK_PRINT: + case WXK_EXECUTE: + case WXK_SNAPSHOT: + case WXK_INSERT: + case WXK_HELP: + case WXK_F1: + case WXK_F2: + case WXK_F3: + case WXK_F4: + case WXK_F5: + case WXK_F6: + case WXK_F7: + case WXK_F8: + case WXK_F9: + case WXK_F10: + case WXK_F11: + case WXK_F12: + case WXK_F13: + case WXK_F14: + case WXK_F15: + case WXK_F16: + case WXK_F17: + case WXK_F18: + case WXK_F19: + case WXK_F20: + case WXK_F21: + case WXK_F22: + case WXK_F23: + case WXK_F24: + case WXK_NUMLOCK: + case WXK_SCROLL: + case WXK_PAGEUP: + case WXK_PAGEDOWN: + case WXK_NUMPAD_F1: + case WXK_NUMPAD_F2: + case WXK_NUMPAD_F3: + case WXK_NUMPAD_F4: + case WXK_NUMPAD_HOME: + case WXK_NUMPAD_LEFT: + case WXK_NUMPAD_UP: + case WXK_NUMPAD_RIGHT: + case WXK_NUMPAD_DOWN: + case WXK_NUMPAD_PAGEUP: + case WXK_NUMPAD_PAGEDOWN: + case WXK_NUMPAD_END: + case WXK_NUMPAD_BEGIN: + case WXK_NUMPAD_INSERT: + case WXK_NUMPAD_DELETE: + case WXK_WINDOWS_LEFT: + { + return; + } + default: + { + } + } + + // Must process this before translation, otherwise it's translated into a WXK_DELETE event. + if (event.CmdDown() && event.GetKeyCode() == WXK_BACK) + { + BeginBatchUndo(_("Delete Text")); + + long newPos = m_caretPosition; + + bool processed = DeleteSelectedContent(& newPos); + + // Submit range in character positions, which are greater than caret positions, + // so subtract 1 for deleted character and add 1 for conversion to character position. + if (newPos > -1) + { + if (event.CmdDown()) + { + long pos = wxRichTextCtrl::FindNextWordPosition(-1); + if (pos < newPos) + { + GetBuffer().DeleteRangeWithUndo(wxRichTextRange(pos+1, newPos), this); + processed = true; + } + } + + if (!processed) + GetBuffer().DeleteRangeWithUndo(wxRichTextRange(newPos, newPos), this); + } + + EndBatchUndo(); + + if (GetLastPosition() == -1) + { + GetBuffer().Reset(); + + m_caretPosition = -1; + PositionCaret(); + SetDefaultStyleToCursorStyle(); + } + + ScrollIntoView(m_caretPosition, WXK_LEFT); + + wxRichTextEvent cmdEvent( + wxEVT_COMMAND_RICHTEXT_DELETE, + GetId()); + cmdEvent.SetEventObject(this); + cmdEvent.SetFlags(flags); + cmdEvent.SetPosition(m_caretPosition+1); + GetEventHandler()->ProcessEvent(cmdEvent); + + Update(); + } + else + event.Skip(); + return; } @@ -674,7 +828,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) if (event.GetKeyCode() == WXK_RETURN) { - SetDefaultStyleToCursorStyle(); BeginBatchUndo(_("Insert Text")); long newPos = m_caretPosition; @@ -686,11 +839,14 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) wxString text; text = wxRichTextLineBreakChar; GetBuffer().InsertTextWithUndo(newPos+1, text, this); + m_caretAtLineStart = true; + PositionCaret(); } else GetBuffer().InsertNewlineWithUndo(newPos+1, this, wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE|wxRICHTEXT_INSERT_INTERACTIVE); EndBatchUndo(); + SetDefaultStyleToCursorStyle(); ScrollIntoView(m_caretPosition, WXK_RIGHT); @@ -715,26 +871,27 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) { BeginBatchUndo(_("Delete Text")); + long newPos = m_caretPosition; + + bool processed = DeleteSelectedContent(& newPos); + // Submit range in character positions, which are greater than caret positions, // so subtract 1 for deleted character and add 1 for conversion to character position. - if (m_caretPosition > -1 && !HasSelection()) + if (newPos > -1) { - bool processed = false; if (event.CmdDown()) { long pos = wxRichTextCtrl::FindNextWordPosition(-1); - if (pos != -1 && (pos < m_caretPosition)) + if (pos < newPos) { - GetBuffer().DeleteRangeWithUndo(wxRichTextRange(pos+1, m_caretPosition), this); + GetBuffer().DeleteRangeWithUndo(wxRichTextRange(pos+1, newPos), this); processed = true; } } if (!processed) - GetBuffer().DeleteRangeWithUndo(wxRichTextRange(m_caretPosition, m_caretPosition), this); + GetBuffer().DeleteRangeWithUndo(wxRichTextRange(newPos, newPos), this); } - else - DeleteSelectedContent(); EndBatchUndo(); @@ -744,6 +901,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) m_caretPosition = -1; PositionCaret(); + SetDefaultStyleToCursorStyle(); } ScrollIntoView(m_caretPosition, WXK_LEFT); @@ -762,13 +920,26 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) { BeginBatchUndo(_("Delete Text")); + long newPos = m_caretPosition; + + bool processed = DeleteSelectedContent(& newPos); + // Submit range in character positions, which are greater than caret positions, - if (m_caretPosition < GetBuffer().GetRange().GetEnd()+1 && !HasSelection()) + if (newPos < GetBuffer().GetRange().GetEnd()+1) { - GetBuffer().DeleteRangeWithUndo(wxRichTextRange(m_caretPosition+1, m_caretPosition+1), this); + if (event.CmdDown()) + { + long pos = wxRichTextCtrl::FindNextWordPosition(1); + if (pos != -1 && (pos > newPos)) + { + GetBuffer().DeleteRangeWithUndo(wxRichTextRange(newPos+1, pos), this); + processed = true; + } + } + + if (!processed) + GetBuffer().DeleteRangeWithUndo(wxRichTextRange(newPos+1, newPos+1), this); } - else - DeleteSelectedContent(); EndBatchUndo(); @@ -778,6 +949,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) m_caretPosition = -1; PositionCaret(); + SetDefaultStyleToCursorStyle(); } wxRichTextEvent cmdEvent( @@ -796,100 +968,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) switch ( keycode ) { case WXK_ESCAPE: - case WXK_DELETE: - case WXK_START: - case WXK_LBUTTON: - case WXK_RBUTTON: - case WXK_CANCEL: - case WXK_MBUTTON: - case WXK_CLEAR: - case WXK_SHIFT: - case WXK_ALT: - case WXK_CONTROL: - case WXK_MENU: - case WXK_PAUSE: - case WXK_CAPITAL: - case WXK_END: - case WXK_HOME: - case WXK_LEFT: - case WXK_UP: - case WXK_RIGHT: - case WXK_DOWN: - case WXK_SELECT: - case WXK_PRINT: - case WXK_EXECUTE: - case WXK_SNAPSHOT: - case WXK_INSERT: - case WXK_HELP: - case WXK_NUMPAD0: - case WXK_NUMPAD1: - case WXK_NUMPAD2: - case WXK_NUMPAD3: - case WXK_NUMPAD4: - case WXK_NUMPAD5: - case WXK_NUMPAD6: - case WXK_NUMPAD7: - case WXK_NUMPAD8: - case WXK_NUMPAD9: - case WXK_MULTIPLY: - case WXK_ADD: - case WXK_SEPARATOR: - case WXK_SUBTRACT: - case WXK_DECIMAL: - case WXK_DIVIDE: - case WXK_F1: - case WXK_F2: - case WXK_F3: - case WXK_F4: - case WXK_F5: - case WXK_F6: - case WXK_F7: - case WXK_F8: - case WXK_F9: - case WXK_F10: - case WXK_F11: - case WXK_F12: - case WXK_F13: - case WXK_F14: - case WXK_F15: - case WXK_F16: - case WXK_F17: - case WXK_F18: - case WXK_F19: - case WXK_F20: - case WXK_F21: - case WXK_F22: - case WXK_F23: - case WXK_F24: - case WXK_NUMLOCK: - case WXK_SCROLL: - case WXK_PAGEUP: - case WXK_PAGEDOWN: - case WXK_NUMPAD_SPACE: - case WXK_NUMPAD_TAB: - case WXK_NUMPAD_ENTER: - case WXK_NUMPAD_F1: - case WXK_NUMPAD_F2: - case WXK_NUMPAD_F3: - case WXK_NUMPAD_F4: - case WXK_NUMPAD_HOME: - case WXK_NUMPAD_LEFT: - case WXK_NUMPAD_UP: - case WXK_NUMPAD_RIGHT: - case WXK_NUMPAD_DOWN: - case WXK_NUMPAD_PAGEUP: - case WXK_NUMPAD_PAGEDOWN: - case WXK_NUMPAD_END: - case WXK_NUMPAD_BEGIN: - case WXK_NUMPAD_INSERT: - case WXK_NUMPAD_DELETE: - case WXK_NUMPAD_EQUAL: - case WXK_NUMPAD_MULTIPLY: - case WXK_NUMPAD_ADD: - case WXK_NUMPAD_SEPARATOR: - case WXK_NUMPAD_SUBTRACT: - case WXK_NUMPAD_DECIMAL: - case WXK_WINDOWS_LEFT: { event.Skip(); return; @@ -897,7 +975,11 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) default: { +#ifdef __WXMAC__ + if (event.CmdDown()) +#else if (event.CmdDown() || event.AltDown()) +#endif { event.Skip(); return; @@ -939,7 +1021,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) } } - SetDefaultStyleToCursorStyle(); BeginBatchUndo(_("Insert Text")); long newPos = m_caretPosition; @@ -954,6 +1035,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) EndBatchUndo(); + SetDefaultStyleToCursorStyle(); ScrollIntoView(m_caretPosition, WXK_RIGHT); GetEventHandler()->ProcessEvent(cmdEvent); @@ -1070,6 +1152,7 @@ bool wxRichTextCtrl::KeyboardNavigate(int keyCode, int flags) if (success) { ScrollIntoView(m_caretPosition, keyCode); + SetDefaultStyleToCursorStyle(); } return success; @@ -1080,6 +1163,9 @@ bool wxRichTextCtrl::ExtendSelection(long oldPos, long newPos, int flags) { if (flags & wxRICHTEXT_SHIFT_DOWN) { + if (oldPos == newPos) + return false; + wxRichTextRange oldSelection = m_selectionRange; // If not currently selecting, start selecting @@ -1098,6 +1184,8 @@ bool wxRichTextCtrl::ExtendSelection(long oldPos, long newPos, int flags) // the end. if (newPos > m_selectionAnchor) m_selectionRange.SetRange(m_selectionAnchor+1, newPos); + else if (newPos == m_selectionAnchor) + m_selectionRange = wxRichTextRange(-2, -2); else m_selectionRange.SetRange(newPos+1, m_selectionAnchor); } @@ -1291,11 +1379,13 @@ 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 @@ -1339,11 +1429,13 @@ void wxRichTextCtrl::MoveCaretBack(long oldPosition) // to the previous character position. m_caretPosition = oldPosition - 1; } + SetDefaultStyleToCursorStyle(); return; } } } m_caretPosition --; + SetDefaultStyleToCursorStyle(); } /// Move right @@ -1371,6 +1463,7 @@ bool wxRichTextCtrl::MoveRight(int noPositions, int flags) SetCaretPosition(newPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1397,6 +1490,7 @@ bool wxRichTextCtrl::MoveLeft(int noPositions, int flags) SetCaretPosition(newPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1485,6 +1579,7 @@ bool wxRichTextCtrl::MoveDown(int noLines, int flags) SetCaretPosition(newPos, caretLineStart); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1505,6 +1600,7 @@ bool wxRichTextCtrl::MoveToParagraphEnd(int flags) SetCaretPosition(newPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1525,6 +1621,7 @@ bool wxRichTextCtrl::MoveToParagraphStart(int flags) SetCaretPosition(newPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1547,6 +1644,7 @@ bool wxRichTextCtrl::MoveToLineEnd(int flags) SetCaretPosition(newPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1571,6 +1669,7 @@ bool wxRichTextCtrl::MoveToLineStart(int flags) SetCaretPosition(newPos, para->GetRange().GetStart() != lineRange.GetStart()); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1589,6 +1688,7 @@ bool wxRichTextCtrl::MoveHome(int flags) SetCaretPosition(-1); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1609,6 +1709,7 @@ bool wxRichTextCtrl::MoveEnd(int flags) SetCaretPosition(endPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1647,6 +1748,7 @@ bool wxRichTextCtrl::PageDown(int noPages, int flags) SetCaretPosition(pos, para->GetRange().GetStart() != lineRange.GetStart()); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1763,6 +1865,7 @@ bool wxRichTextCtrl::WordLeft(int WXUNUSED(n), int flags) SetCaretPosition(pos, para->GetRange().GetStart() != pos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1784,6 +1887,7 @@ bool wxRichTextCtrl::WordRight(int WXUNUSED(n), int flags) SetCaretPosition(pos, para->GetRange().GetStart() != pos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1957,7 +2061,7 @@ bool wxRichTextCtrl::RecreateBuffer(const wxSize& size) bool wxRichTextCtrl::DoLoadFile(const wxString& filename, int fileType) { - bool success = GetBuffer().LoadFile(filename, fileType); + bool success = GetBuffer().LoadFile(filename, (wxRichTextFileType)fileType); if (success) m_filename = filename; @@ -1981,7 +2085,7 @@ bool wxRichTextCtrl::DoLoadFile(const wxString& filename, int fileType) bool wxRichTextCtrl::DoSaveFile(const wxString& filename, int fileType) { - if (GetBuffer().SaveFile(filename, fileType)) + if (GetBuffer().SaveFile(filename, (wxRichTextFileType)fileType)) { m_filename = filename; @@ -2092,6 +2196,7 @@ bool wxRichTextCtrl::SelectWord(long position) if (positionStart >= 0) { MoveCaret(positionStart-1, true); + SetDefaultStyleToCursorStyle(); } return true; @@ -2209,7 +2314,6 @@ 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 ) @@ -2224,7 +2328,7 @@ void wxRichTextCtrl::AppendText(const wxString& text) } /// Write an image at the current insertion point -bool wxRichTextCtrl::WriteImage(const wxImage& image, int bitmapType) +bool wxRichTextCtrl::WriteImage(const wxImage& image, wxBitmapType bitmapType) { wxRichTextImageBlock imageBlock; @@ -2235,7 +2339,7 @@ bool wxRichTextCtrl::WriteImage(const wxImage& image, int bitmapType) return false; } -bool wxRichTextCtrl::WriteImage(const wxString& filename, int bitmapType) +bool wxRichTextCtrl::WriteImage(const wxString& filename, wxBitmapType bitmapType) { wxRichTextImageBlock imageBlock; @@ -2251,7 +2355,7 @@ bool wxRichTextCtrl::WriteImage(const wxRichTextImageBlock& imageBlock) return GetBuffer().InsertImageWithUndo(m_caretPosition+1, imageBlock, this); } -bool wxRichTextCtrl::WriteImage(const wxBitmap& bitmap, int bitmapType) +bool wxRichTextCtrl::WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType) { if (bitmap.Ok()) { @@ -2268,7 +2372,7 @@ bool wxRichTextCtrl::WriteImage(const wxBitmap& bitmap, int bitmapType) /// Insert a newline (actually paragraph) at the current insertion point. bool wxRichTextCtrl::Newline() { - return GetBuffer().InsertNewlineWithUndo(m_caretPosition+1, this); + return GetBuffer().InsertNewlineWithUndo(m_caretPosition+1, this, wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE); } /// Insert a line break at the current insertion point. @@ -2309,7 +2413,6 @@ void wxRichTextCtrl::Paste() { if (CanPaste()) { - SetDefaultStyleToCursorStyle(); BeginBatchUndo(_("Paste")); long newPos = m_caretPosition;