This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository terminology.

View the commit online.

commit e9253fb3cc9f16351ea5c71bdb257daf96d33794
Author: Boris Faure <bill...@gmail.com>
AuthorDate: Mon Aug 21 16:21:04 2023 +0200

    termio: allow to clear selection
---
 src/bin/termio.c | 44 ++++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/src/bin/termio.c b/src/bin/termio.c
index 7f076ee..d454039 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -1029,26 +1029,34 @@ _termio_set_selection_text(Termio *sd, Elm_Sel_Type type, const char *text)
 
    EINA_SAFETY_ON_NULL_RETURN(sd);
 
-   text = eina_stringshare_add(text);
-
-   sd->have_sel = EINA_FALSE;
-   sd->reset_sel = EINA_FALSE;
-   sd->set_sel_at = ecore_time_get(); // hack
-   sd->sel_type = type;
-
-   res = elm_cnp_selection_set(sd->win, type,
-                         ELM_SEL_FORMAT_TEXT,
-                         text,
-                         eina_stringshare_strlen(text));
-   if (!res)
+   if (text[0] != '\0')
      {
-        ERR("Unable to set selection data '%s' of type %d", text, type);
+        text = eina_stringshare_add(text);
+
+        sd->have_sel = EINA_FALSE;
+        sd->reset_sel = EINA_FALSE;
+        sd->set_sel_at = ecore_time_get(); // hack
+        sd->sel_type = type;
+
+        res = elm_cnp_selection_set(sd->win, type,
+                                    ELM_SEL_FORMAT_TEXT,
+                                    text,
+                                    eina_stringshare_strlen(text));
+        if (!res)
+          {
+             ERR("Unable to set selection data '%s'(%d) of type %d",
+                 text, eina_stringshare_strlen(text), type);
+          }
+        elm_cnp_selection_loss_callback_set(sd->win, type,
+                                            _lost_selection, sd->self);
+        sd->have_sel = EINA_TRUE;
+        eina_stringshare_del(sd->sel_str);
+        sd->sel_str = eina_stringshare_add(text);
+     }
+   else
+     {
+        elm_object_cnp_selection_clear(sd->win, type);
      }
-   elm_cnp_selection_loss_callback_set(sd->win, type,
-                                       _lost_selection, sd->self);
-   sd->have_sel = EINA_TRUE;
-   eina_stringshare_del(sd->sel_str);
-   sd->sel_str = eina_stringshare_add(text);
 }
 
 void

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to