Issue 30663: IDLE: Add lineno sidebar to editor window (original) (raw)

Created on 2017-06-14 09:14 by louielu, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2183 closed louielu,2017-06-14 09:16
Messages (4)
msg295995 - (view) Author: Louie Lu (louielu) * Date: 2017-06-14 09:14
In #7676, the desired pattern request from Terry is to create a sidebar and show the prompt in the sidebar. To complete the request, this patch add the lineno sidebar in editor window , to prove that the sidebar in IDLE is feasible. The different in pyshell, it that the sidebar will need to deal with indent (to not show the prompt).
msg347502 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-07-08 17:58
A closing note: Saimadhav Heblikar's initial patch on #17535 was a standalone proof-of-concept file was based on Canvas and Text subclasses. The latter consisted mostly of two tk.eval(tcl_code) calls. I rejected the idea of using tk.eval, as review and maintenance would requires knowing tcl. But the submission won him my GSOC mentorship (and we did quite well working together, even though line-numbering was not finished). Saimadhav's poc appears to have been inspired by Bryan Oakley's Canvas and Text-based answer a year earlier on https://stackoverflow.com/a/16375233. But Bryan only used tk.call and tk.createcommand, not tk.eval. Some of Saimadhav's tcl appears to be a translation of some of Bryan's python. PR 2183 is a full patch also based on Canvas and Text and explicitly inspired by Oakley's answer. However, the Text subclass is an edited version of Saimadhav's tk.eval version, not Oakley's. This is properly closed as a duplicate, but it does provide the Oakley link, which does not appear on #17535.
msg347523 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2019-07-09 06:42
Thanks for helping to move this forward, Louie! My worry with this approach is that all of the line numbers are redrawn upon scrolling, which would be likely to make scrolling less smooth, especially on low-end hardware (where IDLE is relatively often used). The alternate implementation approach we are pursuing in #17535 uses a second text widget, whose scrolling is synced to the main text widget, and whose contents are only updated when the number of lines in the main text widget changes.
msg347594 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-07-10 02:59
Oakley's patch was intentionally very general, allowing line number heights to vary because of different fonts, font sizes, or widget inclusions. This required positioning line numbers by pixel (hence canvas) and accommodating line size changes even in the absence of newline changes. IDLE's need is simpler (fortunately)l.
History
Date User Action Args
2022-04-11 14:58:47 admin set github: 74848
2019-07-10 02:59:49 terry.reedy set messages: +
2019-07-09 06:42:30 taleinat set messages: +
2019-07-08 17:58:37 terry.reedy set nosy: + taleinat, cheryl.sabellamessages: +
2019-07-08 09:04:15 cheryl.sabella set status: open -> closedsuperseder: IDLE editor line numbersresolution: duplicatestage: resolved
2017-06-14 09:16:47 louielu set pull_requests: + <pull%5Frequest2233>
2017-06-14 09:14:41 louielu create