From 076377235f6c2ae5eddd3d2dcd19734cce0de174 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 5 Jun 2019 17:00:56 -0300 Subject: [PATCH] Fixing "keep-selected" flag behavior. --- src/lib3270/ctlr.c | 11 +++++++---- src/lib3270/selection.c | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib3270/ctlr.c b/src/lib3270/ctlr.c index 243a8e5..b50f251 100644 --- a/src/lib3270/ctlr.c +++ b/src/lib3270/ctlr.c @@ -2429,9 +2429,8 @@ int ctlr_any_data(H3270 *session) return 0; } -/* - * Clear the text (non-status) portion of the display. Also resets the cursor - * and buffer addresses and extended attributes. +/** + * @brief Clear the text (non-status) portion of the display. Also resets the cursor and buffer addresses and extended attributes. */ void ctlr_clear(H3270 *session, Boolean can_snap) { @@ -2452,7 +2451,11 @@ void ctlr_clear(H3270 *session, Boolean can_snap) (void) memset((char *)session->ea_buf, 0, session->rows*session->cols*sizeof(struct lib3270_ea)); cursor_move(session,0); session->buffer_addr = 0; - lib3270_unselect(session); + + if(!lib3270_get_toggle(session,LIB3270_TOGGLE_KEEP_SELECTED)) { + lib3270_unselect(session); + } + set_formatted(session,0); session->default_fg = 0; session->default_bg = 0; diff --git a/src/lib3270/selection.c b/src/lib3270/selection.c index e3d3a78..72fb83e 100644 --- a/src/lib3270/selection.c +++ b/src/lib3270/selection.c @@ -182,6 +182,8 @@ LIB3270_EXPORT int lib3270_unselect(H3270 *hSession) CHECK_SESSION_HANDLE(hSession); + trace("%s",__FUNCTION__); + if(hSession->selected) { hSession->selected = 0; -- libgit2 0.21.2