ishell icon indicating copy to clipboard operation
ishell copied to clipboard

Windows Multiplechoice doesn't work

Open keith6014 opened this issue 8 years ago • 2 comments

Using master. When using Windows the multiplechoice throws an exception.

func(c *ishell.Context) {
    choice := c.MultiChoice([]string{
        "Golangers",
        "Go programmers",
        "Gophers",
        "Goers",
    }, "What are Go programmers called ?")
    if choice == 2 {
        c.Println("You got it!")
    } else {
        c.Println("Sorry, you're wrong.")
    }
},

This code will reproduce the problem

keith6014 avatar Aug 09 '17 11:08 keith6014

Maybe a solution : https://github.com/chzyer/readline/issues/132

mlgd avatar Jan 05 '18 13:01 mlgd

I was having same issue on windows and confirm that solution chzyer/readline#132 partially solves the issue ( when replacing all 0 arguments in readline.func(0) with int(os.Stdout.Fd())

So good thing is we have a working choice list on windows.

Remaining issue is that with these changes the select list gets appended on each selection. Example below is a select list with cancel && 2 options, making a couple of selections..

Project list:
 >   Cancel
   [ 1224 ]  test
Project list:
     Cancel
 > [ 1224 ]  test
Project list:
     Cancel
   [ 1224 ]  test
Project list:
     Cancel
 > [ 1224 ]  test
Project list:
     Cancel
 > [ 1224 ]  test
   [ 1217 ] more test```

Problem here is that windows terminal does not recognise the escape sequences used. I'm looking, but haven't found a decent solution for this issue.

Napche avatar Mar 30 '18 08:03 Napche