gum choose doesn't display correctly
Describe the bug When running the gum choose command random parts of the selection won't display. Sometimes full lines sometimes just chunks out of a line. It still works fine, it you just can't see parts.
I am running a script with three gum choose commands, the first two are wired, the third works fine for some reason (and displays as expected)
Selection between java and rust (with java being above rust and currently selected but completely invisible)
Selection between a few Projects with only some parts being visible
These are the options being displays (and the contents of the $projects variable in the script below when selecting "rust"):
ClumsyConstructs
bevy_test
factorio_chest_calc
metaballe-rs
test_dioxus
Selection of a editor (which works flawlessly)
Script I am running the following nu-script in nushell on windows in both alacritty and windows terminal (same results).
def-env projects [projectdir = "C:/Users/username/projects"] {
# gets the (programming-) languages from the folders (and files, but there are none)
# "to text" convert its from the nu table type to plain text (which works, I tested it with print statements)
let languages = ( ls -s $projectdir | get name | to text )
# takes the languages and lets user select one (displays wiredly)
# in my case these are "java" and "rust"
let language = ( $languages | gum choose --header "Choose a language" )
# same as with languages but with the projects (also wired)
let projects = ( ls -s $"($projectdir)/($language)" | get name | to text )
let project = ( $projects | gum choose --header "Choose a project" )
# cd into directory corresponding to selection
print $"Switching to project ($language)/($project)"
cd $"($projectdir)/($language)/($project)"
# Asks for editor (displays nicely)
let editor = ( "None\nHelix\nNeovim\nVSCode\nIntellij\nRustRover" | gum choose --header "Which editor do you want to open?" )
# ... launching the selected editor in a lengthy mach statement (gum not used here)
}
Expected behavior For the choose dialogue to display correctly
Notes
- The script works completely, it only displays it wired
- The goal of the script is to let me quickly switch into one of my projects, which have the path C:/Users/[username]/projects/[language]/[name] and potentially launch an editor.
- I added the comments in the script for this, to describe the problem (idk if # is the right character)
Hey @cncptpr had the same Problem for me the Windows Line Endings were the culprit.
So I piped the result of a command first to dos2unix and then to gum choose.
Something like this:
command-with-dos-endings | dos2unix | gum choose --header "Test"
Maybe it helps