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

Cannot move cursor when running a list prompt #117

Closed
digable-dissenter opened this issue Aug 21, 2021 · 18 comments
Closed

Cannot move cursor when running a list prompt #117

digable-dissenter opened this issue Aug 21, 2021 · 18 comments

Comments

@digable-dissenter
Copy link

digable-dissenter commented Aug 21, 2021

Similar to issue #40, but I am not trying to run in any container.

Also, similarly, I can still press return to get a value from the prompt, but since the cursor doesn't move it will always give me the first option. Any ideas?

Running on a Windows 10 machine, with Python 3.9 installed. I also assume that I am running the latest version of inquirer

@jhonatan-lopes
Copy link

I can reproduce the bug.

I am also running python 3.9 on windows 10 and cannot move the cursor. Tried on powershell and on cmd. Return key and spacebar selection work.

Running the mixed.py example, everything works well, except for the inquirer.Checkbox which only allows me to select the first option since the arrow keys do not work.

@ml170722d
Copy link

ml170722d commented Dec 13, 2021

I can reproduce the bug as well.

inquirer.Checkbox and inquirer.List aren't letting me use my arrow keys to move up and down, so I'm forced to used only first option.

Other options (inquirer.Text, inquirer.Editor and inquirer.Path) are working as they should.

@staticdev
Copy link
Collaborator

Could you provide a minimal example code to reproduce the error?

@ml170722d
Copy link

I was using code from examples provided in repo.

import os
import sys
from pprint import pprint

sys.path.append(os.path.realpath("."))
import inquirer  # noqa

questions = [
    inquirer.List(
        "size",
        message="What size do you need?",
        choices=["Jumbo", "Large", "Standard", "Medium", "Small", "Micro"],
    ),
    inquirer.Checkbox(
        "interests",
        message="What are you interested in?",
        choices=["Computers", "Books", "Science", "Nature", "Fantasy", "History"],
        default=["Computers", "Books"],
    )
]

answers = inquirer.prompt(questions)

pprint(answers)

I'm using IntelliJ Idea from Jet Brains. I was using terminal built into IDE and it didn't want to run as it was supposed to, but then I ran it from PowerShell and it worked. I fount this few days ago by accident.

When it was running it in terminal IDE it didn't respond to my arrow presses, but in CMD and PowerShell it did.
This is weird since terminal in IDE is supposed to use PowerShell. I don't know why this is happening. I guess it's problem with IntelliJ Ideas terminal?

If someone knows why is this is happening please let me know. 😄

@hggmarks
Copy link

Long story short: The way i've discovered was turn off numlock and use the 'numpad arrow keys'.

Something like this happened to me, when i was running it on my VSCode built-in terminal, everything worked just fine but when i ran it from my shell (CMD, or PowerShell) the cursor didn't move as well. I don't know why that's happening but in my case i turn off the numlock of my keyboard and i was able to move it pressing the numpad's '8' and '2' that alternative arrows that some keyboards have.

(Running on Windows 10 and was on my laptop's keyboard, if that means something!)

I've tested it in many ways in my computer and worked, if someone else could check this and say if it worked let me know :D

@aendle
Copy link

aendle commented Jan 28, 2022

I've tested it in many ways in my computer and worked, if someone else could check this and say if it worked let me know :D

So I tested this with python 3.7 and 3.10 on windows 10 and 11.
Arrows don't work in powershell or CMD. Turing off numpad and using those keys work.
Seems like an issue with mapping the correct key input of a windows device to the inquirer.
However, if you don't have a numpad it's impossible to use.

EDIT*
clearly the issue is magmax/python-readchar#66
When pressing any arrow key in readchar.readkey() it returns nothing.

@JoeBrunsTR
Copy link

I've tested it in many ways in my computer and worked, if someone else could check this and say if it worked let me know :D

So I tested this with python 3.7 and 3.10 on windows 10 and 11. Arrows don't work in powershell or CMD. Turing off numpad and using those keys work. Seems like an issue with mapping the correct key input of a windows device to the inquirer. However, if you don't have a numpad it's impossible to use.

EDIT* clearly the issue is magmax/python-readchar#66 When pressing any arrow key in readchar.readkey() it returns nothing.

+1

@razvan-cretu
Copy link

I also can't move the cursor on anaconda's cmd when using the arrows.. and I don't have a numpad. (py397)

@Natsume-197
Copy link

There is any fix for this?

@kronus-IT
Copy link

Same problem, unable to move cursor in Windows 11, also don't have a numpad.

Is there as fix or one on the horizon?

Many thanks

@metrodorian
Copy link

Got the same Problem with Windows 11, Python 3.9 and 3.7, no Numblock on the keyboard.
I am guessing there is a Windows end-of-line-error here?

@Cube707
Copy link
Collaborator

Cube707 commented Apr 6, 2022

I provied the fix under magmax/python-readchar#71, but it's still waiting to be merged.

@MrKevinWeiss
Copy link

Same here, would be nice to get a fix.

@razvan-cretu
Copy link

@magmax Sorry to bother, could you please merge this PR magmax/python-readchar#71

@Cube707
Copy link
Collaborator

Cube707 commented Jul 24, 2022

readchar just released a new version that should fix this. Please confirm

@guiperalta
Copy link

@Cube707 moving cursor with keyboard arrows working on windows, thank you!

@guiperalta
Copy link

@Cube707 moving cursor with keyboard arrows working on windows, thank you!

Windows 10

@Cube707
Copy link
Collaborator

Cube707 commented Aug 1, 2022

@staticdev this can probably also be closed

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.