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: Goto should remove selection and update the status bar #84033

Closed
DaveLiptack mannequin opened this issue Mar 4, 2020 · 15 comments
Closed

IDLE: Goto should remove selection and update the status bar #84033

DaveLiptack mannequin opened this issue Mar 4, 2020 · 15 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life 3.9 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@DaveLiptack
Copy link
Mannequin

DaveLiptack mannequin commented Mar 4, 2020

BPO 39852
Nosy @gvanrossum, @terryjreedy, @miss-islington
PRs
  • bpo-39852: IDLE 'Go to line' deletes selection, updates status #18801
  • [3.8] bpo-39852: IDLE 'Go to line' deletes selection, updates status (GH-18801) #18857
  • [3.7] bpo-39852: IDLE 'Go to line' deletes selection, updates status (GH-18801) #18858
  • Files
  • selection_clear.py
  • 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 = <Date 2020-03-08.18:51:40.174>
    created_at = <Date 2020-03-04.18:12:17.807>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7', '3.9']
    title = 'IDLE: Goto should remove selection and update the status bar'
    updated_at = <Date 2020-03-09.20:46:53.135>
    user = 'https://bugs.python.org/DaveLiptack'

    bugs.python.org fields:

    activity = <Date 2020-03-09.20:46:53.135>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2020-03-08.18:51:40.174>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2020-03-04.18:12:17.807>
    creator = 'Dave Liptack'
    dependencies = []
    files = ['48957']
    hgrepos = []
    issue_num = 39852
    keywords = ['patch']
    message_count = 15.0
    messages = ['363370', '363392', '363439', '363457', '363487', '363490', '363514', '363579', '363670', '363671', '363672', '363691', '363695', '363740', '363770']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'terry.reedy', 'miss-islington', 'Dave Liptack']
    pr_nums = ['18801', '18857', '18858']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue39852'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @DaveLiptack
    Copy link
    Mannequin Author

    DaveLiptack mannequin commented Mar 4, 2020

    Python 3.8.1
    IDLE 3.8.1

    When COPYing text in IDLE, right-click and PASTE behaves like CUT/PASTE

    This also occurs with COPY -> Go to Line -> PASTE

    This does not occur with COPY -> left-click -> PASTE

    @DaveLiptack DaveLiptack mannequin added the 3.8 (EOL) end of life label Mar 4, 2020
    @DaveLiptack DaveLiptack mannequin assigned terryjreedy Mar 4, 2020
    @DaveLiptack DaveLiptack mannequin added topic-IDLE type-bug An unexpected behavior, bug, or error labels Mar 4, 2020
    @terryjreedy
    Copy link
    Member

    The standard and expected behavior is that pasting *without* a selection inserts, pasting *with* a selection replaces. Pasting with key, Edit menu, or context menu should be the same. This is what I see and what I *think* you are describing. If so, please close. If not, please specify OS and version, how you installed Python, and more concretely what you did and whether line numbers or code context were present.

    @DaveLiptack
    Copy link
    Mannequin Author

    DaveLiptack mannequin commented Mar 5, 2020

    OS: Windows 10 Pro
    Version: 1909
    OS Build: 18363.657

    Python 2.7.17 and 3.8.1 were installed from https://www.python.org/downloads/ using the Windows x86-64 executable installer (3.8.1) and Windows x86-64 MSI installer (2.7.17)

    Both line numbers and code context are not present

    To reproduce:

    1. Position cursor at the start of a line of text
    2. Type Shift+down arrow (to select line of text)
    3. Type Ctrl+c
    4. Type Alt+g (IDLE) or Ctrl+g (Notepad, Notepad++)
    5. Enter line number (for example below line number = 2)
    6. Type Enter
    7. Type Ctrl+v

    Example initial text:
    # This is line 1

    # additional line
    # This is a line I wish to duplicate
    # another additional line

    Resulting text in IDLE:
    # This is line 1
    # This is a line I wish to duplicate

    # additional line
    # another additional line

    Resulting text in Notepad and Notepad++:
    # This is line 1
    # This is a line I wish to duplicate

    # additional line
    # This is a line I wish to duplicate
    # another additional line

    My workaround in IDLE is to add a step between #6 and #7 above, where I mouse click at the desired paste location

    @terryjreedy
    Copy link
    Member

    This is much clearer. To expand on what I said before, inserting *anything*, such as by hitting a key, replaces a selection. I verified that this is normal behavior, at least on Windows, with Notepad, Notepad++, and this Firefox entry box I am typing in. So either of your steps 6 or 7 delete the still selected line, after the goto. (And so a click is needed before 6 to stop the deletion.) I see the continued selection as the problem. Both Notepad and Notepad++ unselect any selection upon goto, the same as if one moved the cursor by clicking instead of goto.

    I will try adding text.selection_clear() to the goto code.

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.9 only security fixes labels Mar 5, 2020
    @terryjreedy terryjreedy changed the title IDLE: Copy/Paste behaves like Cut/Paste IDLE: Goto should remove any selection Mar 5, 2020
    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.9 only security fixes labels Mar 5, 2020
    @terryjreedy terryjreedy changed the title IDLE: Copy/Paste behaves like Cut/Paste IDLE: Goto should remove any selection Mar 5, 2020
    @terryjreedy
    Copy link
    Member

    selection_clear only partially clears a selection. That it does something is proven by selection_clear.py. It disables selection_get. But run the file in IDLE and when it finishes, click the tk window, select a line, click Shell, and manually repeat the last 3 lines. selection_get is disabled again, but upon clicking the title bar of the tk window (to not affect selection in the window), the selection is still highlighted. Further experiments showed that the insertion-deletion bug of this issue remains when using selection_own and selection_clear in IDLE.

    The alternative of simulating a click on the moved insert cursor is harder by works, at least on Windows. This also triggers a status-bar update -- see bpo-27115.

    @terryjreedy
    Copy link
    Member

    I am expanding this issue to include the part of bpo-27115 that the PR will fix. (I will also change the scope of the latter).

    @terryjreedy terryjreedy changed the title IDLE: Goto should remove any selection IDLE: Goto should remove selection and update the status bar Mar 6, 2020
    @terryjreedy terryjreedy changed the title IDLE: Goto should remove any selection IDLE: Goto should remove selection and update the status bar Mar 6, 2020
    @DaveLiptack
    Copy link
    Mannequin Author

    DaveLiptack mannequin commented Mar 6, 2020

    Like goto, right-click also exhibits this behavior. Should selection_clear also be added to right-click code?

    @terryjreedy
    Copy link
    Member

    Agreed about right clicks. See new issue bpo-39885.

    @terryjreedy
    Copy link
    Member

    New changeset 2522db1 by Terry Jan Reedy in branch 'master':
    bpo-39852: IDLE 'Go to line' deletes selection, updates status (GH-18801)
    2522db1

    @miss-islington
    Copy link
    Contributor

    New changeset a5e821c by Miss Islington (bot) in branch '3.8':
    bpo-39852: IDLE 'Go to line' deletes selection, updates status (GH-18801)
    a5e821c

    @miss-islington
    Copy link
    Contributor

    New changeset ec61f53 by Miss Islington (bot) in branch '3.7':
    bpo-39852: IDLE 'Go to line' deletes selection, updates status (GH-18801)
    ec61f53

    @gvanrossum
    Copy link
    Member

    I have a nit on the commit message used here (and also in bpo-39885). *Please* don't use this style of commit message "IDLE context menu clears selection". That phrasing sounds like it is the description of a bug. Please always use a phrasing that makes it clear what the commit/PR changes. In this case, for example, it could be "IDLE: make context menu clear selection".

    I know there are projects that prefer this style. Python is not one of them. Please comply.

    @terryjreedy
    Copy link
    Member

    Is it the temporal ambiguity (fixed by adding 'now', which is in the blurbs) or the descriptive versus command style (as with 'Returns' versus 'Return') that you do not like? If the latter, the devguide could use augmentation.

    The only relevant 'guidance' I found is this descriptive example in https://devguide.python.org/pullrequest/#making-good-commits: "the spam module is now more spammy". This seems similar to "IDLE context menu now clears selection". I don't see anything about commit messages in https://devguide.python.org/committing/, which seems like another likely place for such.

    @gvanrossum
    Copy link
    Member

    I guess it's similar to the 'return' vs. 'returns' issue, but I feel much
    stronger about it here.

    I would have written that as "make the spam module more spammy". Just read
    a bunch of commits using e.g. git log --oneline to see what the
    prevailing style is.

    @terryjreedy
    Copy link
    Member

    python/devguide#577

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 (EOL) end of life 3.9 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants