MCPcopy Index your code
hub / github.com/python/cpython / move_at_edge_if_selection

Method move_at_edge_if_selection

Lib/idlelib/editor.py:634–652  ·  view source on GitHub ↗

Cursor move begins at start or end of selection When a left/right cursor key is pressed create and return to Tkinter a function which causes a cursor move from the associated edge of the selection.

(self, edge_index)

Source from the content-addressed store, hash-verified

632 return "break"
633
634 def move_at_edge_if_selection(self, edge_index):
635 """Cursor move begins at start or end of selection
636
637 When a left/right cursor key is pressed create and return to Tkinter a
638 function which causes a cursor move from the associated edge of the
639 selection.
640
641 """
642 self_text_index = self.text.index
643 self_text_mark_set = self.text.mark_set
644 edges_table = ("sel.first+1c", "sel.last-1c")
645 def move_at_edge(event):
646 if (event.state & 5) == 0: # no shift(==1) or control(==4) pressed
647 try:
648 self_text_index("sel.first")
649 self_text_mark_set("insert", edges_table[edge_index])
650 except TclError:
651 pass
652 return move_at_edge
653
654 def del_word_left(self, event):
655 self.text.event_generate('<Meta-Delete>')

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected