bpo-33763: IDLE: Use text widget for code context instead of label widget
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee='https://github.com/terryjreedy'closed_at=<Date2018-06-08.05:51:45.812>created_at=<Date2018-06-04.05:54:31.834>labels= ['3.8', 'expert-IDLE', 'type-feature', '3.7']
title='IDLE: click on context line should jump to line, at top of window'updated_at=<Date2018-06-08.05:51:45.811>user='https://github.com/terryjreedy'
Item 8. on bpo-33610. Clicking on a line in the context box jumps the editor to that line, displayed as the first line. If we do item 11, replace Label with Text, this has to start after bpo-33763 is merged.
We could determine the context line clicked from click event.y by using .dlineinfo('1.0') on the editor window to get the offset and height of textlines for the font used.
Disabled texts still have an 'insert' mark that is moved by clicks. It is just not visible. The line clicked on is int(self.context.index('insert').split('.')),
or next(map(int, t.index('insert').split('.'))),
or s=t.index('insert'); int(s[:s.find('.')])
the same as if the context were 'normal' with a visible cursor.
This only works if the default click handler fires first, so the mark is moved before we look at it. The default handler is a class binding to Button (press), so we should just be able to bind to ButtonRelease, which is generally a better choice anyway "because if the user accidentally presses the button, they can move the mouse off the widget to avoid setting off the event."