Comments (7)
Great! 😄
Thanks a lot for your help.
from go-prompt.
Thanks.
I'm currently investigating.
from go-prompt.
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.
Hi, @SebastienBoisard!
These definition of ascii sequences is migrated from python-prompt-toolkit like:
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
.
I'll fix. Thanks!
from go-prompt.
This issue is fixed on current master branch.
Lines 155 to 156 in 43889dc
I'll close this. Thanks!!
from go-prompt.
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.
Oh I missed 😫
I fixed this at 76a3a21
Thanks!
from go-prompt.
Related Issues (20)
- [Feature Request] Example for Simple Yes/No/Quit question?
- Update README: `aws-sso` uses go-prompt
- [Feature Request] Option to escape special characters or quote strings containing special characters
- [Feature Request] MacOS keyboard support is not complete
- Sorry for the delayed response. I've just pushed v0.2.6 tag.
- [Feature Request] Need a way to terminate unresponsive executors HOT 1
- [Bug]Strange bug when using `fmt.Scanln` after upgrade to v0.2.6 HOT 1
- [Bug] `prompt.Input` leaks file descriptor of "/dev/tty"
- [Question] Force prompt.Input() redraw during goroutine
- Allow specifiying arbitrary io.ReadWriters to read input and write output to (including escape codes)
- [Bug] Unexpected behavior of log output HOT 1
- How to customize suggestion rendering?
- [Bug] Terminal Colors not reset after application exists HOT 2
- [Bug] In the v0.2.6 , the icnl attribute of the stty is modified, but the attribute is not restored. v0.2.5 is ok HOT 5
- A CI/CD Observability Solution Suggestion
- Project FireQL using go-prompt HOT 1
- GPT cli An interactive ChatGPT client featuring shortcuts and auto-complete - thanks to go-prompt
- [Feature Request]
- [Feature Request] Allow for TTYs other than STDIN
- [Bug] panic: runtime error: integer divide by zero
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-prompt.