Comments (7)
Tintin is expecting the raw key codes in the input stream.
I don't have a firm understanding of PTYs, tintin just does what most console applications do.
from tintin.
Hiyas, sounds cool. Have you checked out WebTin? https://github.com/scandum/webtin
You should be able to bind a-typical up and down sequences with a macro, or define them in tables.c in the cursor_table[] table.
Or is the problem more systematic? If it's just a few keys, I might be able to add them to the defaults.
If you publish your work on github I'd be happy to link to it from the link page on the website.
from tintin.
I did see WebTin! Looks neat. I was hoping to do something purely on web to better support multiple users.
It might be more systematic because no control sequences are being handled.
Is Tintin expecting the raw keycodes instead of control sequences? Does Tintin not need a PTY?
Thanks!
from tintin.
tl;dr -- I figured it out. Feel free to ignore the rest of this comment.
Thanks so much for helping. I see now that tintin is flipping a bunch of terminal flags off in terminal.c.
Changing the integration a bit, I've got up/down close to working. If I hit Up, Enter, it will execute the previous command. However, it doesn't write the command to the terminal after hitting Up
. However, if I hit up a few more times, it will eventually write the command. However, when I hit enter on it, it's not that command.
It's almost like two different lists are being used. One to draw previous command and one to execute and the one that's used to draw has a bunch of empty lines in it.
Thanks again for the help!
Edit: If I go up a few and then start using the down arrow, the down arrow works as expected. I noticed in the code, cursor_down
unconditionally redraws, while up
doesn't. Maybe that's related?
Edit 2: Also, noticing left/right cursor position isn't lining up. I'll keep digging.
Edit 3: With the left/right cursor, it seems like the view is always one keystroke behind. For example:
Type L
- NothingType L
- Move LeftType R
- Move Left (executing 2)Type R
- Move Right (executing 3)
Edit 4: I figured out that the reason the view wasn't updating was because the command wasn't actually executing until I queued up another read. I figured this out because clicking out of the terminal (sending a \e[O
control sequence) as triggering it. If send this sequence after every read, it fixes the problem, but that doesn't seem right. I'd love to know if you have any insight here, but at least I'm unblocked.
Edit 5: I figured out my problem. My implementation of ___syscall__newselect
was buggy. It was assuming that my buffer would be flushed all at once. However, tintin is only reading one character at a time. This means select
would start marking things as not ready, even when there was data waiting to be read in emscripten's internal buffer. This is why sending a control character fixed it (really any character fixes it, but control character was a noop). Fixing my select implementation resolved the problem.
from tintin.
@scandum I needed a few patches to get things working. Would you be willing to merge a few emscripten specific #ifdef
to avoid needing to maintain them independently?
I'll open a PR when I get a chance, but in the meantime, a summary of the changes:
- Break out the bulk of
mainloop
into aloop_once
function thatmainloop
calls. - Add an
#ifdef
to loop withemscripten_set_main_loop
instead ofwhile
. This yields to the JavaScript event loop between loops instead of a blocking sleep. #ifndef
to disable a fewsetsockopt
that can't be supported in a browser.
Cheers!
from tintin.
That shouldn't be a problem if it doesn't get too weird.
from tintin.
I don't think I ever saw that PR? I'll close this for now, let me know how things went. :)
from tintin.
Related Issues (20)
- Seg fault with math HOT 2
- should we put ; at the end of #case? HOT 4
- Question -- disable color HOT 2
- Request a new event to be notified that the #function is missing HOT 1
- `\x00` cannot be sent via the `#send` command when `#config charset GBK1TOUTF8` HOT 5
- When a undefined class is killed,The event "CLASS CREATED" would trigged HOT 4
- when delete the only one step in path mapping, tintin crashed HOT 2
- Request a method to get the name of the #class that is currently open. HOT 2
- about #draw and #button HOT 2
- #PORT init issue - gethostbyname error 0 HOT 3
- [REQUEST] Is it possible to add i18n support to TinTin++? HOT 1
- backslashes have strange behavior when used as a key in table HOT 4
- Turning on COLOR PATCH and RECEIVED OUTPUT will cause the entire game to lose any color HOT 2
- You can't trig a action "out of range" that created by a locally variable HOT 3
- Update BSD section in install guide HOT 2
- HAVE_GNUTLS_H is defined to empty string HOT 1
- regex looks like it has a bug about grouping but not capturing HOT 3
- BUG: the return value of utf8_to_gbk1 seems incorrect HOT 3
- #draw tile gives an error when drawing { HOT 2
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 tintin.