I have recently upgraded from WSL (Windows Subsystem for Linux) version 1 to version 2. I am having a problem with using editors; some times, when I exit Nano or Vim, it wipes my history. I still have WSL V1 installed for comparison.
I am running on Windows 10, using the ConEmu terminal. My WSL V1 install is Ubuntu 18.04 and my WSL V2 install in Ubuntu 20.04. Both WSL setups are using xterm-256color.
Here are the symptoms:
- When the history is cleared, the last visible screen from Nano/Vim is left in the terminal history, but without any coloration (it turns white) and with enough blank lines below it that it is off the top of the screen. All I see is a single prompt at the bottom of an otherwise empty screen. There is no terminal history besides the final screen of what I had open in the editor, the blank lines, and the single terminal prompt.
- The history only clears when I have more than a full screen of terminal history. When I have less than a full screen of terminal history (i.e. no scrollbar), Nano/Vim exit normally (they preserve terminal history).
- The history is only cleared on WSL V2 (Ubuntu 20.04); WSL V1 (Ubuntu 18.04) works normally.
- The history is only cleared when I am running inside ConEmu. When I run WSL V2 through powershell, it works fine.
- All history clearing behavior works exactly as described above even when I am SSHed into a server! (i.e. history clearing occurs only on WSL V2 via ConEmu, and only if I have at least a full screen of terminal history).
- All of the above behavior is repeatable across killing and spawning new terminal tabs.
- When I try to paste the string
xterminto Nano, Nano gives me the error "[ Unknown sequence ]" and then becomes completely unresponsive to user input (I have to kill the terminal window to get out). Pasting other text (including very similar strings) works fine.
I don't think it is a problem with ConEmu, because WSL V1 still works. I don't think it is a problem with my bash config, because it still occurs when I SSH into another server.
Point #7 seems to point a big finger at xterm as the culprit, but what is the setting to fix it?