#828174 less: SGR attributes don't wrap across lines

Package:
less
Source:
less
Description:
pager program similar to more
Submitter:
Ben Longbons
Date:
2024-05-01 02:15:02 UTC
Severity:
normal
Tags:
#828174#5
Date:
2016-06-25 18:03:11 UTC
From:
To:
Dear Maintainer,

Whenever an attribute is still active across multiple lines, it is reset at
the end of the first line instead of continuing.


I know there is a potential performance problem related to scrolling
*backwards* (since the last full-reset may be indefinitely behind), but
doing the right thing for forward motion should be pretty simple and
would still be valuable.


BEGIN script
#!/bin/bash
echo Attributes:
attr() {
    printf '%-11s -> \e[%sm %-11s \n' "$3" "$1" "$3"
    printf '%-11s     %-11s \e[%sm <- %-11s %6s  %3s\e[m\n' "" "$3" "$2" "$3" "$1" "$2"
    # The trailing \e[m is only to ensure a clean state for terminals that
    # don't support the "restore single attribute" commands.
}
# commented attributes are not supported in xterm, and less disables
# itself completely when output is redirected, so I don't know how to
# test them.
attr 38:5:1 39 fg-colon256
attr 38\;5\;1 39 fg-semi256
attr 48:5:1 49 bg-colon256
attr 48\;5\;1 49 bg-semi256
attr 31 39 foreground
attr 41 49 background
attr 91 39 fg-bright
attr 101 49 bg-bright
attr 1 22 bold
attr 2 22 faint
attr 3 23 italic
#attr 20 23 fraktur
attr 4 24 underline
attr 21 24 double
attr 5 25 blink
#attr 6 25 rapid
attr 7 27 reverse
attr 8 28 conceal
attr 9 29 striked
#attr 11 10 font1
#attr 12 10 font2
#attr 13 10 font3
#attr 14 10 font4
#attr 15 10 font5
#attr 16 10 font6
#attr 17 10 font7
#attr 18 10 font8
#attr 19 10 font9
#attr 51 54 framed
#attr 52 54 circled
#attr 53 55 overline
#attr 60 65 right1
#attr 61 65 right2
#attr 62 65 left1
#attr 63 65 left2
#attr 64 65 stress