Use "xterm-ghostty" as the primary terminfo name. This is a hack on a
hack...we use "xterm-ghostty" to prevent vim from breaking, and when we
do this as the default we break tcell-based applications (lazygit, aerc,
etc). tcell has a bug where the primary terminfo name must be the
value of TERM. https://github.com/gdamore/tcell/pull/639 fixes the issue
but is not merged yet.
Fixes: 779186ad ("config: add term config option")
Add entries for XM and xm, these tell certain applications how to enable
mouse and the format of response they will receive.
Fix 'kmous' entry to match standard terminfo files.
Any row created from scrolling via IND ("\x1BD") should have it's
background set as the current background. This can be verified in any
terminal with
$ echo -e "\x1B[41m" && cat -v"
Followed by pressing enter to scroll the screen. We expect to see red
rows appear. Add test case to verify.
Fixes: alacritty/vim_large_screen_scroll
Instead of checking if a locale is valid, let's change this logic:
1. We first try setlocale to inherit from env vars, system default.
2. Next, we fall back to unsetting LANG if it was set manually,
allowing us to fall back to system defaults.
3. We fall back to en_US.UTF-8.
Add a configuration key for the TERM environment variable. Default this
to "ghostty". Most TEs are using their name as the default TERM value.
Most modern termulators aren't even providing "xterm-" as an alias
anymore, after some drama between kitty / ncurses.
Notably, this also has issues for tcell-based applications (I've
submitted a PR to tcell to fix) because it fails if the TERM value
doesn't match the _primary_ name of the terminal in the terminfo file.
Providing a config option allows users to modify-with-persistence if
they have issues, but Ghostty should be known as Ghostty by default!
When scrolling up or deleting lines (effectively the same operation),
the inserted lines should only inherit the bg attribute of the cursor.
This behavior is similar to erase display and erase line. Update tests
to reflect this behavior.
The XTVERSION response should use a string terminator instead of a bell.
Most terminals can handle the bell, however specifically tmux does not
like it.
Fixes: #534