Comments (3)
I straced the intro screen draws. I also added code to dump the output to stderr, along with an expected byte count. Here's what we see:
- first render (good):
- write(1, "\33[?1049h\33[22;0;0t\33[H\33[2J\33[39;49m"..., 1024) = 1024
- write(1, "90;0;90m\33[48;2;0;0;180m\342\224\200\33[38;2"..., 162816) = 162816
- many 8192-byte writes to stderr, concluding with a 303-byte write
- claim of 164127 bytes
- second render (truncated):
- write(1, "39;49m \33[39;49m \33[39;49m \33[39;49"..., 1024) = 1024
- write(1, "39;49m \33[39;49m \33[38;2;90;0;90m\33"..., 162816) = 162816
- many 8192-byte writes to stderr, conclusing with a 472-byte write
- claim of 164296 bytes
btw, if i remove the first render, we render PROPERLY with just about the same arguments:
- write(1, "\33[?1049h\33[22;0;0t\33[H\33[2J\33[39;49m"..., 1024) = 1024
- write(1, "90;0;90m\33[48;2;0;0;180m\342\224\200\33[38;2"..., 162816) = 162816
- many 8192-byte writes to stderr, concluding with a 472-byte write
- claim of 164296 bytes
note that we have a 1049 at the beginning, which corresponds to smcup. had that not been sent already? very odd. might need to be flushing there if we're not going to properly write it out with tputs().
from notcurses.
Also, note that the second render call appears to be missing a '\33' at the beginning. I don't think that's an strace effect, since we're showing the leading '\33' on the first lines for the successful renders. Could that be our problem?
In no case that I can see are we writing a total number of bytes equivalent to the expected number of bytes, according to write() returns.
1024 + 162816 == 163840 < 164127
1024 + 162816 == 163840 < 164296
1024 + 162816 == 163840 < 164296
I think I'm misinterpreting the buflen aspect of POSIX memstreams? This could be explained if the buflen is the allocated length, and we've got a '\0' in there which cuts the write() short...but it's not like 164127 bytes are going to get allocated (hopefully), and 164296 isn't exactly a power of two either. Hrmmm.
from notcurses.
Ahhhhhh, of course. stdout is connected to a TTY and thus line-buffered. A fflush(stdout)
here solves things. We could put it into unbuffered mode, but then we chew up more CPU time with smaller (8192b) write() calls. This fix is perfect.
We also now fflush()
following the smcup transition into alternate mode, and see that go out immediately. Everything's working better. Let's cut a motherfucking release.
from notcurses.
Related Issues (20)
- Possibility of refreshing terminfo cache? HOT 4
- Getting the new window size when receiving `NCKEY_RESIZE` HOT 1
- Resizing window causes ghost characters to remain HOT 9
- Builtin way to get "topmost plane containing coordinates"? HOT 6
- Non-user generated inputs on startup
- `ncplane_putnstr` doesn't fully respect the maximum number of bytes HOT 18
- amata_next diagnostics on startup
- input byte-limited versions of output functions HOT 6
- USAGE.md references non-existing constant `NC_FG_ALPHA_MASK` HOT 2
- Add node wrappers for node cli tools to use
- Add an option to disable the kitty background color avoidance feature
- API feels gimped, need ncplanes without parents HOT 2
- Potential memory access overflow in utf8_egc_len HOT 6
- Check for <= 0 sorta fails because of unsigned int / int mismatch HOT 4
- add support for win32-input-mode HOT 6
- ncplane_puttext causes infinite plane resizing HOT 7
- fix up problems highlighted by clang-tidy-15
- Skipping prohibited unicode instead of erroring HOT 4
- parent not updating dimension when child forces parent to grow HOT 1
- notcurses-demo run under valgrind with early exit requires ctrl+c HOT 1
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 notcurses.