raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=0f4cdf7a486803cbef1b214b3ad86ef80176dccb

commit 0f4cdf7a486803cbef1b214b3ad86ef80176dccb
Author: Subodh Kumar <s7158.ku...@samsung.com>
Date:   Mon Aug 29 17:23:07 2016 +0900

    Edje entry: Pass correct cursor position and text to imf in case of 
selection
    
    Summary:
    When selection is there we are passing the whole text and position to imf
    which sees that next character like matras (eg .Hindi) should be inserted
    (if pressed) and when matra comes the selected text is gone and only matra
    remains in the entry.
    
    eg:  we have text in hindi like मानक, select all and hit matra in keyboard
    selected text is gone, only matra is there.
    
    @fix
    
    Test Plan: Tested in Tizen device
    
    Reviewers: jihoon, tasn, herdsman, thiepha
    
    Subscribers: Hermet, shilpasingh, raster, subodh, jpeg, cedric
    
    Differential Revision: https://phab.enlightenment.org/D2951
---
 src/lib/edje/edje_entry.c | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index dae0192..f67d131 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -4417,22 +4417,42 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, 
Ecore_IMF_Context *ctx EINA_
                        for (itr = plain_text; itr && *itr; ++itr)
                          *itr = '*';
                     }
-
-                  *text = strdup(plain_text);
+                  if (en->have_selection)
+                    {
+                       if (en->sel_start)
+                         {
+                            *text = strndup(plain_text,
+                                  
evas_textblock_cursor_pos_get(en->sel_start));
+                         }
+                       else
+                         {
+                            *text = strdup(plain_text);
+                         }
+                    }
+                  else
+                    {
+                       *text = strdup(plain_text);
+                    }
 
                   free(plain_text);
                   plain_text = NULL;
                }
              else
-               *text = strdup("");
+               {
+                  *text = strdup("");
+               }
           }
         else
-          *text = strdup("");
+          {
+             *text = strdup("");
+          }
      }
 
    if (cursor_pos)
      {
-        if (en->cursor)
+        if (en->have_selection && en->sel_start)
+          *cursor_pos = evas_textblock_cursor_pos_get(en->sel_start);
+        else if (en->cursor)
           *cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
         else
           *cursor_pos = 0;

-- 


Reply via email to