terminal: git bash for windows in terminal does not break lines correctly
Environment
Platform ServicePack Version VersionString
-------- ----------- ------- -------------
Win32NT 10.0.18363.0 Microsoft Windows NT 10.0.18363.0
Windows Terminal Preview
Version: 1.7.572.0
Setting for git bash:
{
"name": "git bash",
"commandline": "%PROGRAMFILES%/git/usr/bin/bash.exe -i -l",
"icon": "%PROGRAMFILES%/Git/mingw64/share/git/git-for-windows.ico",
"startingDirectory" : "%USERPROFILE%"
},
Steps to reproduce
- Open a terminal window with git for windows bash
- Do a rebase operation
Expected behavior
Line breaks start at the beginning of the next line.
Actual behavior
git rod
is an alias for git rebase --autostash -i origin/develop
$git rod
error: could not apply 6b04f92e... DuplicateInput now supports generating code for arrays for the VfcTypeImplementation
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
Recorded preimage for 'src/App/Changelog.md'
Could not apply 6b04f92e... DuplicateInput now supports generating code for arrays for the VfcTypeImplementation
Auto-merging src/App/Tests/Silt.Plugin.SimpleTransformersGeneratorTests/GeneratorTests/DuplicateInputTransformerTests.cs
Auto-merging src/App/Plugins/Silt.Plugin.SimpleTransformersGenerator/GeneratorStrategy/DuplicateInputTransformer.cs
Auto-merging src/App/Changelog.md
CONFLICT (content): Merge conflict in src/App/Changelog.md
It seems that only the console without \r
is not returning the operator to the beginnig of the line.
Not sure if there is a setting I need to configure for this to work.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 7
- Comments: 26 (4 by maintainers)
Commits related to this issue
- builtin/commit: reset terminal after calling EDITOR Obviously a hack, as this needs to be done properly in compat/terminal but as a workaround to issue microsoft/terminal#9359 that is caused by some ... — committed to carenas/git by carenas 3 years ago
- builtin/commit: reset terminal after calling EDITOR When EDITOR is invoked to modify a commit message, it will likely change the console settings, and if it misbehaves, will leave the console output ... — committed to carenas/git by carenas 3 years ago
- builtin/commit: reset terminal after calling EDITOR When EDITOR is invoked to modify a commit message, it will likely change the console settings, and if it misbehaves, will leave the console output ... — committed to carenas/git by carenas 3 years ago
- editor: save and reset terminal after calling EDITOR When EDITOR is invoked to modify a commit message, it will likely change the terminal settings, and if it misbehaves will leave the terminal outpu... — committed to carenas/git by carenas 3 years ago
- editor: save and reset terminal after calling EDITOR When EDITOR is invoked to modify a commit message, it will likely change the terminal settings, and if it misbehaves will leave the terminal outpu... — committed to carenas/git by carenas 3 years ago
- editor: save and reset terminal after calling EDITOR When EDITOR is invoked to modify a commit message, it will likely change the terminal settings, and if it misbehaves will leave the terminal outpu... — committed to carenas/git by carenas 3 years ago
- editor: save and reset terminal after calling EDITOR When EDITOR is invoked to modify a commit message, it will likely change the terminal settings, and if it misbehaves will leave the terminal outpu... — committed to git/git by carenas 3 years ago
- editor: save and reset terminal after calling EDITOR When EDITOR is invoked to modify a commit message, it will likely change the terminal settings, and if it misbehaves will leave the terminal outpu... — committed to carenas/git by carenas 3 years ago
- editor: save and reset terminal after calling EDITOR When EDITOR is invoked to modify a commit message, it will likely change the terminal settings, and if it misbehaves will leave the terminal outpu... — committed to git/git by carenas 3 years ago
- Mention Bug Fix in release notes Git now works around [an issue with `vi` and incorrect line breaks in the Windows Terminal](https://github.com/microsoft/terminal/issues/9359). Signed-off-by: Johann... — committed to git-for-windows/build-extra by dscho 3 years ago
- editor: allow for saving/restoring terminal state When EDITOR is invoked to modify a commit message, it will likely change the terminal settings, and if it misbehaves will leave the terminal output d... — committed to carenas/git by carenas 3 years ago
- editor: allow for saving/restoring terminal state When EDITOR is invoked to modify a commit message, it will likely change the terminal settings, and if it misbehaves will leave the terminal output d... — committed to carenas/git by carenas 3 years ago
- installer: add editor.rogue configuration if EDITOR=vim selected Proactively activate the rogue.editor configuration option if the user persists on using VIM even after being warned against it, to av... — committed to carenas/build-extra by carenas 3 years ago
- installer: add editor.rogue configuration if EDITOR=vim selected Proactively activate the rogue.editor configuration option if the user persists on using VIM even after being warned against it, to av... — committed to carenas/build-extra by carenas 3 years ago
- installer: add editor.rogue configuration if EDITOR=vim selected Proactively activate the rogue.editor configuration option if the user persists on using VIM even after being warned against it, to av... — committed to carenas/build-extra by carenas 3 years ago
- installer: add editor.rogue configuration if EDITOR=vim selected Proactively activate the rogue.editor configuration option if the user persists on using VIM even after being warned against it, to av... — committed to carenas/build-extra by carenas 3 years ago
- editor: allow for saving/restoring terminal state When EDITOR is invoked to modify a commit message, it will likely change the terminal settings, and if it misbehaves will leave the terminal output d... — committed to carenas/git by carenas 3 years ago
- editor: allow for saving/restoring terminal state When EDITOR is invoked to modify a commit message (or do some other editing), and it is a terminal mode editor, it will need to change the terminal s... — committed to git/git by gitster 3 years ago
FWIW the workaround from git to reset the terminal settings after vi is invoked has been merged and is released as part of the last Git for Windows prerelease:
https://github.com/git-for-windows/git/releases/tag/v2.34.0-rc0.windows.1
This should avoid the most egregious cases until a final solution to keep them consistent is found
Correct; vim takes an output console from git with ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT adds DISABLE_NEWLINE_AUTO_RETURN | ENABLE_VIRTUAL_TERMINAL_PROCESSING and returns it dirty (even if it doesn’t crash AFAIK).
adding functionality in Git for Windows that resets the terminal after vi returns workarounds the issue and will be present in a future release
I never tested vt100, @carenas - i did now.
vt100 didn’t do much more than removing my beautiful colors. Reset is currently my preferred trick. but might just postfix the
reset
command to my alias.the mentioned workaround only applies to git for windows (requires code in git that is not part of the regular codebase yet).
it definitely looks like the same problem, and as documented in #10152 another workaround that doesn’t require code changes is to set TERM to something else than xterm*; ex:
it is important also to note that running
reset
after vi is invoked should also fix the terminal, as well as fixing your rbim command/alias so it doesn’t attempt to run vi in a non terminal, if that is possible (expect
might help there)FYI, on Windows this behaviour is controlled by the
DISABLE_NEWLINE_AUTO_RETURN
output mode. So maybe someone is setting that mode and not restoring it on exit. If that’s the problem, it could potentially be fixed by #4954.