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

Latest versions of packages x/ansi and x/input are incompatible #296

Open
ardnew opened this issue Dec 4, 2024 · 5 comments
Open

Latest versions of packages x/ansi and x/input are incompatible #296

ardnew opened this issue Dec 4, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@ardnew
Copy link

ardnew commented Dec 4, 2024

Describe the bug
The latest versions of input and ansi are incompatible.

Setup
Please complete the following information along with version numbers, if applicable.

  • Ubuntu 24.10, macOS 15.2
  • bash 5.2.32, zsh 5.9
  • Konsole 4:24.08.1-0ubuntu1, Alacritty 0.14.0-dev (4a7728bf)

Note: you might encounter rendering issues if your locale does not use
UTF-8 encoding. Please check your locale (locale on POSIX systems) to
see what encoding is being used by your system.

To Reproduce
Using the bubbletea example from charmbracelet/wish:

  1. Update all dependencies, e.g., go get -u, so that go.mod contains:
    • github.com/charmbracelet/x/ansi v0.5.2
    • github.com/charmbracelet/x/input v0.2.0
  2. Build the example with go build to yield the following output:
$ go build
# github.com/charmbracelet/x/input
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/da1.go:11:6: csi.Range undefined (type *ansi.CsiSequence has no field or method Range)
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/kitty.go:216:19: csi.Subparams undefined (type *ansi.CsiSequence has no field or method Subparams)
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/kitty.go:256:19: csi.Subparams undefined (type *ansi.CsiSequence has no field or method Subparams)
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/mouse.go:140:7: assignment mismatch: 1 variable but csi.Param returns 2 values
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/mouse.go:140:17: not enough arguments in call to csi.Param
	have (number)
	want (int, int)
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/mouse.go:141:7: assignment mismatch: 1 variable but csi.Param returns 2 values
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/mouse.go:141:17: not enough arguments in call to csi.Param
	have (number)
	want (int, int)
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/mouse.go:143:44: too many arguments in call to parseMouseButton
	have (int, bool)
	want (int)
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/mouse.go:143:54: not enough arguments in call to csi.Param
	have (number)
	want (int, int)
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/parse.go:176:3: invalid operation: csi.Cmd |= int(b[i]) << parser.MarkerShift (mismatched types ansi.Command and int)
/opt/go/pkg/mod/github.com/charmbracelet/x/[email protected]/parse.go:176:3: too many errors

Source Code
Use the following source code to reproduce:

https://github.com/charmbracelet/wish/tree/main/examples/bubbletea

Expected behavior
The example package should build without error.

Screenshots
N/A

Additional context
After reverting ansi back to v0.4.5, the packages build without error.

@Hellseher
Copy link

I've faced the same while packaging the project for Guix index.

starting phase `build'
github.com/charmbracelet/x/ansi/parser
github.com/rivo/uniseg
golang.org/x/sys/unix
github.com/erikgeiser/coninput
github.com/lucasb-eyer/go-colorful
github.com/xo/terminfo
github.com/charmbracelet/x/ansi
github.com/muesli/cancelreader
github.com/charmbracelet/x/input
# github.com/charmbracelet/x/input
src/github.com/charmbracelet/x/input/da1.go:11:6: csi.Range undefined (type *ansi.CsiSequence has no field or method Range)
src/github.com/charmbracelet/x/input/kitty.go:216:19: csi.Subparams undefined (type *ansi.CsiSequence has no field or method Subparams)
src/github.com/charmbracelet/x/input/kitty.go:256:19: csi.Subparams undefined (type *ansi.CsiSequence has no field or method Subparams)
src/github.com/charmbracelet/x/input/mouse.go:140:7: assignment mismatch: 1 variable but csi.Param returns 2 values
src/github.com/charmbracelet/x/input/mouse.go:140:17: not enough arguments in call to csi.Param
        have (number)
        want (int, int)
src/github.com/charmbracelet/x/input/mouse.go:141:7: assignment mismatch: 1 variable but csi.Param returns 2 values
src/github.com/charmbracelet/x/input/mouse.go:141:17: not enough arguments in call to csi.Param
        have (number)
        want (int, int)
src/github.com/charmbracelet/x/input/mouse.go:143:44: too many arguments in call to parseMouseButton
        have (int, bool)
        want (int)
src/github.com/charmbracelet/x/input/mouse.go:143:54: not enough arguments in call to csi.Param
        have (number)
        want (int, int)
src/github.com/charmbracelet/x/input/parse.go:176:3: invalid operation: csi.Cmd |= int(b[i]) << parser.MarkerShift (mismatched types ansi.Command and int)
src/github.com/charmbracelet/x/input/parse.go:176:3: too many errors
Building 'github.com/charmbracelet/x/input' failed.

It looks like this merge request introduced regression #295
May you tag fresh versions of both please?

@bashbunni bashbunni added the bug Something isn't working label Dec 5, 2024
@caarlos0
Copy link
Member

caarlos0 commented Dec 6, 2024

should be fixed by #295

@caarlos0
Copy link
Member

caarlos0 commented Dec 6, 2024

@aymanbagabas should we do releases for input and ansi?

@aymanbagabas
Copy link
Member

@ardnew @Hellseher Correct, the latest version of x/ansi introduce breaking changes. For now, use v0.4.5

@caarlos0 Yes, ansi is good for a release while input needs some work.

@caarlos0
Copy link
Member

there isn't much to to tag on ansi yet, I believe... maybe we tag both input and ansi together when they're both ready?

$ git log --oneline ansi/v0.5.2...main -- ./ansi/
1f02199 docs(ansi): fix deprecated comments
751423f feat(ansi): implement ansi.Modes type (#288)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants