plutov / ultrafocus

CLI tool to block distracting websites and boost productivity.
MIT License
136 stars 8 forks source link

v0.1.5 freezed when enter blacklist #3

Closed Kunniii closed 4 months ago

Kunniii commented 4 months ago

When i select > blacklist the app freeze for a few seconds (3 to 10 secs). After that, it shows the list of domains with the last entry ending with a color code.

image

plutov commented 4 months ago

Hey @Kunniii that happens to me as well from time to time, but no always. It's something related to the textarea, as you can see there are keystrokes at the end of it. I tried by using .Blur() by default not to receive keystrokes but that didn't help.

Will try to fix that, still quite new to bubbletea.

plutov commented 4 months ago

@Kunniii have you or anyone you know worked with bubbletea? This bug kills me, sometimes it works as expected, sometimes it freezes...

Kunniii commented 4 months ago

@plutov Yes, i would love to contribute. Let me try to fix this bug as well!

plutov commented 4 months ago

@Kunniii btw what terminal are you using ?

Kunniii commented 4 months ago

It's Alacritty

plutov commented 4 months ago

I am using oh-my-zsh and warp.dev

plutov commented 4 months ago

This issue is strange, sometimes it works, sometimes it hangs.

plutov commented 4 months ago
Screenshot 2024-07-24 at 20 33 36

I end up with these weird symbols in input. Not sure where they come from.

Kunniii commented 4 months ago

I think the problem is when we load the hosts to show it on textarea. Once you write the hosts to the hosts file, the next time it loads correctly.

I'm testing it locally, and there is no hang so far.

plutov commented 4 months ago

When I comment this line it work well, but we kind of need to set the value there.

// m.textarea.SetValue(strings.Join(m.domains, "\n"))
plutov commented 4 months ago

@Kunniii I solved it by overriding the styles of textarea. I noticed that this issue is caused by libgloss.Adaptive and doesn't appear if I use constant colors. Please install the latest version and verify.

Kunniii commented 4 months ago

Great! I also noticed that the color code is from the default LibGloss style of the textare! Thanks for the fix!