@@ -1838,12 +1838,12 @@ def action_cursor_left(self, select: bool = False) -> None:
1838
1838
Args:
1839
1839
select: If True, select the text while moving.
1840
1840
"""
1841
- if self . selection . is_empty :
1842
- target = self .get_cursor_left_location ()
1843
- self . move_cursor ( target , select = select )
1844
- else :
1845
- start , end = self . selection
1846
- self .move_cursor (min ( start , end ) , select = select )
1841
+ target = (
1842
+ self .get_cursor_left_location ()
1843
+ if select or self . selection . is_empty
1844
+ else min ( * self . selection )
1845
+ )
1846
+ self .move_cursor (target , select = select )
1847
1847
1848
1848
def get_cursor_left_location (self ) -> Location :
1849
1849
"""Get the location the cursor will move to if it moves left.
@@ -1861,12 +1861,12 @@ def action_cursor_right(self, select: bool = False) -> None:
1861
1861
Args:
1862
1862
select: If True, select the text while moving.
1863
1863
"""
1864
- if self . selection . is_empty :
1865
- target = self .get_cursor_right_location ()
1866
- self . move_cursor ( target , select = select )
1867
- else :
1868
- start , end = self . selection
1869
- self .move_cursor (max ( start , end ) , select = select )
1864
+ target = (
1865
+ self .get_cursor_right_location ()
1866
+ if select or self . selection . is_empty
1867
+ else max ( * self . selection )
1868
+ )
1869
+ self .move_cursor (target , select = select )
1870
1870
1871
1871
def get_cursor_right_location (self ) -> Location :
1872
1872
"""Get the location the cursor will move to if it moves right.
0 commit comments