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

Prompt and Menu mode fails under Tmux on MacOS #3455

Closed
minhtrietbkit opened this issue Apr 26, 2020 · 6 comments
Closed

Prompt and Menu mode fails under Tmux on MacOS #3455

minhtrietbkit opened this issue Apr 26, 2020 · 6 comments
Labels

Comments

@minhtrietbkit
Copy link

minhtrietbkit commented Apr 26, 2020

Environment

MacOS
Terminal v2.9.5 (421.2)
Tmux v 2.9a

Steps

  1. Start tmux session: tmux
  2. Start kak: kak
  3. read doc: :doc command
  4. back delete command

Outcome

image

Expected

image
(this is taken without Tmux)

@Screwtapello
Copy link
Contributor

What is $TERM set to, inside and outside of tmux?

@minhtrietbkit
Copy link
Author

minhtrietbkit commented Apr 26, 2020

it's set to xterm-256color in both cases

@Screwtapello
Copy link
Contributor

The proper $TERM for the macOS Terminal.app is nsterm-256color, and the proper $TERM for inside tmux is tmux-256color. However, many people make Terminal.app use xterm-256color or even just xterm, and make tmux use screen-256color or even just screen, because while those terminal descriptions are less appropriate, they're reasonably close and more widely available.

The weirdness in your screenshot is the kind of weirdness I would expect from having $TERM set incorrectly - things not being drawn properly, or not being erased properly, or in the wrong locations.

@minhtrietbkit
Copy link
Author

minhtrietbkit commented Apr 26, 2020

Thanks for looking into this.

I tried following changes to TERM env var.

  1. terminal: nsterm-256color
  2. tmux: xterm-256color

After this change, whenever I run clear, I got an error "terminals database is inaccessible". This happens for both outside and inside of Tmux.

@Screwtapello
Copy link
Contributor

I'm sorry, I should have explained myself more clearly.

The TERM values that best describe your terminal are (in descending order):

  • nsterm-256color
  • nsterm
  • xterm-256color
  • xterm
  • vt220

For each item in the list, try running infocmp ITEMNAME (like: infocmp nsterm-256color) directly inside Terminal. If it prints an error like:

infocmp: couldn't open terminfo file /usr/share/terminfo/n/nsterm-256color

...then your computer doesn't have that terminal description installed, and you should try the next one. If it prints a bunch of output that starts like this:

#	Reconstructed via infocmp from file: /usr/share/terminfo/n/nsterm-256color
nsterm|nsterm-256color|Apple_Terminal|AppKit Terminal.app,
	am, bce, hs, mir, msgr, npc, xenl, xon,
	colors#0x100, cols#80, it#8, lines#24, pairs#0x10000, wsl#50,
...

...then that's the TERM setting you should use.

Inside tmux, do the same test, but with a different list of terminal names:

  • tmux-256color
  • screen-256color
  • tmux
  • screen

Again, the first item on this list that doesn't produce an infocmp: couldn't open... error is the TERM value you should use inside tmux on your computer.

@minhtrietbkit
Copy link
Author

You are amazing. Thank you very much for your time and effort. I really appreciate it. This fixes my issue perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants