@@ -43,8 +43,7 @@ void ekg::ui::refresh_cursors_pos(
4343) {
4444 bool is_resize {ekg::has<ekg::dock>(direction, ekg::dock::resize)};
4545 for (ekg::textbox_t ::cursor_t &cursor : textbox.widget .cursors ) {
46- if (cursor.is_ignored ) continue ;
47- if (cursor.a .y < origin.a .y ) continue ;
46+ if (cursor.is_ignored || cursor.a .y < origin.a .y ) continue ;
4847
4948 if (!is_resize) {
5049 if (
@@ -479,6 +478,21 @@ void ekg::ui::handle_insert(
479478 if (typed == EKG_EOF_SYSTEM) {
480479 std::string line {textbox.text .at (cursor.a .y )};
481480
481+ ekg::textbox_t ::cursor_t origin {cursor};
482+ origin.a = origin.delta ;
483+ origin.b = origin.delta ;
484+
485+ cursor.is_ignored = true ;
486+ ekg::ui::refresh_cursors_pos (
487+ textbox,
488+ origin,
489+ {cursor.b .x - cursor.a .x , 0 },
490+ {cursor.b .x - cursor.a .x , 0 },
491+ {cursor.b .x - cursor.a .x , 0 },
492+ ekg::dock::left
493+ );
494+ cursor.is_ignored = false ;
495+
482496 textbox.text .set (cursor.a .y , ekg::utf8_substr (line, 0 , cursor.a .x ));
483497 textbox.text .insert (cursor.a .y , ekg::utf8_substr (line, cursor.a .x , UINT32_MAX));
484498
@@ -734,17 +748,20 @@ void ekg::ui::event(
734748 bool is_action_selected_keybind_fired {ekg::fired (" textbox-action-select" )};
735749 bool is_action_selected_fired {};
736750 bool is_action_break_line_fired {ekg::fired (" textbox-action-break-line" )};
751+ bool block_if_ab_diff_when_erased_is_fired {};
737752
738753 bool is_modifier_fired {ekg::fired (" textbox-action-modifier" )};
739754 bool is_left_fired {ekg::fired (" textbox-action-left" )};
755+ bool is_bind_left_fired {is_left_fired};
740756 bool is_modifier_left_fired {};
741757 bool is_right_fired {ekg::fired (" textbox-action-right" )};
758+ bool is_bind_right_fired {is_right_fired};
742759 bool is_modifier_right_fired {};
743760 bool is_up_fired {ekg::fired (" textbox-action-up" )};
744761 bool is_modifier_up_fired {is_up_fired && is_modifier_fired};
745762 bool is_down_fired {ekg::fired (" textbox-action-down" )};
746763 bool is_modifier_down_fired {is_down_fired && is_modifier_fired};
747- bool is_arrows_fired {is_left_fired || is_right_fired || is_up_fired || is_down_fired};
764+ bool is_arrows_fired {is_left_fired || is_right_fired || is_up_fired || is_down_fired};
748765
749766 if (is_action_paste) {
750767 input.was_typed = true ;
@@ -795,8 +812,8 @@ void ekg::ui::event(
795812 is_ab_equals = cursor.a == cursor.b ;
796813
797814 is_action_selected_fired = (is_arrows_fired && is_action_selected_keybind_fired) || (is_action_erase_fired && is_ab_equals);
798- is_left_fired = is_left_fired || (is_action_erase_left_fired && is_ab_equals);
799- is_right_fired = is_right_fired || (is_action_erase_right_fired && is_ab_equals);
815+ is_left_fired = is_bind_left_fired || (is_action_erase_left_fired && is_ab_equals);
816+ is_right_fired = is_bind_right_fired || (is_action_erase_right_fired && is_ab_equals);
800817
801818 is_modifier_left_fired = is_left_fired && is_modifier_fired;
802819 is_modifier_right_fired = is_right_fired && is_modifier_fired;
@@ -829,7 +846,6 @@ void ekg::ui::event(
829846 cursor.delta = cursor.a ;
830847 }
831848
832-
833849 if (is_left_fired) {
834850 if (is_ab_equals) {
835851 if (cursor.a .x > 0 ) {
@@ -960,7 +976,7 @@ void ekg::ui::event(
960976 }
961977
962978 /* *
963- * While firstly we move cursor and check the right direction.
979+ * First we move cursor and check the right direction (first structure like this). Then .
964980 * We need check again the right direction after moved.
965981 * This will make possible modifier works with select from any direction.
966982 **/
0 commit comments