@@ -84,12 +84,21 @@
8484 # No welcome banner.
8585 set -g fish_greeting
8686
87− # The container runtime hands fish a bare TERM=xterm (8 colors) and
88− # no COLORTERM, washing out colors. The bundled terminfo DB (via
89− # ncurses) has the 256-color entry, so promote xterm→xterm-256color
90− # and advertise truecolor for 24-bit-aware tools.
91− if test "$TERM" = xterm; or test -z "$TERM"
92− set -gx TERM xterm-256color
87+ # Pick a TERM whose terminfo entry actually exists in the bundled
88+ # database, so TUIs render with the right capabilities (otherwise
89+ # they glitch on redraw). The container runtime strips the host TERM
90+ # down to a bare "xterm"; `c` forwards the real value as HOST_TERM.
91+ # Ghostty reports "xterm-ghostty", but ncurses ships that entry under
92+ # the name "ghostty", so map it. Prefer HOST_TERM over the runtime's
93+ # bare "xterm" placeholder, falling back to xterm-256color.
94+ for term_candidate in $HOST_TERM $TERM xterm-256color
95+ test "$term_candidate" = xterm; and continue
96+ set -l entry $term_candidate
97+ test "$entry" = xterm-ghostty; and set entry ghostty
98+ if infocmp $entry >/dev/null 2>&1
99+ set -gx TERM $entry
100+ break
101+ end
93102 end
94103 set -q COLORTERM; or set -gx COLORTERM truecolor
95104
@@ -156,6 +165,11 @@
156165 # /etc/services. Without these, hostname resolution fails.
157166 pkgsLinux.fakeNss
158167 pkgsLinux.iana-etc
168+ # Terminfo tools (infocmp/tput/clear/reset). The terminfo DB
169+ # itself already ships via fish's ncurses dependency; this
170+ # puts the lookup tools on PATH so the prompt init can pick a
171+ # TERM entry that exists, and TUIs get correct capabilities.
172+ pkgsLinux.ncurses
159173 ];
160174 # Link all of /etc so the above files (nsswitch.conf, protocols,
161175 # services, passwd, group, ssl certs, fish prompt) are present.