Skip to content

gh-38066: IDLE: Dedenting with shift+tab#2210

Open
mlouielu wants to merge 4 commits intopython:mainfrom
mlouielu:add_dedent
Open

gh-38066: IDLE: Dedenting with shift+tab#2210
mlouielu wants to merge 4 commits intopython:mainfrom
mlouielu:add_dedent

Conversation

@mlouielu
Copy link
Copy Markdown
Contributor

@mlouielu mlouielu commented Jun 15, 2017

@matssson
Copy link
Copy Markdown

This would be really useful, since I use IDLE a lot when I wanna do something fast, and indentation is so important. The other keyboard shortcut doesnt really work on my layout

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Feb 19, 2022
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jul 28, 2022
@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Aug 28, 2022
@hauntsaninja hauntsaninja changed the title bpo-694339: IDLE: Dedenting with shift+tab gh-38066: IDLE: Dedenting with shift+tab Jan 7, 2023
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jan 8, 2023
@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Feb 7, 2023
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Dec 19, 2024
@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jan 19, 2025
@StanFromIreland
Copy link
Copy Markdown
Member

Bumping this PR. Very nice feature, implementation seems good, someone should build to double check.

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jan 26, 2025
@kamek kamek mannequin mentioned this pull request Apr 9, 2022
@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Feb 25, 2025
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 19, 2025
@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jun 18, 2025
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Oct 11, 2025
@python python deleted a comment from github-actions Bot Oct 12, 2025
@python python deleted a comment from github-actions Bot Oct 12, 2025
@python python deleted a comment from github-actions Bot Oct 12, 2025
@python python deleted a comment from github-actions Bot Oct 12, 2025
@python python deleted a comment from github-actions Bot Oct 12, 2025
@python python deleted a comment from github-actions Bot Oct 12, 2025
Copy link
Copy Markdown
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I fixed merge conflict okay. But must manually test on multiple OSes before merge.
Will make news entry if decide to merge.

smart-backspace=<Key-BackSpace>
newline-and-indent=<Key-Return> <Key-KP_Enter>
smart-indent=<Key-Tab>
smart-dedent=<Shift-ISO_Left_Tab>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StanFromIreland
I found ISO keysyms on https://www.tcl-lang.org/man/tcl8.6/TkCmd/keysyms.htm.
Unknown to me and likely new in 8.6. Are these a linux (unix) thing? Would 'tab' really not work?
In any case, 'Key' for the event should still be needed before the keysym.

Suggested change
smart-dedent=<Shift-ISO_Left_Tab>
smart-dedent=<Shift-Key-ISO_Left_Tab>

Repeat twice below.

Copy link
Copy Markdown
Member

@StanFromIreland StanFromIreland Oct 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not a tk thing, but an X11 thing.

I tested, and just smart-dedent=<Shift-Key-Tab> does not work.

On my system it is actually not necessary to have Key- (but it is best to have it anyway IMO). Secondly, ISO_Left_Tab implies Shift, although IIRC this is not always the case and causes problems with some apps.

@terryjreedy
Copy link
Copy Markdown
Member

I added comments to issue about what I think ShiftTab should do. I will manually what it does do, on Windows, tomorrow. Stan, can you try it on Linux?

@StanFromIreland
Copy link
Copy Markdown
Member

The current implementation is broken, whenever I try to dedent I get:

Exception in Tkinter callback
Traceback (most recent call last):
  File "cpython/Lib/tkinter/__init__.py", line 2088, in __call__
    return self.func(*args)
           ~~~~~~~~~^^^^^^^
  File "cpython/Lib/idlelib/editor.py", line 1402, in smart_dedent_event
    raw, effective = classifyws(prefix, self.tabwidth)
                     ^^^^^^^^^^
NameError: name 'classifyws' is not defined

Comment thread Lib/idlelib/editor.py Outdated
terryjreedy and others added 2 commits October 12, 2025 13:08
Correct function name.

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Nov 11, 2025
@sharktide
Copy link
Copy Markdown
Contributor

Bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review DO-NOT-MERGE stale Stale PR or inactive for long period of time. topic-IDLE

Projects

None yet

Development

Successfully merging this pull request may close these issues.