blinksh / blink

Blink Mobile Shell for iOS (Mosh based)
https://blink.sh
GNU General Public License v3.0
6.15k stars 573 forks source link

Mosh rendering issue with ZSH autocomplete #618

Open Shafkat opened 5 years ago

Shafkat commented 5 years ago

img_0002

The host I'm connected to has zsh autocomplete enabled. I'm seeing these artifacts when I use mosh on the blink beta app. I don't see this issue over ssh.

NightMachinery commented 5 years ago

I use mosh with zsh autocomplete, too, but I have seen no issues. Try chnaging your theme to the default one?

treyharris commented 5 years ago

Since you're using box-drawing characters in your prompt, you very likely have a mismatch between mosh's and hterm's UTF-8 column-counting algorithms, which tend to crop up with colored higher-numbered characters (like black and blue triangles).

This is a problem endemic to terminals for which there's no settled solution, but if you use a recent version of Tmux, these artifacts should go away. Tmux and Mosh use the same column-counting algorithm, and Tmux normalizes the output so that hterm will display it as expected.

If the artifact does not go away under Tmux, there may be an issue Blink can be altered to fix, but if it does go away, this is probably something that can't be fixed without breaking the color-handling of users for whom it currently works.

(Although, if you want to work at it, you can find workarounds that use escape codes in your prompts to normalize the output, I'll warn you from experience: they are a pain to maintain.)

Just in case...

If you're not familiar with Tmux or other similar session terminal emulators like GNU screen¹, I would suggest simply running tmux — by itself, it will give you a shell (perhaps after hitting the first time you run it to get past a splash screen? I don't recall). You can then see if the artifact above has gone away. (A warning: tmux by default uses the key ⌃B to prefix its own commands; avoid using it during your test, or, if you must, press it twice.)

You can then exit tmux simply by exiting the shell normally. If that fixed the artifact, I'd suggest taking up one of the excellent Tmux tutorials and just solving your problem that way—there's little reason not to use Tmux in most cases (only if you primarily logged into very space-constrained containers would I think adding Tmux and its dependencies would be any issue—it uses very few resources when idle).

— ¹ Which, I should warn you, is not consistent—even with itself between versions of GNU screen—in its colored-grapheme handling, so you shouldn't use it for this testing.