Missing the first character of a line on full screen apps on Linux server ssh'ed from OS X Terminal

5

0

enter image description hereI am having problems with the Terminal application on Mac OS X Snow Leopard.

I use ssh to connect to a remote Linux server and perform configuration file editing.

For some reason, it sometimes misses characters when it's connected to the Linux server. I have had problems pinpointing this and making it happen in a repeatable manner - unfortunately this is the best method I have come up with it:

  1. Connect to Ubuntu 8.04 server

  2. Edit some text file with nano (full screen app)

  3. The first line of the text file is missing the first character of the line (the leftmost character). E.g. if the text file contains line "asdf" you'll see "sdf".

  4. If you move the cursor to this position the character will be back there (the line is redrawn by nano)

  5. Resizing the Terminal app window does not bring back any characters

  6. If you hit refresh (CTRL+L) in nano the characters will be lost again

The same problem can be observed with less and some other terminal apps.

The problem is not repeatable with the Gnome terminal or other terminal application, so it cannot be related to the server configuration. However, I have the same problem on two different OS X installations, so it might be linked to my default settings.

I suspect this might be related to UTF-8 encoding or Terminal settings somehow, but I have not yet managed to figure out which setting triggers it.

The used ssh client is:

 OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011

Edit:

This is actually repeatable on local OSX too and not tied to Ubuntu.

Installed Macports (not sure if needed) and using the following GNU nano to edit text files::

GNU nano version 2.0.6 (compiled 11:42:28, May 18 2009)
Email: nano@nano-editor.org Web: http://www.nano-editor.org/
Compiled options: --disable-nls --enable-color --enable-extra --enable-multibuffer --enable-nanorc

The following terminal related environment variables are set:

    TERM=ansi
    TERM_PROGRAM=Apple_Terminal
    TERM_PROGRAM_VERSION=273.1

In Terminal.app it says the emulation is ansi and encoding UTF-8.

Not stil sure which is the triggering combiation (which Terminal mode, etc.)

Mikko Ohtamaa

Posted 2011-08-01T01:11:15.680

Reputation: 1 790

1It's an ncurses issue, probably. nano, less, and most "full screen applications" you encounter use ncurses. Apparenly, from a quick Google search, issues with ncurses and SSH not uncommon. – new123456 – 2011-08-01T02:19:30.060

Please add a (small) screenshot of the problem. You can use Command-Shift-4, then drag a rectangle around the affected area. – Chris Page – 2011-09-27T16:50:13.327

Added a screenshot demostrating problem and showing how the first character is missing when using GNU nano – Mikko Ohtamaa – 2011-09-27T20:21:21.710

Answers

0

Looks like Terminal is just buggy.

I recommend using iTerm 2 instead.

iTerm2 is a replacement for Terminal and the successor to iTerm. It works on Macs with Leopard, Snow Leopard, or Lion. Its focus is on performance, internationalization, and supporting innovative features that make your life better.

Mikko Ohtamaa

Posted 2011-08-01T01:11:15.680

Reputation: 1 790

5

I solved the similar problem I had in OS X Terminal settings: Profiles, Advanced, and changed the "Declare terminal as" drop box to xterm-256color.

Vultan

Posted 2011-08-01T01:11:15.680

Reputation: 343

Thanks, this fixed my problem too.. but I have no idea why...? – snd – 2016-01-10T02:55:30.977

4

The problem you describe is typical of an incorrect value for the TERM environment variable. Specifically, the value of the TERM variable on Ubuntu selects a set of terminal features and capabilities that do not match those of the OS X Terminal application.

If TERM is set to something like xterm-color or xterm-256color try setting it to other values (e.g. the other one from the two I mentioned, or plain xterm, ansi or vt220).


UPDATE:

In OS X Terminal.app, try the following commands

TERM=ansi nano googlef916dafa821844e0.html
TERM=vt220 nano googlef916dafa821844e0.html
TERM=xterm nano googlef916dafa821844e0.html
TERM=xterm-color nano googlef916dafa821844e0.html    
TERM=xterm-256color nano googlef916dafa821844e0.html

RedGrittyBrick

Posted 2011-08-01T01:11:15.680

Reputation: 70 632

Hi RedGrittyBrick. Based on your feedback I included more information in the qusetion, but it is still being unsolved. – Mikko Ohtamaa – 2011-09-27T13:19:44.383

@Mikko: see updated answer, do you see the exact same effect with all five commands? – RedGrittyBrick – 2011-09-28T10:25:40.990

xterm and vt220 work, or at least they are more reliable. With ansi the character from cols 1-7 might be missing when opening nano - it seems almost like a timing problem. I'll keep using xterm for few days and see if this is the cure. – Mikko Ohtamaa – 2011-09-28T13:55:13.530

Seems like setting the TERM might have affected the problem, but did not cure it permanently. Now I have switched to iTerm 2 and have been happy ever after. Thanks for helping though. – Mikko Ohtamaa – 2012-01-09T13:58:35.560