Giter Club home page Giter Club logo

Comments (7)

SebastienBoisard avatar SebastienBoisard commented on May 22, 2024 1

Great! 😄

Thanks a lot for your help.

from go-prompt.

c-bata avatar c-bata commented on May 22, 2024

Thanks.
I'm currently investigating.

from go-prompt.

SebastienBoisard avatar SebastienBoisard commented on May 22, 2024

There might be some errors in yours key definitions (i.e. asciiSequences).

For example, here : https://github.com/c-bata/go-prompt/blob/master/vt100_input.go#L146

	{Key: End, ASCIICode: []byte{0x1b, 0x5b, 0x70}},
	{Key: End, ASCIICode: []byte{0x1b, 0x4f, 0x70}},

If you replace 0x70 by 0x46, it works for the 'End' key.

I replaced 0x05 by 0x35, and 0x06 by 0x36 for PageUp and PageDown, and it works:

	{Key: PageUp, ASCIICode: []byte{0x1b, 0x5b, 0x35, 0x7e}},
	{Key: PageDown, ASCIICode: []byte{0x1b, 0x5b, 0x36, 0x7e}},

from go-prompt.

c-bata avatar c-bata commented on May 22, 2024

Hi, @SebastienBoisard!
These definition of ascii sequences is migrated from python-prompt-toolkit like:

https://github.com/jonathanslenders/python-prompt-toolkit/blob/4476b3c28add85c5a8169fbb81ded8c3b845e588/prompt_toolkit/terminal/vt100_input.py#L92-L93

End key is properly migrated from python-prompt-toolkit.

But as you said, the ascii sequences of PageUp and PageDown seems to be wrong.
The ascii sequence of 5 is 0x35 and also 6 is 0x36.

https://github.com/jonathanslenders/python-prompt-toolkit/blob/4476b3c28add85c5a8169fbb81ded8c3b845e588/prompt_toolkit/terminal/vt100_input.py#L99-L100

I'll fix. Thanks!

from go-prompt.

c-bata avatar c-bata commented on May 22, 2024

This issue is fixed on current master branch.

go-prompt/vt100_input.go

Lines 155 to 156 in 43889dc

{Key: PageUp, ASCIICode: []byte{0x1b, 0x5b, 0x35, 0x7e}},
{Key: PageDown, ASCIICode: []byte{0x1b, 0x5b, 0x36, 0x7e}},

I'll close this. Thanks!!

from go-prompt.

SebastienBoisard avatar SebastienBoisard commented on May 22, 2024

Hi @c-bata,

From the python-prompt-toolkit, you have this:

    '\x1b[H': Keys.Home,
    '\x1bOH': Keys.Home,
    '\x1b[F': Keys.End,
    '\x1bOF': Keys.End,

and you migrated these keys in Go with:

	{Key: Home, ASCIICode: []byte{0x1b, 0x5b, 0x48}},
	{Key: Home, ASCIICode: []byte{0x1b, 0x4f, 0x48}},
	{Key: End, ASCIICode: []byte{0x1b, 0x5b, 0x70}},
	{Key: End, ASCIICode: []byte{0x1b, 0x4f, 0x70}},

The last value for the 'Home' key is 'H' in Python which you properly translated to 0x48.
But the last value for the 'End' key is 'F' in Python which is not 0x70 but 0x46.

So, I'm pretty sure that the correct code for the 'End' key is this one: 😉

	{Key: End, ASCIICode: []byte{0x1b, 0x5b, 0x46}},
	{Key: End, ASCIICode: []byte{0x1b, 0x4f, 0x46}},

Thanks for your help.

from go-prompt.

c-bata avatar c-bata commented on May 22, 2024

Oh I missed 😫
I fixed this at 76a3a21

2017-09-17 18 43 20

Thanks!

from go-prompt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.