Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idle Editor: Bottom Scroll Bar #42010

Open
voidspace opened this issue May 24, 2005 · 13 comments
Open

Idle Editor: Bottom Scroll Bar #42010

voidspace opened this issue May 24, 2005 · 13 comments
Assignees
Labels
3.9 only security fixes topic-IDLE type-feature A feature request or enhancement

Comments

@voidspace
Copy link
Contributor

BPO 1207613
Nosy @terryjreedy, @taleinat, @stevendaprano, @voidspace, @rovitotv, @csabella
PRs
  • gh-42010: IDLE Editor Bottom Scroll Bar #1984
  • bpo-1207613: Add scrollbar to IDLE editor #32116
  • 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

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = None
    created_at = <Date 2005-05-24.09:08:33.000>
    labels = ['expert-IDLE', 'type-feature', '3.9']
    title = 'Idle Editor: Bottom Scroll Bar'
    updated_at = <Date 2022-03-25.17:31:26.596>
    user = 'https://github.com/voidspace'

    bugs.python.org fields:

    activity = <Date 2022-03-25.17:31:26.596>
    actor = 'python-dev'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2005-05-24.09:08:33.000>
    creator = 'michael.foord'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 1207613
    keywords = ['patch']
    message_count = 12.0
    messages = ['54533', '54534', '164436', '164446', '228302', '291301', '295332', '295374', '352888', '362669', '377227', '388479']
    nosy_count = 7.0
    nosy_names = ['terry.reedy', 'taleinat', 'steven.daprano', 'michael.foord', 'Todd.Rovito', 'python-dev', 'cheryl.sabella']
    pr_nums = ['1984', '32116']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1207613'
    versions = ['Python 3.9']

    @voidspace
    Copy link
    Contributor Author

    IDLE comes without a horizontal (bottom) scroll bar. In
    general this is preferable, but there are times when it's a
    nuisance.

    It would be nice to have an option (easily accessible) to
    switch this on.

    @mjfoord mjfoord mannequin closed this as completed May 24, 2005
    @mjfoord mjfoord mannequin assigned kbkaiser May 24, 2005
    @mjfoord mjfoord mannequin added topic-IDLE type-feature A feature request or enhancement labels May 24, 2005
    @mjfoord mjfoord mannequin closed this as completed May 24, 2005
    @mjfoord mjfoord mannequin assigned kbkaiser May 24, 2005
    @mjfoord mjfoord mannequin added topic-IDLE type-feature A feature request or enhancement labels May 24, 2005
    @kbkaiser
    Copy link
    Contributor

    Logged In: YES
    user_id=149084

    IDLE is intended to present a simple interface to
    beginners and to encourage good style. I believe that
    GvR made a deliberate decision not to have a horiz
    scroll bar to discourage lines longer that 80 char.

    If you want to code a patch, I'd accept it. However,
    the config switch should be in config-main.def only, and
    the selection should not appear on the Options dialog.

    That way an experienced user could set it in
    .idlerc/config-main.cfg

    @terryjreedy
    Copy link
    Member

    bpo-15141, which I will close as a duplicate, makes the same request (for the edit window). Roger Serwy notes that his extension package
    http://idlex.sourceforge.net/extensions.html
    has horizontal.py, which does what is requested. He is willing for that (or other) extension(s) to be bundled with idle for default or optional activation. I presume that is done in some .cfg file. I re-opened for that purpose.

    (Note: it would seem nice to be able to get a list of extensions available and those enabled from the menu. Or is there a reason not too?)

    Some arguments for h. scroll:

    1. The shell window is a print output as well as code input window. Output should not necessarily be limited to 80 chars. With variable pitch font, that does not even make much sense.
    2. Edit windows are not limited to python code. Else they would *always* syntax hilight. Or Pycode might be embedded in other formats. If bpo-6858 were implemented, h scroll would be more useful.
    3. Not everyone agrees with the 80 char limits.
    4. People sometimes edit a file written by someone else.

    Counter-arguments:

    1. A full screen window allows about 200 chars or more, which is enough for any code entry and most print output and most 'files written by someone else'.
    2. For exceptions, put cursor on long line and use => arrow key.

    @terryjreedy terryjreedy reopened this Jul 1, 2012
    @terryjreedy terryjreedy reopened this Jul 1, 2012
    @serwy
    Copy link
    Mannequin

    serwy mannequin commented Jul 1, 2012

    I wrote Horizontal.py as an extension in order to avoid forking IDLE. It
    should be simple to incorporate a toggling horizontal scroll bar within
    the EditorWindow class itself.

    (Note: it would seem nice to be able to get a list of extensions available and those enabled from the menu. Or is there a reason not too?)

    IdleX provides a dialog for enabling and disabling extensions.

    The shell window has wrapping enabled on its text widget. A horizontal
    bar is not needed there.

    1. Edit windows are not limited to python code. Else they would *always* syntax hilight. Or Pycode might be embedded in other formats. If bpo-6858 were implemented, h scroll would be more useful.
      True. The Editor window does not wrap, which is why the horizontal bar
      is needed there.
    2. Not everyone agrees with the 80 char limits.
      The limit does make printing code simpler, however. But that's a
      separate discussion.
    3. People sometimes edit a file written by someone else.
      Yes, and often times it is one or two lines in the file that extend
      beyond the right border of the editor.
      Counter-arguments:
    4. A full screen window allows about 200 chars or more, which is enough for any code entry and most print output and most 'files written by someone else'.
      I shouldn't have to resize the editor to see its contents.
    5. For exceptions, put cursor on long line and use => arrow key.

    ----------
    nosy: +serwy, terry.reedy
    resolution: rejected ->
    status: closed -> open
    versions: +Python 3.4


    Python tracker<report@bugs.python.org>
    <http://bugs.python.org/issue1207613\>


    @RamchandraApte RamchandraApte mannequin changed the title Bottom Scroll Bar Bottom Scroll Bar in IDLE Mar 26, 2013
    @RamchandraApte RamchandraApte mannequin changed the title Bottom Scroll Bar Bottom Scroll Bar in IDLE Mar 26, 2013
    @terryjreedy
    Copy link
    Member

    patch to be pulled from idlex

    @terryjreedy terryjreedy changed the title Bottom Scroll Bar in IDLE Idle Editor: Bottom Scroll Bar Aug 7, 2015
    @terryjreedy terryjreedy changed the title Bottom Scroll Bar in IDLE Idle Editor: Bottom Scroll Bar Aug 7, 2015
    @terryjreedy
    Copy link
    Member

    I don't like telling people to hand-edit .idlerc files. It causes too many problems. We added Extensions tab to avoid this. I think all supported options should be on dialog.

    Windows are resizable and accommodate lines up to current width. Default width is user settable option. So people who want to edit 100 char lines for code can and have editor open with 100 char width.

    Shell,Edit, and Output windows should not necessarily be same. Currently, Shell wraps both input and output while Editor Output truncate code input and grep output respectively. I plan to review this, including possible scrollbar, but not a priority.

    @csabella
    Copy link
    Contributor

    csabella commented Jun 7, 2017

    I hope you don't mind that I made a change for this. I was working with 'Find in files' and couldn't see the full line, so I figured out where to add the scroll bar. I only found this ticket after the fact.

    If it's not appropriate, I can withdraw the PR.

    @terryjreedy
    Copy link
    Member

    Output Window definitely needs a scrollbar available on screens where it cannot be stretched to 160 chars or so. Thinking about it, if one greps idlelib in a local install, with a url something like C:/users/somename/appdata/local/python/lib/idlelib/*.py, one only needs 100 chars to pick up the idlelib file name and code, but needs the scrollbar to display the last 100 chars instead of the first 100 chars.

    To add to msg16443: the fact that one can stretch the window much wider than 80 chars means that omitting a scrollbar does not enforce an 80-char limit.

    @terryjreedy
    Copy link
    Member

    A horizontal text bar is added to a text view as needed (recent patch) when one is used for the font sample. The latter fits or not according to the font size. The same could be used for editor, or better, editor windows could inherit from text views.

    @terryjreedy terryjreedy added 3.9 only security fixes labels Sep 20, 2019
    @terryjreedy
    Copy link
    Member

    Some IDLE users really want a horizontal scrollbar (for the editor), and even consider its absence to be a reason to not use it.

    Stackoverflow 2012: https://stackoverflow.com/questions/10301071/is-there-a-horizontal-scroll-bar-in-pythons-idle

    Reddit 2020: https://stackoverflow.com/questions/10301071/is-there-a-horizontal-scroll-bar-in-pythons-idle
    This was brought to my attention by Steven D'Aprano and specifically compare the IDLE editor to other editors.

    I have decided to not wait until a possible major refactoring to add this feature. The patch needs several revisions (see review).

    I neglected to mention above (msg352888) that the scrollbar added to the font sample box is a Scrollbar subclass, textview.AutoHideScrollbar, that only appears when needed. After experimenting with editing the font sample, I think we can just add this with no option to disable it.

    Since editor windows already allow lines longer than the window width and already have horizontal scrolling by cursor motion, such as by Home, End, and Left and Right arrow keys, adding a horizontal scrollbar makes scrolling easier, but does not really change editor window behavior. The disappearance of the scrollbar when a long line is sufficiently shortened makes it easier to determine when one has shortened a line enough to meet the window width as a limit, if one wishes.

    The shell is a different issue. It wraps at the window width, just like standard interactive Python (as least on Windows with Command Prompt and macOS with Terminal). I think something like the following is better wrapped. If nothing else, copying to paste is easier ;-).

    >>> 2**1024
    179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216

    So, at least for now, no hbar for Shell.

    @taleinat
    Copy link
    Contributor

    We've run into a significant technical hurdle in trying to implement a horizontal scrollbar: The Tk text widget sets the horizontal scroll position only according to the currently visible lines! If the text was scrolled to the right, scrolling down to where there are only shorter lines will scroll the text back to the left!!

    Implementing this will require either getting a fix for this into Tk itself, or finding a good workaround.

    The workaround I was considering--wrapping the text widget with a frame and implementing custom scrolling logic--is very unlikely to provide reasonable performance with large files. This is because it will have to have all of the text widget rendered at all times, which the Tk Text widget takes special care to avoid in order to achieve good performance.

    @terryjreedy
    Copy link
    Member

    Request in bpo-43467 closed as duplicate of this.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    @terryjreedy
    Copy link
    Member

    I still would like to add this. I closed the PR because it is at an impass. I'd like to make other editor changes first before trying to resolve merge conflicts or think about another approach. I'd like also to read the IdleX code.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes topic-IDLE type-feature A feature request or enhancement
    Projects
    Status: In Progress
    Development

    No branches or pull requests

    5 participants