Search code examples
floatingxfce

xfce4-terminal is not floating well


I use i3 as a wm, so when I switch terminal size, all text remains same position as it was on previous size.

For example this happens when I start man man and then go full screen. enter image description here

Also it's huge pain when try to do something continous like pip install --upgrade pip it prints new response on each line instead refreshing.

That's what happend when I toggle fullscreen: enter image description here


Solution

  • It is generally not possible for terminals to reformat already printed output when re-sizing, other than wrapping lines that are too long. Especially not in a way so that the output looks like it would have if the terminal had had the new to begin with (stretching/shrinking old progress bars, reorganizing the columns of outputs from ls, etc.). The information that would be necessary for that is just not available to the terminal.

    The content of a terminal is essentially just a sequence of characters that are printed from left to right, from top to bottom. New lines happen by explicit newline character (\n) or when writing more than what fits in a line.

    There is no formatting option for right, center or justified alignment. Anything that looks like it is doing one of these alignments, is done by the program producing the output (usually by taking the current terminal width and then either by placing the cursor at the appropriate places or just by printing a line that goes the full width of the terminal). One your second screenshot you can see how pacman prints the current progress bars depending on the current width of the terminal. You can also see how it will shorten some names in order to have enough room for the size and speed informations. The missing part cannot be restored by the terminal emulator and pacman (and most other programs) does not go back in the terminal buffer to modify their previous output to fit a new window size. Usually progams just add new output at the bottom. Progress bars are often (most of the time? always?) done by going to the beginning of the current line (printing the special character \b does that) and overwriting the line with updated information, again and again.

    Of course there are some programs that actually can (or successfully pretend that they can) handle window re-sizing for all of their output. These programs usually take over the whole terminal window (vim, less, elinks, ...) and reformat their output on their own as required. If they have the required information, that is. In your first screenshot less does not have the necessary information to reformat the text.