-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Windows: Fix text overrides line number #10558
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
Conversation
|
||
#ifdef WIN32 | ||
// Replace cud1 because \n is CRLF on Windows. | ||
unibi_set_str(ut, unibi_cursor_down, "\x1b[B"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why in if (xterm)
? Shouldn't it be done always on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cud1
of the non-xterm terminal may not be \x1b[B
. I think we have to add cud1
conversion each time we find a terminal that causes a problem.
I think the fundamental solution is to implement a mode that does not convert LF
to CRLF
in libuv
. If we write a patch, it may not be taken upstream, what shuld we do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the fundamental solution is to implement a mode that does not convert
LF
toCRLF
inlibuv
. If we write a patch, it may not be taken upstream, what shuld we do?
If it's a small/low-risk patch, they will probably accept it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erw7 yeah, I think the main issue here is the automatic conversion of LF
to CR``LF
. "Proper" terminal emulators can deal with both and I know Alacritty supports the "legacy newline mode" too if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that libuvu
is not the only one that converts CR
to CR+LF
. It also seems to occur when uv__vterm_state == UV_SUPPORTED
. So it seems to me that ConEmu
and VTP
are doing the same conversion.
Therefore, in order to solve this problem on Windows, it may be best to ignore the TERM
environment variable even if it is set.
Sure. But I thought 8072f08 did that already? |
No, the 8072f08 is a change to the input handle, so the output handle is not affected. As a result of my research, |
Replace cud1 with \x1b[B because \n is CRLF on Windows (due to libuv). fix #9461
/// Sets an environment variable. | ||
/// | ||
/// @warning Existing pointers to the result of os_getenv("foo") are | ||
/// INVALID after os_setenv("foo", …). | ||
int os_setenv(const char *name, const char *value, int overwrite) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future improvement: instead of returning int
, we could return a pointer to the new os_getenv()
result. So the caller pattern could be like:
term = os_setenv("TERM", term, ...)
However, after inspecting of all existing calls to os_setenv
and vim_setenv
, it looks like tui.c
was the only case where a os_getenv
result was passed to os_setenv
.
Replace cud1 with \x1b[B because \n is CRLF on Windows (due to libuv). fix neovim#9461
Replace
cud1
with\x1b[B
because\n
isCRLF
on Windows.Should we add the following code somewhere to solve this problem fundamentally?fix #9461