From de390ac26a8c905d619c96bde8a4a31c6bfd9b1c Mon Sep 17 00:00:00 2001 From: David Freese Date: Thu, 22 Nov 2012 04:33:44 -0600 Subject: [PATCH] Control-V/Z * disabled Control-Z use in Tx panel. * added Tx text capture to clipboard when ESC pressed - allows subsequent Control-V paste of text back to the Tx panel --- src/dialogs/fl_digi.cxx | 8 ++++++-- src/widgets/FTextRXTX.cxx | 2 ++ src/widgets/Fl_Text_Buffer_mod_1_3.cxx | 7 +++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/dialogs/fl_digi.cxx b/src/dialogs/fl_digi.cxx index 655e6822..6170975d 100644 --- a/src/dialogs/fl_digi.cxx +++ b/src/dialogs/fl_digi.cxx @@ -2548,9 +2548,9 @@ int default_handler(int event) } Fl_Widget* w = Fl::focus(); + int key = Fl::event_key(); if (w == fl_digi_main || w->window() == fl_digi_main) { - int key = Fl::event_key(); if (key == FL_Escape || (key >= FL_F && key <= FL_F_Last) || ((key == '1' || key == '2' || key == '3' || key == '4') && Fl::event_alt())) { TransmitText->take_focus(); @@ -2582,9 +2582,13 @@ int default_handler(int event) else if (w == dlgLogbook || w->window() == dlgLogbook) return log_search_handler(event); - else if (Fl::event_key() == FL_Escape) + else if ((Fl::event_key() == FL_Escape) || + (Fl::event_ctrl() && ((key == 'z' || key == 'Z')) && + TransmitText->visible_focus())) return 1; + else if (Fl::event_ctrl()) return w->handle(FL_KEYBOARD); + return 0; } diff --git a/src/widgets/FTextRXTX.cxx b/src/widgets/FTextRXTX.cxx index 960401c6..cdcf74c3 100644 --- a/src/widgets/FTextRXTX.cxx +++ b/src/widgets/FTextRXTX.cxx @@ -1079,6 +1079,8 @@ int FTextTX::handle_key(int key) } if (trx_state == STATE_TX && active_modem->get_stopflag() == false) { + kf_select_all(0, this); + kf_copy(0, this); clear(); if (arq_text_available) AbortARQ(); diff --git a/src/widgets/Fl_Text_Buffer_mod_1_3.cxx b/src/widgets/Fl_Text_Buffer_mod_1_3.cxx index 1b593888..cf2cafce 100644 --- a/src/widgets/Fl_Text_Buffer_mod_1_3.cxx +++ b/src/widgets/Fl_Text_Buffer_mod_1_3.cxx @@ -338,10 +338,10 @@ void Fl_Text_Buffer_mod::replace(int start, int end, const char *text) return; if (start < 0) start = 0; - if (end < 0) // needed to prevent control-Z crash - end = 0; if (end > mLength) end = mLength; + if (end < start) + end = start; IS_UTF8_ALIGNED2(this, (start)) IS_UTF8_ALIGNED2(this, (end)) @@ -349,8 +349,7 @@ void Fl_Text_Buffer_mod::replace(int start, int end, const char *text) call_predelete_callbacks(start, end - start); const char *deletedText = text_range(start, end); - if (end > start) - remove_(start, end); + remove_(start, end); int nInserted = insert_(start, text); mCursorPosHint = start + nInserted; call_modify_callbacks(start, end - start, nInserted, 0, deletedText);