• Luis Javier Merino's avatar
    Use the correct last column for double-width lines · 4352df00
    Luis Javier Merino authored and Kurt Hindenburg's avatar Kurt Hindenburg committed
    Some control functions special case the last column. When a line has
    been set to double-width via DECDWL or DECDHL (double-height and
    double-width), the correcr last column for that line should be used.
    Control functions which special case the last column include TAB, CUF,
    ICH and DECRC.
    
    Can be tested with:
    
    perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7l$r";
             $s="L"."\tx"x4 ."\t\tR"; say "\e#3$s\n\e#4$s"'
    
    The above tests that tabs don't travel beyond the last column in
    double-width lines.  The last column (below columns 79 and 80 of
    the previous line) should have an "R".
    
    perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7h$r";
             $s="L"."X"x36 ."\e[6C"."R"; say "\e#3$s\n\e#4$s"'
    
    The above tests that CUF (Cursor Forward) doesn't travel beyond the last
    column in double-width lines.  The last column (below columns 79 and 80
    of the previous line) should have an "R".
    
    perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7h$r";
             $s="L"."X"x22 ."R"."x"x8 ."r"."\e[17D\e[16@";
             say "\e#3$s\n\e#4$s"'
    
    The above tests that ICH (Insert CHaracters; VT200+) doesn't write past
    the last column, visible on repaints (switch to another window and
    back).
    
    perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7h$r";
             $s="L"."X"x38 ."r\e7\e[H\e8R"; say "\e#3$s\n\e#4$s"'
    
    The above tests that DECRC (Restore Cursor) doesn't restore the cursor
    to a position beyond the last column on double-width lines.  The last
    column should have an "R", "r" should not be visible.
    
    perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7l$r";
             $s="L"."X"x38 ."R"; print "\e#6$s"'; sleep 5; echo
    
    The above tests that the cursor stays at the rightmost column. The
    cursor should stay over the "R" for 5 seconds.
    4352df00
Screen.cpp 46.7 KB