From 3379b053bda79ffeedca1e84c2780736f5354108 Mon Sep 17 00:00:00 2001 From: Tim Kosse Date: Sat, 18 Jul 2015 02:24:39 +0200 Subject: [PATCH] Don't allow rich text content in non-rich wxTextCtrl in wxOSX. Explicitly disable rich text content and automatic quotation marks replacement in normal multiline text controls to make them behave closer to single line ones and also multiline ones on other platforms. Closes #16805. (this is a backport of 262ed2c1335e481ca72646246ccdef81f3825d9e and 3465d659fee0313a6dc650074432c3c435e4a83e from master) --- docs/changes.txt | 1 + src/osx/cocoa/textctrl.mm | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 0f856e8653..cbb2b368f0 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -644,6 +644,7 @@ wxOSX: - Send wxIconizeEvent when a window is iconized/restore (Rob Krakora). - Use correct colour for disabled wxStaticText (sbrowne). - Fix initial position of controls with layout insets (Tim Kosse). +- Don't allow pasting rich text in non-wxTE_RICH text controls (Tim Kosse). - Fix printing all pages non-interactively (John Roberts). - Fix custom paper support (tijsv). - Return false from wxSound::Create()/IsOk() if the file doesn't exist. diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index c5bfb88958..a2caa6e71a 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -580,6 +580,11 @@ wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ) [tv setHorizontallyResizable:NO]; [tv setAutoresizingMask:NSViewWidthSizable]; + if ( !wxPeer->HasFlag(wxTE_RICH | wxTE_RICH2) ) + { + [tv setRichText:NO]; + } + [m_scrollView setDocumentView: tv]; [tv setDelegate: tv];