diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/inputwidget.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index 59608151..c4c7475e 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -30,9 +30,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
30 | #include <SDL_clipboard.h> | 30 | #include <SDL_clipboard.h> |
31 | #include <SDL_timer.h> | 31 | #include <SDL_timer.h> |
32 | 32 | ||
33 | #if defined (iPlatformApple) | ||
34 | # include "macos.h" | ||
35 | #endif | ||
36 | |||
33 | static const int refreshInterval_InputWidget_ = 256; | 37 | static const int refreshInterval_InputWidget_ = 256; |
34 | static const size_t maxUndo_InputWidget_ = 64; | 38 | static const size_t maxUndo_InputWidget_ = 64; |
35 | 39 | ||
40 | static void enableEditorKeysInMenus_(iBool enable) { | ||
41 | #if defined (iPlatformApple) | ||
42 | enableMenuItemsByKey_MacOS(SDLK_LEFT, KMOD_PRIMARY, enable); | ||
43 | enableMenuItemsByKey_MacOS(SDLK_RIGHT, KMOD_PRIMARY, enable); | ||
44 | #else | ||
45 | iUnused(enable); | ||
46 | #endif | ||
47 | } | ||
48 | |||
36 | iDeclareType(InputUndo) | 49 | iDeclareType(InputUndo) |
37 | 50 | ||
38 | struct Impl_InputUndo { | 51 | struct Impl_InputUndo { |
@@ -114,6 +127,9 @@ void init_InputWidget(iInputWidget *d, size_t maxLen) { | |||
114 | } | 127 | } |
115 | 128 | ||
116 | void deinit_InputWidget(iInputWidget *d) { | 129 | void deinit_InputWidget(iInputWidget *d) { |
130 | if (isSelected_Widget(d)) { | ||
131 | enableEditorKeysInMenus_(iTrue); | ||
132 | } | ||
117 | delete_TextBuf(d->buffered); | 133 | delete_TextBuf(d->buffered); |
118 | clearUndo_InputWidget_(d); | 134 | clearUndo_InputWidget_(d); |
119 | deinit_Array(&d->undoStack); | 135 | deinit_Array(&d->undoStack); |
@@ -279,6 +295,7 @@ void begin_InputWidget(iInputWidget *d) { | |||
279 | else { | 295 | else { |
280 | iZap(d->mark); | 296 | iZap(d->mark); |
281 | } | 297 | } |
298 | enableEditorKeysInMenus_(iFalse); | ||
282 | } | 299 | } |
283 | 300 | ||
284 | void end_InputWidget(iInputWidget *d, iBool accept) { | 301 | void end_InputWidget(iInputWidget *d, iBool accept) { |
@@ -287,6 +304,7 @@ void end_InputWidget(iInputWidget *d, iBool accept) { | |||
287 | /* Was not active. */ | 304 | /* Was not active. */ |
288 | return; | 305 | return; |
289 | } | 306 | } |
307 | enableEditorKeysInMenus_(iTrue); | ||
290 | if (!accept) { | 308 | if (!accept) { |
291 | setCopy_Array(&d->text, &d->oldText); | 309 | setCopy_Array(&d->text, &d->oldText); |
292 | } | 310 | } |