vi in Windows Terminal does not properly insert #16317

Closed
opened 2026-01-31 05:03:55 +00:00 by claunia · 8 comments
Owner

Originally created by @theking2 on GitHub (Dec 31, 2021).

Windows Terminal version

1.11.3471.0

Windows build number

22000.376

Other Software

vi 1:070224-5

Steps to reproduce

in vi switch to insert mode ('i')
type text
esc

Expected Behavior

Existing text moves right new text is inserted.

Actual Behavior

Existing text is overwritten on screen but not on file
vi-in windows-terminal

Originally created by @theking2 on GitHub (Dec 31, 2021). ### Windows Terminal version 1.11.3471.0 ### Windows build number 22000.376 ### Other Software vi 1:070224-5 ### Steps to reproduce in vi switch to insert mode ('i') type text esc ### Expected Behavior Existing text moves right new text is inserted. ### Actual Behavior Existing text is overwritten on screen but not on file ![vi-in windows-terminal](https://user-images.githubusercontent.com/1612152/147830520-b8bb4443-d964-49ae-a28f-4e1be8d9cb97.gif)
claunia added the Needs-TriageNeeds-Tag-FixNeeds-AttentionProduct-Terminal labels 2026-01-31 05:03:56 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Jan 3, 2022):

@theking2 Are you using vim in WSL, or vim.exe? If you're in WSL, which distro, and what's TERM set to?

IIRC I saw this once before the break in WSL vim myself, but never had the chance to file formally.

@zadjii-msft commented on GitHub (Jan 3, 2022): @theking2 Are you using vim in WSL, or vim.exe? If you're in WSL, which distro, and what's `TERM` set to? IIRC I saw this once before the break in WSL vim myself, but never had the chance to file formally.
Author
Owner

@ghost commented on GitHub (Jan 7, 2022):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Jan 7, 2022): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@wrbp504 commented on GitHub (Jan 21, 2022):

I have the same problem with vi (not vim as the question states) editor on Unix machine. In my case using Windows Terminal/CMD/ssh to connect to the unix machine with TERM=xterm

@wrbp504 commented on GitHub (Jan 21, 2022): I have the same problem with vi (not vim as the question states) editor on Unix machine. In my case using Windows Terminal/CMD/ssh to connect to the unix machine with TERM=xterm
Author
Owner

@theking2 commented on GitHub (Jan 22, 2022):

My situation exactly: connecting to Linux janus 5.16.0-arch1-1

@theking2 commented on GitHub (Jan 22, 2022): My situation exactly: connecting to Linux janus 5.16.0-arch1-1
Author
Owner

@elsaco commented on GitHub (Jan 23, 2022):

On same Win 11 host (with default SSH client) the issue is not observed when using Alacritty. The first line after inserting foo:

vi_insert_test

Remote vi used for testing:

[tux@kvmArch ~]$ pacman -Qi vi
Name            : vi
Version         : 1:070224-5
Description     : The original ex/vi text editor
Architecture    : x86_64
URL             : http://ex-vi.sourceforge.net/
Licenses        : custom:ex
Groups          : None
Provides        : None
Depends On      : ncurses
Optional Deps   : s-nail: used by the preserve command for notification
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 315.50 KiB
Packager        : Evangelos Foutras <foutrelis@archlinux.org>
Build Date      : Mon 10 May 2021 01:18:36 AM PDT
Install Date    : Sat 22 Jan 2022 06:58:32 PM PST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature
@elsaco commented on GitHub (Jan 23, 2022): On same Win 11 host (with default SSH client) the issue is not observed when using Alacritty. The first line after inserting _foo_: ![vi_insert_test](https://user-images.githubusercontent.com/3933920/150693666-c24006f2-fb7d-4b5f-b2ee-e03af70f2900.png) Remote `vi` used for testing: ``` [tux@kvmArch ~]$ pacman -Qi vi Name : vi Version : 1:070224-5 Description : The original ex/vi text editor Architecture : x86_64 URL : http://ex-vi.sourceforge.net/ Licenses : custom:ex Groups : None Provides : None Depends On : ncurses Optional Deps : s-nail: used by the preserve command for notification Required By : None Optional For : None Conflicts With : None Replaces : None Installed Size : 315.50 KiB Packager : Evangelos Foutras <foutrelis@archlinux.org> Build Date : Mon 10 May 2021 01:18:36 AM PDT Install Date : Sat 22 Jan 2022 06:58:32 PM PST Install Reason : Explicitly installed Install Script : No Validated By : Signature ```
Author
Owner

@wrbp504 commented on GitHub (Jan 23, 2022):

Thanks, the issue does not present on many other terminals (putty, etc), but the question is specific for using windows terminal, why is this closed?

@wrbp504 commented on GitHub (Jan 23, 2022): Thanks, the issue does not present on many other terminals (putty, etc), but the question is specific for using windows terminal, why is this closed?
Author
Owner

@j4james commented on GitHub (Jan 23, 2022):

I wonder if this is perhaps the result of us not supporting insert/replace mode (see issue #1947). If someone that can reproduce the issue can capture a log with the debug tap, that might help determine the source of the problem.

@j4james commented on GitHub (Jan 23, 2022): I wonder if this is perhaps the result of us not supporting insert/replace mode (see issue #1947). If someone that can reproduce the issue can capture a log with the [debug tap](https://github.com/microsoft/terminal/wiki/Enabling-the-debug-tap), that might help determine the source of the problem.
Author
Owner

@inphobia commented on GitHub (Jan 30, 2022):

i can reproduce this with windows terminal versions:

  • 1.11.3471.0 - current stable
  • 1.12.3472.0 - current preview
    on windows enterprise 21h1 - 19043.1415 (hm, need to upate it seems)

this with cygwin running in wt, as well as several wsl2 distros in wt. reproduced in vi, either a vi.exe running in a cygwin tab, vi on wsl, or vi via cygwin ssh or wsl ssh to real linux machines.
verified to not be an issue when using either the corresping app for the distro nor with the native cygwin terminal (mintty).

when enabling debug mode in terminal 1.11.3471.0 however it just crashes (not just the new tab but all tabs). it does work in preview so i can get debug tap output from that.

pasting a decent amount of lines is vi (haven't found upper or lower limits nor if linelight has any influence), but around 100 lines mostly get's at least a few lines which don't match the input. doing a whole bunch of lines (lets say 2500) almost always puts me in some kind of mode where vi seems to only get command characters no matter what i type. only way out is killin the process via another session.

being that the debug output is quite big, and seems to include quite a few control characters, i wonder what the best way is to capture it and get it to you.
for capturing i can select everything with the mouse, but i haven't an option to either copy all output to a file or select all the text at once (looking throught the default config json as well).

(i thought i also mentioned this in a few other issues here but can't for the life of me find them)0

@inphobia commented on GitHub (Jan 30, 2022): i can reproduce this with windows terminal versions: * 1.11.3471.0 - current stable * 1.12.3472.0 - current preview on windows enterprise 21h1 - 19043.1415 (hm, need to upate it seems) this with cygwin running in wt, as well as several wsl2 distros in wt. reproduced in vi, either a vi.exe running in a cygwin tab, vi on wsl, or vi via cygwin ssh or wsl ssh to real linux machines. verified to not be an issue when using either the corresping app for the distro nor with the native cygwin terminal (mintty). when enabling debug mode in terminal 1.11.3471.0 however it just crashes (not just the new tab but all tabs). it does work in preview so i can get debug tap output from that. pasting a decent amount of lines is vi (haven't found upper or lower limits nor if linelight has any influence), but around 100 lines mostly get's at least a few lines which don't match the input. doing a whole bunch of lines (lets say 2500) almost always puts me in some kind of mode where vi seems to only get command characters no matter what i type. only way out is killin the process via another session. being that the debug output is quite big, and seems to include quite a few control characters, i wonder what the best way is to capture it and get it to you. for capturing i can select everything with the mouse, but i haven't an option to either copy all output to a file or select all the text at once (looking throught the default config json as well). (i thought i also mentioned this in a few other issues here but can't for the life of me find them)0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16317