Skip to content
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

Investigate alternative backend #34

Closed
gyscos opened this issue Jun 28, 2016 · 24 comments
Closed

Investigate alternative backend #34

gyscos opened this issue Jun 28, 2016 · 24 comments

Comments

@gyscos
Copy link
Owner

gyscos commented Jun 28, 2016

Ncurses is nice, but is pretty much terrible.

Intersting alternatives currently include rustty and termion.

First step would be to remove references to ncurses types from the public API (there's not a lot left).

@ticki
Copy link

ticki commented Jun 28, 2016

Author of Termion here. You said right here, that it lacked of certain features, and I'd be happy to implement those. Could you give me a list of what you need?

@gyscos
Copy link
Owner Author

gyscos commented Jun 29, 2016

The exhaustiveness of input detection was really the main one I was thinking about, but maybe it's not a problem - I'll start working a bit on the port to see how it goes.

@ticki
Copy link

ticki commented Jun 29, 2016

Feel free to ping me as you encounter issues.

@gyscos
Copy link
Owner Author

gyscos commented Jul 1, 2016

All ncurses-specific code has now been isolated in a Backend trait, making its replacement easier.

Currently missing from Termion to achieve feature parity:

  • Check if the current terminal support colors (for easy fallback on linux console)
  • No function to redefine the default 216 colors palette (they should be able to accept any 24bit color).

@ticki
Copy link

ticki commented Jul 1, 2016

Thanks! I'll add those.

@gyscos
Copy link
Owner Author

gyscos commented Jul 1, 2016

Also:

  • A timeout-able event polling (like the one from rustty) to read for events without blocking entirely.
    • AsyncReader only gives a Read interface, it doesn't output Keys.
  • (Less critical) A way to directly create a Color from its ansi code (especially if the palette is not the default one).

@ticki
Copy link

ticki commented Jul 2, 2016

AsyncReader only gives a Read interface, it doesn't output Keys.

It does! Read gives you TermRead for free.

@gyscos
Copy link
Owner Author

gyscos commented Jul 3, 2016

Oh - I think I've been reading an outdated doc for some time.
Too bad keys is only for nightly though - I'll wait a bit to see how the stabilization goes.

@ticki
Copy link

ticki commented Jul 3, 2016

Yeah, keys requires nightly for now. I believe char will be stabilized in only a few weeks.

@ticki
Copy link

ticki commented Jul 16, 2016

No function to redefine the default 216 colors palette (they should be able to accept any 24bit color).

You cannot exactly redefine it, but a way to use truecolor will certainly be interesting. I will add that one of the days.

A timeout-able event polling (like the one from rustty) to read for events without blocking entirely.

There is a RFC adding timeout recv to mpsc. This can be added whenever that RFC is merged.

(Less critical) A way to directly create a Color from its ansi code (especially if the palette is not the default one).

This is added. http://ticki.github.io/termion/color/struct.AnsiValue.html

cc. myself @ticki

@ticki
Copy link

ticki commented Oct 6, 2016

You mentioned this in the reddit thread. Is there anything new? I've added truecolor. Is there anything else that you need to complete this?

@gyscos
Copy link
Owner Author

gyscos commented Oct 6, 2016

#59 was blocking this, now that it's closed I'll start experimenting again on a termion backend.
The only detail I see will be a regression in supported input, as it seems termion only supports modifiers for characters, not for special keys (ctrl-shift-left, alt-F3, etc.).

@ticki
Copy link

ticki commented Oct 6, 2016

Special keys are much harder to have identifiers for. There's no standard for those, and I'm not sure exactly if it's even possible...

@gyscos
Copy link
Owner Author

gyscos commented Oct 6, 2016

Ncurses somehow manages to get it, at least on most terminal emulators (actual TTYs seem more limited) - examples/key_codes.rs can detect a wide range of modifiers on most common terminals.
The problem is that termion discards unrecognized bytes as errors, which means the application does not have a chance to do its own (non-universal) parsing.

@ticki
Copy link

ticki commented Oct 6, 2016

The problem is that termion discards unrecognized bytes as errors, which means the application does not have a chance to do its own (non-universal) parsing.

That's a good pont...

@gyscos
Copy link
Owner Author

gyscos commented Oct 9, 2016

ad7606c adds an initial termion backend.
It is in a very early state and is currently very far from being usable, as it lacks input, colors, and probably many other things.

@ticki
Copy link

ticki commented Oct 9, 2016

@gyscos It seems that you forgot to commit a file (termion.rs)?

@gyscos
Copy link
Owner Author

gyscos commented Oct 9, 2016

It is present: https://github.com/gyscos/Cursive/blob/master/src/backend/termion.rs

To use the termion backend, you need to use the termion feature and remove the default features.

@ticki
Copy link

ticki commented Oct 9, 2016

ah

@gyscos
Copy link
Owner Author

gyscos commented Nov 25, 2016

Alternative backends have been investigated.
Termion support is still incomplete, but the bare minimum works. Specific issues will get their own tickets.

@gyscos gyscos closed this as completed Nov 25, 2016
@ticki
Copy link

ticki commented Nov 25, 2016

Cool!

@ticki
Copy link

ticki commented Dec 4, 2016

Could you open said issues or list them here? I'm interested in helping if I can (this library is nice, and it'd be cool to have e.g. Redox support, which Termion provides).

@Ameobea
Copy link
Contributor

Ameobea commented Dec 25, 2016

@ticki I'm using Termion as a backend for my application and it's been working perfectly so far. Thanks for your hard work making this compatible and on Termion in general!

@ticki
Copy link

ticki commented Dec 25, 2016

@Ameobea To be fair, @gyscos has helped a lot as well!

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

No branches or pull requests

3 participants