netstar pushed a commit to branch master.

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

commit c26f56aef9391c9255f1e2beda8a81028240b6ca
Author: Alastair Poole <[email protected]>
Date:   Mon Aug 10 14:15:08 2020 +0100

    elm_code: Selection start (with keyboard) fix.
    
    When starting a selection we were jumping two characters. This
    change resolves that.
---
 src/lib/elementary/elm_code_widget.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/lib/elementary/elm_code_widget.c 
b/src/lib/elementary/elm_code_widget.c
index 9e6d37cc95..59298a0462 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -1811,17 +1811,6 @@ _elm_code_widget_key_down_cb(void *data, Evas *evas 
EINA_UNUSED,
 
              _elm_code_widget_selection_type_set(widget, 
ELM_CODE_WIDGET_SELECTION_KEYBOARD);
              _elm_code_widget_selection_in_progress_set(widget, EINA_TRUE);
-
-             if (pd->selection && pd->selection->start_line == 
pd->selection->end_line)
-               {
-                  if ((pd->selection->end_col == pd->selection->start_col && 
!backwards) ||
-                      (pd->selection->end_col > pd->selection->start_col))
-                    elm_code_widget_cursor_position_set(widget, 
pd->selection->end_line, pd->selection->end_col+1);
-               }
-             else if (pd->selection && pd->selection->end_line > 
pd->selection->start_line)
-               {
-                    elm_code_widget_cursor_position_set(widget, 
pd->selection->end_line, pd->selection->end_col+1);
-               }
           }
         else
           elm_code_widget_selection_clear(widget);
@@ -1853,6 +1842,20 @@ _elm_code_widget_key_down_cb(void *data, Evas *evas 
EINA_UNUSED,
 
              elm_code_widget_selection_end(widget, pd->cursor_line, 
pd->cursor_col - (adjust?1:0));
              _elm_code_widget_selection_in_progress_set(widget, EINA_FALSE);
+
+             if (pd->selection)
+               {
+                  if (pd->selection->end_line < pd->selection->start_line)
+                    {
+                       elm_code_widget_cursor_position_set(widget, 
pd->selection->end_line, pd->selection->end_col);
+                    }
+                  else if ((pd->selection->end_col == pd->selection->start_col 
&& !backwards) ||
+                           (pd->selection->end_col > pd->selection->start_col) 
||
+                           (pd->selection->end_line > 
pd->selection->start_line))
+                    {
+                       elm_code_widget_cursor_position_set(widget, 
pd->selection->end_line, pd->selection->end_col+1);
+                    }
+               }
           }
      }
 

-- 


Reply via email to