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

feat!: v2 #392

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

feat!: v2 #392

wants to merge 4 commits into from

Conversation

caarlos0
Copy link
Member

No description provided.

Signed-off-by: Carlos Alexandro Becker <[email protected]>
@caarlos0 caarlos0 self-assigned this Jan 14, 2025
@tuxtlequino
Copy link

IS there a way to test this? I tried checking your go.mod and
github.com/charmbracelet/wish/v2 v2.0.0-00010101000000-000000000000
invalid version: unknown revision 000000000000

@aymanbagabas
Copy link
Member

IS there a way to test this? I tried checking your go.mod and github.com/charmbracelet/wish/v2 v2.0.0-00010101000000-000000000000 invalid version: unknown revision 000000000000

You could delete github.com/charmbracelet/wish from your go.mod file, then do go get github.com/charmbracelet/wish/v2@v2-exp to try this branch.

@tuxtlequino
Copy link

I also noticed that I needed to modify the bubbles alpha to get it to work otherwise I was getting all kinds of errors. I changed the go.mod from
github.com/charmbracelet/bubbles/v2 v2.0.0-alpha.2.0.2
to
github.com/charmbracelet/bubbles/v2 v2.0.0-alpha.2.0.20250114183437-fbe642df174c
Thank you very much for all this work. So far the main.go works. Will try the wish soon and report back.

@caarlos0
Copy link
Member Author

caarlos0 commented Jan 16, 2025

@tuxtlequino yes you'll need the entire v2 stack

for most of them you can

go get "github.com/charmbracelet/${LIB_NAME}/v2@v2-exp"

@lictw
Copy link

lictw commented Feb 7, 2025

I have touched v2 stack with non-example program. Besides a number of changes, everything has started up and is working fine.

But and besides wish:

  1. 80% of ssh connects end with nothing while terminal window will not be resized.
  2. I have some rendering artifacts, which don't exist without wish.
    image
    image

Colors works fine even when wish starts in a container, TERM of client controlls them fully!

PS The terminal is kitty if it can matter.

@lictw
Copy link

lictw commented Feb 7, 2025

@caarlos0 FYI

@aymanbagabas
Copy link
Member

I have touched v2 stack with non-example program. Besides a number of changes, everything has started up and is working fine.

But and besides wish:

  1. 80% of ssh connects end with nothing while terminal window will not be resized.
  2. I have some rendering artifacts, which don't exist without wish.

Could you try the latest Wish v2-exp?
go get "github.com/charmbracelet/wish/v2@v2-exp" then test your program

@lictw
Copy link

lictw commented Feb 7, 2025

@aymanbagabas thanks for fast response!

Unfortunately no, tested with github.com/charmbracelet/wish/v2 v2.0.0-20250207160930-a95d5af3b64e (latest) and nothing changed.

@aymanbagabas
Copy link
Member

aymanbagabas commented Feb 7, 2025

Unfortunately no, tested with github.com/charmbracelet/wish/v2 v2.0.0-20250207160930-a95d5af3b64e (latest) and nothing changed.

I was able to reproduce the issue where nothing gets rendered, and it appears that we need to inform Bubble Tea with the initial PTY requested size of the terminal. This PR adds the necessary options to Bubble Tea to do so charmbracelet/bubbletea#1314

diff --git a/bubbletea/tea_unix.go b/bubbletea/tea_unix.go
index 53c48d50d1ea..86153bfba2ae 100644
--- a/bubbletea/tea_unix.go
+++ b/bubbletea/tea_unix.go
@@ -33,6 +33,7 @@ func makeOpts(s ssh.Session) []tea.ProgramOption {
 			// best we can do ;)
 			tea.WithColorProfile(colorprofile.Env(envs)),
 			tea.WithEnvironment(envs),
+			tea.WithInitialSize(pty.Window.Width, pty.Window.Height),
 		}
 	}
 
@@ -44,5 +45,6 @@ func makeOpts(s ssh.Session) []tea.ProgramOption {
 		tea.WithInput(pty.Slave),
 		tea.WithOutput(pty.Slave),
 		tea.WithEnvironment(envs),
+		tea.WithInitialSize(pty.Window.Width, pty.Window.Height),
 	}
 }

EDIT: for the rendering artifacts issue, could you provide a minimal reproducible example?

@lictw
Copy link

lictw commented Feb 7, 2025

I also tested it in the Windows terminal and glitches are there, but they are different.. Good news: there it always starts up as expected, so it can be my localhost problem, but I don't know which one it can be, cause on my Linux this problem persists even in console mode (ctrl+alt+f*), so even in most native pure ANSI terminal.
image

I also mark other places where glitches can be on reloads, so it always somewhere in the start of line, like something is being transferred to the next line, but it also have "phantom" glitches, here one } is real, it truncated from response on right side, but the second is phantom! Also it can be 222 instead of 2 items.

@lictw
Copy link

lictw commented Feb 7, 2025

I was able to reproduce the issue where nothing gets rendered, and it appears that we need to inform Bubble Tea with the initial PTY requested size of the terminal. This PR adds the necessary options to Bubble Tea to do so charmbracelet/bubbletea#1314

Uh, there are private fields, seems that waiting for merge.. I have subscribed.

About MRE, it's hard, even if I could give you this program, it's still required our private server to response something.. I will try create something, but if you come up with something faster, then be sure to response.

@lictw
Copy link

lictw commented Feb 7, 2025

@aymanbagabas do you have something with high FPS? With constants ticks of spinner for ex., so there are often Update/View cycles. Run such program and just resize it activly, and you should found artifacts, it's like currupted buffer in some frames.I reproduce it very well.

Update:
Seems not, I have test one of wish example and there are no problems at all (except initial launch), I will try add something to it while glitches willn't happen.

@lictw
Copy link

lictw commented Feb 7, 2025

@aymanbagabas Eureka, I have reporoduced it from scratch! It all cause of lipgloss.Width equals to real width, so when all lines are idially filled, fully, then some problems are happen - something is being moved to the next line for some reason..

And this really only happens when you run it through wish (https://pastebin.com/Ze5twBLv), version with direct run (https://pastebin.com/UvFhGsgt). It's examples/bubbletea/main.go from v2-exp, just run it, connect and start activly resize terminal window - you must see wrong identation of help string bellow the list, it will bounce.

@lictw
Copy link

lictw commented Feb 7, 2025

But in my program I continue see glitches even on very bare bones rendering, without any constraints and custom styles..

Screens

image
image

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

Successfully merging this pull request may close these issues.

4 participants