Mosh: Clear Scrollback (Mac OS X client, Gentoo Server) Display Issue

Created on 17 Apr 2012  路  8Comments  路  Source: mobile-shell/mosh

I am trying out mosh for the first time today and I tend to habitually clear the scrollback in my terminal. I've noticed that if I clear the scrollback and then issue a command, such as find ./, mosh will garble the results.

For example:

./.gemrc
./.bash_aliases
./.bashrc
./.Xauthority
./.bash_logout
./.bash_history
./.bzr.log
./.lesshst
./.key
./.bash_profile
./.systemtap
./.systemtap/cache
root@server:~ # 

Pressing command+k (clear scrollback in OS X terminal.app) and typing find ./ again results in the following output:

   gemrc
   bash_aliases
   bashrc
   Xauthority
   bash_logout
   bash_history
   bzr.log
   l sshst
   key
  .bash_profile
   systemtap
./.systemtap/cache
root@server:~ # 

The behaviour isn't even entirely predicable, as if I do it again for a 3rd, time, I get the following output:

roogemrc
  .bash_aliases
  .bashrc
   Xauthority
   bash_logout
./.bash_history
./.bzr.log
./.lesshst
./.key
./.bash_profile
./.systemtap
./.systemtap/cache
root@server:~ # 

I am using mosh from ports on OS X and the server is using mosh from Gentoo portage.

bug

All 8 comments

Thanks, we will fix this and provide good scrollback when we fix #2 (probably in mosh 1.3).

For now, the solution is to run screen or tmux on the server side, or use a pager like less to capture command output. The're a compromise here between skipping frames for speedy terminal support and wanting to have everything sent to the local terminal, and mosh picks a particular (not necessarily perfect) point on that spectrum.

Actually, I tested running screen on the server side and this issue persists. =(

It isn't so much as being able to go through the scrollback, but when one decides to clear the screen using command+k.

I don't think this is necessarily a mosh issue. Clearing the screen using Command+K is an apple-specific addition, and destroys the contents of the terminal without communicating to the software running in the terminal that it has done so, by way of escape sequence. Control-L is accepted by most shells for clearing the screen in a proper terminal-compatible manner.

Ah, yes, DHowett is right that this is two separate issues. screen will give you a scrollback buffer that you can access with Ctrl-A ESC (PgUp/PgDown/arrow keys). (We are working to make awesome client-side scrollback in mosh but it won't be until 1.3 at the earliest.)

Command-K scribbles on the contents of the screen without telling the application; no fullscreen app will deal gracefully with this (whether we're talking about emacs, screen, pine, mosh, etc.). Control-L will repaint the screen from scratch in any of those programs, including mosh.

Closing as unfortunately unfixable. (Unless you type Control-L.)

Would there be a way to disable this full-screen behavior of mosh? I really like its IP address independence, but I do not really care about transfer optimizations when I am moving from WiFi hotspot to WiFi hotspot - I have enough bandwidth to simply transmit everything, I just do not like session loses. So similar to local echo, could also this be disabled?

If you are using iTerm2 you can bind cmd_k to send HEX code 0x0C => http://cl.teamon.eu/1j381r0k431i0L0j0H3U/Screen%20Shot%202012-05-18%20at%2013.46.09.png

After reading this thread, my solution was to use KeyRemap4MacBook to remap command-k to control-l in the Terminal.

Here's a gist of the XML I added to support this.

https://gist.github.com/keithws/7648530

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jiyinyiyong picture jiyinyiyong  路  7Comments

a-b picture a-b  路  6Comments

shibumi picture shibumi  路  5Comments

earlchew picture earlchew  路  5Comments

Shoozza picture Shoozza  路  7Comments