Comments (5)
@r4ndomx That observation is correct, yeah. I think I finally figured out under which circumstances this is happening: if the first background detection happens only after bubbletea has taken over control of stdin/out, the communication channel between terminal and termenv is essentially broken. You could work around this issue by manually calling lipgloss.SetHasDarkBackground(termenv.HasDarkBackground())
once before initializing your bubbletea app.
We'll clean this up and may have to refactor the API a bit here. See upcoming work in next
branch.
from lipgloss.
Same exact issue here, this issue appeared when I tried the component Help
from https://github.com/charmbracelet/bubbles
, after some investigating, I figured out that when removing lipgloss.JoinHorizontal
from this line and this line, plus removing the renderer from here, it works without freezing.
from lipgloss.
Hey @jefferai, long time no see!
termenv is querying the terminal for its current settings via control sequences on stdout, and the terminal is expected to respond by printing to stdout, which termenv reads from. There's a timeout of 5 seconds defined, after which the read
should be aborted: https://github.com/muesli/termenv/blob/master/termenv_unix.go#L112
It looks like waitForData
is reporting data to be available, but then the read
call blocks waiting for a single byte. I haven't seen that on any of my (test-) systems so far.
Could you verify whether bytes are actually slowly trickling in or if it's stuck there waiting for a response that'll never arrive?
from lipgloss.
Hi @muesli 😀
It's definitely not 5 seconds. Sometimes it's 2 or 3; often it's 10 or so; sometimes (very rarely) it's 30 or more. I don't think I've seen it completely freeze forever.
How would you want me to verify that bytes are trickling in? Just fork the lib and print debug out?
I can also see if it happens in other envs. I'm running on arm64 M1 on Monterey 12.2.1 in iTerm using zsh. I did try with bash without any difference. Stock terminal makes no difference.
from lipgloss.
After more investigating, the real cause for me was from lipgloss.AdaptiveColor
which call termenv.HasDarkBackground()
to determine the background color as @jefferai stated, replacing the adaptive color with normal color solved the issue.
from lipgloss.
Related Issues (20)
- feat: flexbox HOT 6
- RTL languages messes the layout! HOT 2
- Span entire terminal width HOT 2
- feat: Better border joining
- No colors when running the example HOT 1
- is boder bug? HOT 2
- Ghost text being left behind when using `Height` HOT 1
- Example to toggle full screen? HOT 7
- random output of ANSI escape sequences with 0.7.1 HOT 11
- Setting `BorderTop(false)` disappears entire border HOT 3
- Unexpected artifacts from lg.JoinVertical
- Renderer-level style rules
- Middle string truncation
- Background style is not rendered when wrapping other rendered styles HOT 4
- TopRight and BottomRight border not showing when rendering an empty string and no left border HOT 1
- OSC 8 (hyperlink) supports. HOT 1
- String transform method
- style.go::Render at 'Render core text' is not ansi aware when using a spaced styler HOT 1
- Text alignment logic is backwards for non-special-cases
- Overlap views 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 lipgloss.