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

gum input - missing cursor when running in container images (since v0.10.0) #391

Closed
ThomasBuchinger opened this issue Jul 7, 2023 · 9 comments
Labels
blocked blocked by some other issue and/or pr bug Something isn't working cmd/input

Comments

@ThomasBuchinger
Copy link

ThomasBuchinger commented Jul 7, 2023

Describe the bug
I am writing a script that uses gum input --value "default-value". The default value must be edited by the user.

The problem is, that there is no cursor on screen, making it hard to know where the cursor is exactly. The cursor still exists and it can be moved by pressing the arrow keys and counting the number of characters, but there is no on screen indication for the current cursor position

  • The bug only exists when running inside a container image (tested on ubuntu:22.04 and charmcli/gum:v0.10.0)
  • Running gum v0.10.0 without a container works
  • Using the older charmcli/gum:v0.9.0 image works
  • The bug seems to still exists on main-branch. Tested with docker.io/golang image and go install github.com/charmbracelet/gum@main

To Reproduce

# Produces the bug
podman run -it --rm  docker.io/charmcli/gum:v0.10.0 input

gum_cursorbug_v0 10 0

# Produces the bug
podman run -it --rm docker.io/golang
go install github.com/charmbracelet/gum@main
gum input

gum_cursorbug_main

# v0.9.0 image works
podman run -it --rm  docker.io/charmcli/gum:v0.9.0 input

gum cursorbug_v0 9 0

# The native binary works
$ ./gum --version
gum version v0.10.0 (0f0f8e9)
$ ./gum input                     

gum_cursorbug_native

Expected behavior
There should be a blinking box, showing the current position of the cursor

Desktop (please complete the following information):

  • Fedora37, podman 4.5.0
  • RHEL 8.4, podman 4.4.3

Additional context
I don't really have access to a different Linux distro or container runtime at the moment. If there are any additional setting I can try, let me know

@xabru
Copy link

xabru commented Sep 2, 2023

It looks like you're trying to run gum in a non-interactive environment.

@caarlos0
Copy link
Member

yes, the -i in podman run should have set it interactive... seems like it didn't? is this still happening?

@caarlos0 caarlos0 added bug Something isn't working cmd/input labels Nov 18, 2024
@caarlos0
Copy link
Member

fwiw, could repro this with main on docker as well:

CleanShot 2024-12-10 at 15 30 37@2x

@caarlos0
Copy link
Member

I think its because it reports TERM as xterm, which isn't pick up as supporting colors by termenv.

For now you can workaround by setting COLORTERM, CLICOLOR_FORCE, or changing TERM to something else (like xterm-256color)

CleanShot 2024-12-10 at 15 36 00@2x

cc/ @aymanbagabas do you know if this works the same way in lipgloss v2?

@aymanbagabas
Copy link
Member

cc/ @aymanbagabas do you know if this works the same way in lipgloss v2?

Good point! It would produce the same results in v2. This is related to colorprofile. TERM=xterm should return a ANSI color profile

@aymanbagabas
Copy link
Member

@caarlos0 I've opened charmbracelet/colorprofile#22 to resolve this issue in v2

@caarlos0
Copy link
Member

thanks @aymanbagabas!

@caarlos0 caarlos0 added the blocked blocked by some other issue and/or pr label Dec 11, 2024
@caarlos0
Copy link
Member

see muesli/termenv#174

@caarlos0
Copy link
Member

fixed on main
CleanShot 2024-12-11 at 10 19 00@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked blocked by some other issue and/or pr bug Something isn't working cmd/input
Projects
None yet
Development

No branches or pull requests

4 participants