Menu

#85 Horizontal resizing and wrapping

v1.0 (example)
open
nobody
None
5
2020-09-06
2020-08-11
Atemu
No

Hi,

I have two issues that tie into each other. The first is very similar issue to #82 but on the other axis; when I shrink mlterm horizontally, the right border "eats" up the text as expected but when I enlarge it again, the text doesn't come back and the background is shown instead.

My second issue is that when I have a very long line which exceeded the window bounds when it was printed, it got automatically reflowed over multiple lines to fit the window as expected. However, when I enlarge the terminal afterwards, the long line stays wrapped and doesn't reflow to make use of the additional space given to the terminal.

Ideally mlterm would reflow lines dynamically on any horizontal resize action. This would resolve both of these issues as lines going beyond the terminal bounds after shrinking it wouln't need to be "eaten" and would be reflowed to fit the smaller window instead. Lines that have previously been wrapped (either because the windows was shrunk or wasn't large enough in when the lines was printed) would gradually unwrap themselves as the terminal bounds grow.

For reference, rxvt implements this behaviour.

OS is nixos-unstable@83451174b82.

mlterm version 3.9.0
Features: otl implugin imagelib(builtin) utmp

Discussion

  • Araki Ken

    Araki Ken - 2020-08-22

    Hi, thanks for your report.

    Mlterm now supports your request.
    Please try https://github.com/arakiken/mlterm/archive/master.zip
    (It is not completely compatible to rxvt-unicode, but I think it generally works fine.)

    If you find strange behavior, I would like you to send me a script to reproduce it.
    Sample script is http://mlterm.sf.net/mlterm-resize-test.sh

    Regards,

     
  • Atemu

    Atemu - 2020-08-23

    Hi!

    Thank you so much for the fix!

    I can confirm that dynamic resizing is working and output is not being eaten up by horizontal resizing anymore.

    As you mentioned it isn't quite perfect, there are three minor issues I have noticed:

    1. Scrolling up (Shift+PgUp) after scaling down the window doesn't reflow the old output that was off-screen (vertically) before, it stays truncated. Scrolling up after enlarging the window again brings it back though.
    2. When scaling down the window, the log is pushed off-screen at the top to make space for the wrapped lines as expected. When scaling the terminal up again however, the lines remain off-screen and you effectively scrolled down.
    3. There seems to be some weird interaction with Bash's PS1 when it gets wrapped leading to corruption of the previous line when the terminal is scaled up again.

    I can sadly not provide repro scripts for 1. as I'm not aware of control sequence magic that allows you to scroll the terminal's log but here is one that shows the effect of 1. and what I believe is the same bug as 3.:

    #!/bin/sh
    
    printf "\x1b[8;10;80t"
    ls -l ~/
    echo last line at bottom of terminal
    sleep 2
    printf "\x1b[8;10;20t"
    sleep 1
    printf "\x1b[8;10;80t"
    echo last line no longer at the bottom and also corrupted
    

    Since my original concern has been addressed though, I'd consider this issue resolved; I'm no longer losing the terminal log when my window manager tiles mlterm.
    Thank you so much for all your hard work, mlterm is by far the best terminal emulator I've ever used!

     
    • Araki Ken

      Araki Ken - 2020-09-06
       
  • Araki Ken

    Araki Ken - 2020-08-29

    Thanks.
    I fixed to at least make the script work correctly.
    I'd like you to test https://github.com/arakiken/mlterm/archive/master.zip

    But it is quite difficult to solve the problem 1 soon.
    Mlterm assumes that the data in the backlog doesn't need to be edited,
    thereby simplifies the implementation (bidi, opentype layout and so on).
    Major design change is necessary to rewap lines in the backlog.

    Regards,

     
  • Atemu

    Atemu - 2020-08-30

    Hi,

    I can confirm that the bugs highlighted by my repro script have been fixed. Thank you!

    While playing around however, I managed to get the lines to scroll up again by printing long lines in a small window and then scaling it up.

    Repro for the new bug variant:

    #!/bin/sh
    
    printf "\x1b[8;20;80t"
    for j in {0..10} ; do echo -n " $j: "
        for i in {00..50} ; do echo -n $i ; done
    done
    echo
    echo last line at the bottom of the terminal
    sleep 2
    printf "\x1b[8;20;120t"
    echo last line no longer at the bottom
    

    Thanks,

     

Log in to post a comment.

MongoDB Logo MongoDB