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 - add "paste code" functionality #45519

Open
taleinat opened this issue Sep 18, 2007 · 7 comments
Open

IDLE - add "paste code" functionality #45519

taleinat opened this issue Sep 18, 2007 · 7 comments
Assignees
Labels
3.10 only security fixes topic-IDLE type-feature A feature request or enhancement

Comments

@taleinat
Copy link
Contributor

BPO 1178
Nosy @terryjreedy
Files
  • IDLE_paste_code.070918.patch
  • 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 2007-09-18.22:03:30.736>
    labels = ['expert-IDLE', 'type-feature', '3.10']
    title = 'IDLE - add "paste code" functionality'
    updated_at = <Date 2020-06-13.08:27:41.812>
    user = 'https://github.com/taleinat'

    bugs.python.org fields:

    activity = <Date 2020-06-13.08:27:41.812>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2007-09-18.22:03:30.736>
    creator = 'taleinat'
    dependencies = []
    files = ['8447']
    hgrepos = []
    issue_num = 1178
    keywords = ['patch']
    message_count = 7.0
    messages = ['56017', '116565', '122040', '122480', '122481', '209851', '371443']
    nosy_count = 1.0
    nosy_names = ['terry.reedy']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1178'
    versions = ['Python 3.10']

    @taleinat
    Copy link
    Contributor Author

    Patch adding a 'Paste Code' item to the 'Edit' menu, as well as hotkeys.

    Using 'Paste Code' instead of the normal paste will remove prompts ('>>>
    ' or '... ') from the code, and also remove empty lines if pasting to a
    shell window.

    This allows easily copy/pasting code between shell and editor windows,
    as well as easily pasting code from other applications (e.g. a web
    browser) into IDLE.

    This patch uses IDLE's PyParse.py for parsing code, and Tk's clipboard
    API for interaction with the clipboard (it changes the clipboard's
    contents, generates a normal paste event, and changes the contents back).

    Test only on WinXP SP2 so far, needs to be tested on other platforms,
    especially the clipboard interaction.

    @taleinat taleinat added type-bug An unexpected behavior, bug, or error topic-IDLE labels Sep 18, 2007
    @jafo jafo mannequin assigned ronaldoussoren Sep 18, 2007
    @jafo jafo mannequin added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Sep 18, 2007
    @jafo jafo mannequin assigned nobody and unassigned ronaldoussoren Sep 18, 2007
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Sep 16, 2010

    This has already been implemented.

    @BreamoreBoy BreamoreBoy mannequin closed this as completed Sep 16, 2010
    @ned-deily
    Copy link
    Member

    (Reopening as the previous message appears to be incorrect.)

    @terryjreedy
    Copy link
    Member

    I would really like something like this -- for 3.2b1 next week.
    I am constantly running posted interactive code and the lack of this is a major nuisance. There seems to be a glitch in how the editor deals with '>>> ' when trying to delete it.
    
    However, as well as removing '>>> ' and '... ' from code lines,
    I would like it to add '# ' to output lines. I do not see that in the patch.

    Since I have XP also (and access to Win7) I would consider this working on those two sufficient reason to commit. As near as I can tell, the patch cannot possibly break other systems as long as the feature is not used. Once in the beta, it could get wider testing.

    @terryjreedy
    Copy link
    Member

    An alternative approach would be to leave pasting alone but add a
    'Convert interactive code' option to the format menu, with keycode alt-v (not currently used as far as I can see).

    @terryjreedy
    Copy link
    Member

    By already implemented, I presume Mark was referring to the PastePyShell.py extension that is part of the IdleX package http://idlex.sourceforge.net/. I plan to take a look.

    @terryjreedy
    Copy link
    Member

    I would like to add 'Save code' to the Shell menu, but this would still be needed. A strip_noncode function could be shared.

    @terryjreedy terryjreedy added the 3.10 only security fixes label Jun 13, 2020
    @terryjreedy terryjreedy self-assigned this Jun 13, 2020
    @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.10 only security fixes topic-IDLE type-feature A feature request or enhancement
    Projects
    Status: No status
    Development

    No branches or pull requests

    4 participants