Comments (5)
The PR #56 makes the KeyESC binding work correctly.
from gocui.
Hi @phf,
On one hand, I hardcoded it to avoid adding "tricky" options to the gocui's API, making it simple for the users.
On the other hand, I chose inputMode := termbox.InputAlt
because I think it's more "compatible". From the termbox-go documentation:
1. Esc input mode. When ESC sequence is in the buffer and it doesn't
match any known sequence. ESC means KeyEsc. This is the default input
mode.
2. Alt input mode. When ESC sequence is in the buffer and it doesn't
match any known sequence. ESC enables ModAlt modifier for the next
keyboard event.
I always remember having troubles, depending on the terminal emulator, to make the ALT/META key works. So, you ended up using 'ESC+' or mapping ALT/META to 'ESC+'. The same happens in OSX and, for instance, iTerm2 recommends:
So, for example, when you press "ALT+2", it will send ESC+2. To bind this combination in gocui, you can use:
if err := g.SetKeybinding("someView", '2', gocui.ModAlt, someFunc); err != nil {
return err
}
Because it uses termbox.InputAlt
by default. And, this is the rationale to take this decision.
from gocui.
I'm trying to create an editor interface similar to vim with a normal mode and an insert mode. It feels like it should be easy to do this, but when I bind j in ModAlt mode I have to press Esc every time. What am I missing?
if err := g.SetKeybinding("main", 'j', gocui.ModAlt, cursorDown); err != nil {
return err
}
from gocui.
@micronix please take a look at my previous comment. There you have the explanation and solution to that.
from gocui.
Closed due to inactivity.
from gocui.
Related Issues (20)
- Wrong layout when Title uses a different encoding HOT 1
- True color support ? HOT 2
- Keybindings not working on FreeBSD HOT 3
- Examples does not support east asian windows? HOT 1
- Can you support run jar packet? HOT 1
- force update HOT 6
- Add a project that using gocui HOT 1
- Update Screenshot Example HOT 1
- Start printing at cursor position
- Add lazygit to the list of projects HOT 1
- Better tags support HOT 2
- how to read input
- Support ANSI code for hyperlinks
- Add Omnivore to projects list.
- Lazydocker is not listed HOT 2
- Extended ANSI color codes are not supported
- Is the library still actively maintained?
- Chinese Support HOT 2
- KeyBinding For Mouse(Any of them) dosn't trigger HOT 2
- git-bug relies on gocui
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 gocui.