11

I'm having display issues whenever I edit files with nano in Windows 10 Linux Subsystem.

I will connect to a remote system (local CentOS7 VM on Virtualbox) using Bash/SSH. Then, I'll proceed to edit files on said remote system using nano.

I'll open a file, start deleting text and suddenly, entire lines of text start disappearing. I have to close and restart my work. When I get tired of it, I'll just switch to vim. I'd rather be in nano which works well for the basic stuff I do.

Anyone else seeing this?

Edit #1

  • Simply navigating the document in nano can cause this issue
  • vim and Putty aren't behaving in the same manner
  • Ctrl+Shift + 6 does not fix the issue
  • Using essentially a vanilla install of CentOS7, no modifications to the shell
  • AFAIK, this issues doesn't seem to happen when I access my Ubuntu Server VPS
18
  • Do you have the same problem if you use nano within that machine without using a remote connection?
    – Seth
    Commented Jan 27, 2017 at 13:31
  • Interesting... AFAIK, no, I don't.
    – TechFanDan
    Commented Jan 27, 2017 at 13:37
  • Neither on the host or guest? Do those lines actually get deleted if you save a file while you're experiencing that error or is it just a display error?
    – Seth
    Commented Jan 27, 2017 at 13:38
  • On the guest, the content gets deleted/messed up if I save. Directly on the host via the VBox window, I don't have similar issues.
    – TechFanDan
    Commented Jan 27, 2017 at 13:43
  • when you say you are deleting text, are you selecting blocks of text highlighted with the mouse, or deleting at the cursor with Del/Backspace, or using Ctrl+Shift+6 and Ctrl+K to select a block via the keyboard? Commented Jan 27, 2017 at 13:48

1 Answer 1

4

This is caused by incompatible remote terminfo. You could try this fix:

TARobison commented on Feb 22, 2017 •
@ShimShamSam I had the exact same problem and it was killing me.
I work on a few different servers and only the CentOS one was behaving
like this. Using the following when I log in has so far fixed the problem
for me.

stty sane
export TERM=linux

I'm new to all of this, so maybe we aren't talking about the same thing
here, but I thought I'd offer what little I could.`

More info here: https://github.com/Microsoft/WSL/issues/1436

This is a similar problem. You could check this out if you are not able to fix the issue: https://serverfault.com/questions/329154/ssh-garbling-characters-in-vim-nano-on-remote-server

1
  • 1
    This also works in a docker container when you open an interactive shell with something like sudo docker exec -it {container_name} bash. Just before you run nano command there exporting environment variable with export TERM=linux fixed the issue. Thanks.
    – muffir
    Commented Dec 20, 2019 at 8:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .