This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE: Add lineno sidebar to editor window
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: IDLE editor line numbers
View: 17535
Assigned To: terry.reedy Nosy List: cheryl.sabella, louielu, taleinat, terry.reedy
Priority: normal Keywords:

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:47adminsetgithub: 74848
2019-07-10 02:59:49terry.reedysetmessages: + msg347594
2019-07-09 06:42:30taleinatsetmessages: + msg347523
2019-07-08 17:58:37terry.reedysetnosy: + taleinat, cheryl.sabella
messages: + msg347502
2019-07-08 09:04:15cheryl.sabellasetstatus: open -> closed
superseder: IDLE editor line numbers
resolution: duplicate
stage: resolved
2017-06-14 09:16:47louielusetpull_requests: + pull_request2233
2017-06-14 09:14:41louielucreate