-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
ncurses terminal resize improvement #1235
Comments
@xaizek sorry to bother you with this. But I know you know ncurses well. Do you have an idea what is happening here? |
I don't have this problem with gnome-terminal on Debian Testing with i3/X.org:
It works with F11 as well as with Super+F (i3 fullscreen). |
In functions like
Resize on the other hand doesn't fail like this according to its documentation. So new size needs to be applied first. Not sure if it will make all issues go away, but some might be fixed. I just glanced over the code and didn't actually build and run it. Fix order of operations and will see if anything else needs to be done. |
@xaizek thanks for the feedback! So my local code looks like this now:
Unfortunately it still behaves the same for me though. Any more ideas? |
The interesting part is: I do resize several times, and sometimes it works and sometimes it doesn't. Mostly it doesn't. |
I also can't reproduce it. And statusline looks different here. Probably because I have no settings. How to configure it to look like yours? The information displayed there might affect widths of things. |
That's weird. I just created a new user on my system. So I don't have any configuration files. And did the exact same thing. And it still occurs here. My theme for this new user (can be seen with So this should be the same as yours. The screenshot I posted is from another PC, I will try to post the settings when I'm back home. However it is weird that for me it still happens with a new user with no settings. |
I just tried with qterminal and xterm. The problem doesn't occur there for me. |
From @xaizek s comment on issue #1235: ``` If the move would cause the window to be off the screen, it is an error and the window is not moved. Resize on the other hand doesn't fail like this according to its documentation. So new size needs to be applied first. ``` Big thanks to @xaizek for taking a look at our code and helping us!! Regards #1235
Then settings probably don't matter.
I tried it with xterm, screen inside xterm, urxvt, st and vte (sample terminal for the library). Maybe it is a bug in libvte. You could try one of the other libvte-based terminals on the same system where you try gnome-terminal:
|
I tried it with xfce4-terminal and terminator. In both cases the problem occurs! I have libvte 0.58.2. @mdosch which version do you have? It seems there is already 0.58.3 out. It's changelog sais:
Will update to this. |
Even with the latest update this happens for me. I also took another computer and did a fresh install of openSUSE Tumbleweed there. It also happens there for me. Will test on another distro. And will check the patches for libvte applied by openSUSE. |
Seems no patches in libvte nor gnome-terminal in openSUSE. |
gnome-terminal --version
# GNOME Terminal 3.34.2 using VTE 0.58.2 +BIDI +GNUTLS
apt list -a libvte-2.91-0
Auflistung... Fertig
libvte-2.91-0/testing,unstable,now 0.58.2-1 amd64
[Installiert,automatisch
Still working for me on debian testing.
|
Another user confirmed that it works on Debian Testing with xfce4-terminal 0.8.8. |
Heard from another user that it works fine on Arch Linux with: profanity 0.7.1, ncurses 6.1, Terminator |
/etc/profile.d/vte.sh on both my openSUSE Tumbleweed and the Arch machine look like this:
|
|
Please try out which values of the TERM variable does work correct, I mean other then "xterm" or "xterm-256color" ... I think about "gnome" and "gnome-256color" for gnome, "xfce " for xfce4-terminal, "terminator" for Terminator, ... and so on. Maybe an older XTerm version might also work like "xterm-old", "xterm-r5", "xterm-r6", "xterm-basic", ... The list can be found below /usr/share/terminfo/ ... |
When running gnome-terminal $TERM is set to So it works under qterminal with After If I run tmux in gnome-terminal and (where $TERM is |
Does it work with the original ncurses "xterm-new" instead of "xterm" or "xterm-256color" ... nevertheless the gnome variant is based on "vte" terminal type(s) ... there had been a few changes in terminfo.src up to upstream patch level ncurses-6.1-20191207.patch. |
|
Is there any other ncurses based application which shows this problem on current Tumbleweed with gnome-terminal or xfce4-terminal ... like yast with ncurses GUI |
I just tested yast and newsbeuter but they both work. So you are thinking its a profanity issue? But why only on oS TW? Also I don't see anything that's wrong in the code, and have been looking for hours. |
It a guess, yes, but only a guess. One could compare the output of |
on os TW:
@mdosch could you paste your output from Debian? |
Sidemark: ncurses here is configured with --enable-sigwinch, no idea if profanity uses a signal handler on SIGWINCH, but if so then it should also execute the old signal handler as well, if not set to SIG_IGN. |
We have https://github.com/profanity-im/profanity/blob/master/src/ui/core.c#L145
Is that okay? |
IMHO here the signal handler of libncurses is skipped as it is ignored. More is found in `doc/ncurses-intro.doc' in section "Using NCURSES under XTERM" |
Debian Bullseye (Testing)
|
|
The major difference seems to be
|
The "xterm-old" terminal description does not support the "rep" feature, that is if the misbehaviour is also visible then it is likely not the "rep" feature |
Unfortunately I don't know why it was implemented like this. This was before I joined the project. At https://github.com/profanity-im/profanity/blob/master/src/ui/core.c#L192 we have our own handler:
Also at this point the regular ncurses SIGWINCH handler is not called. but Unfortunately I don't have a lot of knowledge of ncurses and "deep" terminal behaviour. So right now I'm still uncertain on how to proceed with solving this issue :-/ @bitstreamout would you mind to advise me what I should do/check next? |
Check is TERM=xterm-old does work in XTerm as well in the other terminal emulators claiming to be XTerm compatible |
Also does not work properly. Tested in gnome-terminal. |
|
Hmmm ... then this is not the missing rep= feature as it had been reported here https://bugzilla.gnome.org/show_bug.cgi?id=787701 |
Not sure how to continue here. |
(vte + gnome-terminal developer here) Looks to me the combination of two issues: On Wayland with GNOME Shell / Mutter and friends, CSD (client-side decorated) apps don't maximize/restore in a single step, they resize through an intermediate incorrect size. This is reported at GNOME Terminal 129 and is being worked on in Mutter 801. The third screenshot shows that Profanity paints its contents assuming a somewhat smaller screen size, apparently exactly the incorrect temporary size that VTE goes through. The problem doesn't occur on X11, or with SSD (server-side decorated) apps, for the latter check gnome-terminal's hidden "headerbar" setting in dconf. That being said, Profanity should finally paint its contents according to the final window size. We're not aware of any race condition here in VTE: the window is resized and the kernel's tty size is always updated in an atomic step (or, well, two independent, complete atomic steps one after the other, as per the just-mentioned issue). However, we've already come across quite a few apps that fail to handle if multiple WINCHes arrive in quick succession, e.g. the second one arriving while the first one's handler is still running, or so. I'm pretty sure we're facing such a race condition in Profanity (or maybe ncurses) here; debugging what it's actually doing (e.g. |
@egmontkob ohhh!
Our handler is here: https://github.com/profanity-im/profanity/blob/master/src/ui/core.c#L192 I guess this could be the condition you described. I don't know why this check was actually added. It was before my time on this project. |
I also have this issue. I use
In the short term, a shortcut like |
Fixed by #1671 it seems! |
I think somewhere ncurses redraw/refresh/update functions are not used properly.
If we change the terminals window size profanity is not redrawn correctly. Also some parts of the screen are not updated correctly but I don't know how to reproduce it yet and might create another issue later.
In this example I run profanity in gnome-terminal.
start profanity:
![prof-1](https://user-images.githubusercontent.com/1658215/69917480-e76b2580-1466-11ea-828f-76fd84fd1f69.png)
Press F11 to have fullscreen:
![prof-2](https://user-images.githubusercontent.com/1658215/69917491-f94cc880-1466-11ea-9db9-b1cf73da6f03.png)
Already now it looks weird.
Looks even weirder.
The text was updated successfully, but these errors were encountered: