jroimartin / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
9.92k stars 608 forks source link

Disabling arrow keys for empty lines. #82

Closed awnumar closed 7 years ago

awnumar commented 8 years ago

When using a text editor, it's customary that using the down or right arrow keys have no effect when we're at the end of the text and there's no more characters after the cursor. The enter key is then used to insert a new line.

In an input box created with v.Editable = true, the cursor keys can be used indefinitely to create newlines (see _examples/mask.go). Since we're still pre-v1.0.0, I think this is a safe change to make.

jroimartin commented 8 years ago

This will be handled by the new edition mode. We'll close this issue after confirming that the new edition mode effectively fixes this.

Relates to: #60

awnumar commented 7 years ago

Is there any update to v0.4?

jroimartin commented 7 years ago

I've been working on other projects during the last months, but I plan to resume gocui's development soon. Sorry for this inactivity period.

awnumar commented 7 years ago

@jroimartin Not to be pushy or anything, but is there an ETA? I have a few projects that are on hold until this is fixed.

oakes commented 7 years ago

Possibly related, but I noticed (at least in the OS X terminal app) scrolling causes ASCII codes like <64;72;17M to appear. Perhaps there is a way to intercept text before it gets to the buffer, so we can prevent that from appearing?

Edit: I ended up disabling mouse events, which somewhat fixes the issue.

jroimartin commented 7 years ago

@oakes related: https://github.com/jroimartin/gocui/issues/35

oakes commented 7 years ago

@jroimartin Interesting, thanks. Is there a way to just disable mouse scrolling altogether?

jroimartin commented 7 years ago

Fixed via 75a7ad275059b14eb43b704717ef23d42b2fea4d. Could you check? :)

jroimartin commented 7 years ago

BTW you can use _examples/bufs.go to test it easier.