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

Tab behaves strangely when not being used for completion in Python Console #11532

Closed
XLTechie opened this issue Aug 29, 2020 · 1 comment · Fixed by #11936
Closed

Tab behaves strangely when not being used for completion in Python Console #11532

XLTechie opened this issue Aug 29, 2020 · 1 comment · Fixed by #11936
Milestone

Comments

@XLTechie
Copy link
Collaborator

I am not sure what the tab is meant to do in the Python Console. However, since I am used to using it for indentation, I do, and it normally works fine for this purpose.
However, I recently had occasion to need to indent some code I had written further than it previously was.
I can just use space, but by default, I am used to using tab.

Steps to reproduce:

  1. Press keys: NVDA+n, t, p, to open the python console.
  2. Type some code such as this:
    print("Some test code.")
  3. That code runs fine. But now, let's say you need to put that code in a function. Obviously this example is easy to just retype, but imagine if it was 10 lines of very complex code, and you now wanted to encapsulate it in a function. First, enter:
    def testFunc(parameter):
  4. So far, so good. But now, up arrow and try to include your code from before. You can't just accept the print statement as entered, because it isn't indented. You can press home to get to the start of the line, and then press tab to indent it.

Actual behavior:

When you press tab, the cursor jumps back to the end of the line, and then the tab is inserted.
So the tab appears at the end of the line, instead of at the beginning where it was expected.

Expected behavior:

If a tab is going to show up anywhere in this situation, I would expect it to be at the beginning of the line (I.E. where the cursor is.).
A tab on a blank line, produces a tab character at the start of that line. I would expect a tab at the start of any line to do the same, since there is no completion context for tab to operate on.

System configuration

NVDA portable alpha-20793,9a4074bc.
Windows 10 2004.

@Adriani90
Copy link
Collaborator

cc: @feerrenrut, @JulienCochuyt

JulienCochuyt added a commit to accessolutions/nvda that referenced this issue Dec 13, 2020
…ss#11532)

 * Support indenting with tabs when editing a non-empty input line
 * Support tab-completion in the middle of an input line
michaelDCurran pushed a commit that referenced this issue Jan 21, 2021
#11936)

* Python Console: Fix handling of the tab key in the input pane (#11532)

 * Support indenting with tabs when editing a non-empty input line
 * Support tab-completion in the middle of an input line

* Python Console: Tab-completion: Handle selection

 * Consider selection start rather than cursor position (different if selection is anchored at start)
 * Replace selection upon successful completion
@nvaccessAuto nvaccessAuto added this to the 2021.1 milestone Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants