-
-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
on Windows: vim (in WSL or remote Linux system) replaces a character to g
on file open
#241
Comments
Thanks for reporting this; I have noticed this happen twice but didn't see it repro 100%. This sounds like an issue in the shape of a response to a query issued by vim; there were a number of changes to improve esctest conformance in 20200620-160318-e00b076c and I suspect that some of those uncovered an edge case somewhere, or is tickling a compatibility issue with the Windows PTY layer and its interpretation of these sequences too. If you have a chance to look at this a bit more before I next have an opportunity to fire up my Windows environment, running something like |
script was executed inside vbox-6.1.10 fedora-32 VM In each attempt capture,
cursor in file was located at line 13 or 14 around words attributes/configuration, which is where the 'g' was seen
In hyper.js, in the script-replay of the logs, the words 'attributes/configuration' were corrupted a little differently. (nb redoing the whole ssh/attempt from hyper.js does not exhibit any abberations) Also your term size may need to be exact
|
Thanks for being so thorough with the data you've collected! I'm looking into this now. |
(My Windows machine is unplugged at the moment due to some re-organizing in my study, so I'm speculating from my linux machine) I'm wondering if this might be a confluence of this change in wezterm: interacting with these issues in the windows pty layer: I haven't been able to reproduce the same effect on linux (the scripts you provided do demonstrate what you saw; I just can't trigger the same issue when run natively on linux) so it does make me suspect something in the conpty layer. I'll get my Windows system reconnected a bit later and play around a bit. I suspect that there are a couple of directions to go:
|
g
on file open
I'm wondering if the non-deterministic portion of refs: #241 might be due to splitting of data across multiple write calls. This commit adopts the use of BufWriter around the writer so that we can buffer up and explicitly flush the responses to the terminal.
I didn't have a super satisfactory time reproducing this issue on my windows machine; I saw it only once! The non-determinism makes me suspect a timing/buffering issue so I pushed a speculative commit to buffer the writes around these responses and flush them explicitly when we have a fully formed escape sequence to send. I haven't seen the issue with that new build, but I also haven't seen the issue with the current release after the initial occurrence, so I don't want to draw a hasty conclusion. |
I downloaded the latest continuous build from 20200712 run 166557176
In this testbuild, confirming that g-replacement is not reproducible, However, the following variation exists
yes, the non-determinism cold be either processor-clockspeed/time dependent or the memory leak could be build-binary/memory -placement dependent.
Another thing I had tried with the previous test-build, was creating a
From what I understood from the documentation ( The weird effects still exist in
|
I'm curious about whether the variant bad behavior is still an issue now in master after updating openconsole.exe; if you have a few moments to run through your test scenario, please let me know! |
yes I did, there are random effects that happen as often as 1 in 3 attempts. If at first they don't show up on their own, they can be made to happen by making changes to the .vimrc. It was not a viminfo/marker problem, commands like 'gg' can cause the effect of making cursor goto start of file and "I" to insert at start of file, '0' to start of line, '^' to first char of line. |
How large is your terminal when you encounter this? Could you try setting: return {
ratelimit_output_bytes_per_second = 4289999998,
} to increase the ratelimit to just about as large as it can be set and see if that helps? |
tried setting the large rate limit. no effect, random effects happen once in 3 attempts. May not be because of excess rates because,its a VM on a laptop, VM being slower, and text comes over an ssh connection. |
Some updates,
While the above vimrc snippet, offered temporary relief, it made movement inside edit mode difficult as arrow keys can no-longer be used. The info hints that there may be some encoding-bugs or feature-deficiency with older openssh. All this while, in Windows-10, I have been using the default OS-bundled ssh-client
I updated an instance of a local windows openssh server, to a pre-release version 8.1. The ssh-server also comes with its own ssh-client.
For the moment, with this ssh-client, no random effects seem to happen, I will wait a while before confirming none are happening. Possibly, 'vim losing column position of last file close in the presence of vimrc' is another issue. I am looking into that at the moment. |
It may be that the wezterm bug is resolved, if nothing else is found in two weeks. I am 99.99% confident that the 'vim losing column position' is neither a wezterm issue nor an ssh issue. It's possibly a vim bug, but I could not find bug filed. The bug exists even when using the virtualbox direct console, and without using ssh. I am unsure why something like this is not caught by anyone elsewhere. Documenting the issue here, as it has been mentioned in comments above. Description: Troubleshooting: :autocmd BufRead
--- Autocommands ---
fedora BufRead
* if line("'\"") > 0 && line ("'\"") <= line("$") | exe "normal! g'\"" | endif
: The autocommand on bufread does execute. The normal mode command vim is the latest on fedora-32 # rpm -qa | egrep -i vim
vim-minimal-8.2.1224-2.fc32.x86_64
vim-filesystem-8.2.1224-2.fc32.noarch
vim-enhanced-8.2.1224-2.fc32.x86_64
vim-common-8.2.1224-2.fc32.x86_64 There have been similar reports, stackoverflow-31094647 and stackexchange-q2031 but they may be different issues. |
Since it seems like we fixed the wezterm side (improving buffering/flushing) and the remaining issue sounds like a vim issue, I'll close this one out. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Describe the bug
This is vague bug. so requesting other users to report/comment if they have encountered this.
Upon opening, vim replaces a character to "g" on file open. The character replaced is at the cursor position of when the file was last closed. present current position is 1 word position back.
Happens spuriously, and many components are involved. I was hesitant to file bug for some time on account of not being able to acertain the component, So apologies if not on account of wezterm . It happens when typing fast
For example, executing ls(enter) ls(enter) and then vim <file> might do it, but not always. or just reopening and closing same file many times over.
If one closes the file (colon-q) without editting, then vim will warn the user that the file has changed, and this easy to catch.
If one makes changes and saves, it can be very sneaky. May result in error in program or typo in file.
I am unsure if the following is related which is also troublesome when it happens, just as often, but easier to spot.
Sometimes, pressing enter in the shell prompt, barfs up 'term escape seq'-like characters "[55;43R" as input to next readline, requiring clearing (end ctrl-u) before typing next command, in order to avoid command not found errors. I am unsure what they are, what they do or where they come from.
So, I wonder if there is something in the term input buffer, that vim is reading from the term upon switching to curses mode, which causes vim to execute vim commands like character replace. That is, term escape sequences are slipping into input characters.
workaround:
Habituate oneself to press 'u' undo on vim file open, to undo that chance automatic character replace on file open.
Other variants:
fresh vim, no fancy vim configuration
Most likely explanation is that the key sequence r-g-b in vim command-mode is "replace character with 'g' and move one word back"
The TERM environment variable is "xterm-256-color", seems to be auto-set from pwsh
The nature of this corruption changes after changing TERM variable to "ansi" or issuing commands like 'stty sane'
Environment (please complete the following information):
.\WezTerm\wezterm.exe -V
wezterm 20200620-160318-e00b076c-13-gab1e83c7
also happens on release build
wezterm 20200620-160318-e00b076c
To Reproduce
Happens spuriously, when typing fast, opening, editing, closing, doing shell commands in between.
For example, executing ls(enter) ls(enter) and then vim might do it, but not always.
Does not happen when typing slow
Does not seem to be because of any typing mis-presses
Have seen it happen in 2 ways. I have 2 VMs (Virtualbox 6.1.0) on my machine, alpine-linux, fedora. In a wezterm window, I have 4 wezterm tabs open. The tabs are fresh. start new tab, start ssh session, navigate to folder, do vim-open-close cycle.
(8.3p1-3) -> su root -> bash-shell(5.017) -> vim 8.2.1081
The bug happens with fedora /usr/bin/vim, fedora /usr/bin/vi and alpine /usr/bin/vim which are all 'Bram Moolenar' vim
alpine /usr/bin/vi is a pointer to busybox, has limited vi commands, does not do colors, and so this is not seen there
Configuration
nothing unusual. same as issue #235
Expected behavior
no sneaky character replaces.
Screenshots
NA
Session Recording
wt-record.sh does not have script command for windows
If the issue is with the way that escape sequences are processed it can be helpful
to capture the terminal output using the
wt-record
script to run
wezterm
and record a transcript. This requires thescript
utilityto be installed on your system (this is part of macOS and available in the
util-linux
package on linux systems).
In the example below a file named
20180225161026.tgz
is produced. Please attach thatfile to this issue, or if it contains private or sensitive issue that you don't want the
public to see on GitHub, please find some other way to get that file to a project
contributor (perhaps Dropbox or email?).
You can use
wt-replay 20180225161026.tgz
to replay that file.wt-record
can only record the terminal output; it cannot record the input events goingin to the terminal, so if you are having an issue with input, please be sure to describe
it below!
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: