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

New input element #129

Open
wants to merge 6 commits into
base: master
from

Conversation

Projects
None yet
7 participants
@sapessi

sapessi commented Mar 7, 2017

Still missing lots of unit tests :( I'll keep working on them

@sapessi sapessi referenced this pull request Mar 7, 2017

Open

Feature Request : EditBox #34

@meetmangukiya

This comment has been minimized.

meetmangukiya commented Apr 28, 2017

@sapessi does this work? Then I'll use your fork as the dep unless this is merged :D

@sapessi

This comment has been minimized.

sapessi commented Apr 28, 2017

@meetmangukiya It does work, although I have tested all of the use-cases. Have a go and see if it works for you. If you find an issue let me know.

@meetmangukiya

This comment has been minimized.

meetmangukiya commented Apr 28, 2017

Ok, I'll have a go at it

@sapessi

This comment has been minimized.

sapessi commented May 5, 2017

@meetmangukiya Did this work for you?

@liushuchun

This comment has been minimized.

liushuchun commented May 8, 2017

hi,body,I have tried this method.but when I input the Chinese words,it will be in the wrong sequence.
image

@sapessi

This comment has been minimized.

sapessi commented May 8, 2017

@liushuchun Do you expect it to be right to left or also vertical? This is definitely something that can be added.

@pradeepto

This comment has been minimized.

pradeepto commented Jun 11, 2017

@sapessi Great stuff. Would love to see this merged. What is blocking it?

@Griesbacher

This comment has been minimized.

Griesbacher commented Jul 14, 2017

@sapessi Thanks for the PR. If found a little bug within your PR, this the code I've tested:

input := ui.NewInput("FOO BAR", false)
input.StartCapture()

On startup just press backspace when the courser is on the first position.
Which results in such a panic:

panic: runtime error: index out of range

goroutine 1 [running]:
github.com/gizak/termui.(*Input).backspace(0xc4200fa000)
    /root/dev/go/src/github.com/gizak/termui/input.go:179 +0x2c7
github.com/gizak/termui.(*Input).StartCapture.func1(0x52f564, 0x8, 0xc4202e8bc4, 0xc, 0x52f2e8, 0x7, 0x0, 0x0, 0x50ca40, 0xc4202e8bd0, ...)
    /root/dev/go/src/github.com/gizak/termui/input.go:115 +0x5a1
github.com/gizak/termui.(*EvtStream).Loop.func1(0xc420046500, 0x52f564, 0x8, 0xc4202e8bc4, 0xc, 0x52f2e8, 0x7, 0x0, 0x0, 0x50ca40, ...)
    /root/dev/go/src/github.com/gizak/termui/events.go:251 +0xff
github.com/gizak/termui.(*EvtStream).Loop(0xc420046500)
    /root/dev/go/src/github.com/gizak/termui/events.go:253 +0x157
github.com/gizak/termui.Loop()
    /root/dev/go/src/github.com/gizak/termui/events.go:282 +0x2d
main.main()
...

If no string has been passed to the constructor everything works fine. I'm not sure if I did something wrong with the initialisation.

Edit:
This happens also if an empty string has been passed and the first key pressed is a backspace.

Edit 2:
If the arrow keys are pressed first also a out of bound error raises, in line 311 or 125 depending on the key pressed.

@sapessi

This comment has been minimized.

sapessi commented Jul 14, 2017

@Griesbacher could be a bug, I'll look into it this weekend.

@sapessi

This comment has been minimized.

sapessi commented Jul 18, 2017

@Griesbacher fixed those issues and added unit tests for them in the latest commit.

@stephencheng

This comment has been minimized.

stephencheng commented Dec 14, 2017

what's preventing this to be merged? can we get this one going into master?

stephencheng added a commit to stephencheng/termui that referenced this pull request Dec 14, 2017

@sapessi

This comment has been minimized.

sapessi commented Dec 18, 2017

@gizak Should we close this pull request now that you've imported the input in a commit?

@pjebs

This comment has been minimized.

pjebs commented Jan 2, 2018

@sapessi which commit?

@sapessi

This comment has been minimized.

sapessi commented Jan 9, 2018

Never mind, I confused the pull to another repo for this. @gizak, any idea whether this will be merged?

@cjbassi cjbassi force-pushed the gizak:master branch from 8836c63 to fede2b0 Sep 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment