fix intensity on non-SyncTerm terminals

This commit is contained in:
Jeremy Penner 2020-06-27 23:03:24 -04:00
parent 23c1b75be4
commit cf48b50481

View file

@ -112,7 +112,7 @@ cdef enum:
FBRIGHTI = 8
FBLINKI = 16
cdef inline AstFromAch(int ach, int achPrev = achInvdI):
cdef AstFromAch(int ach, int achPrev = achInvdI):
cdef UAch uach, uachPrev
uach.ach = ach
uachPrev.ach = achPrev
@ -121,22 +121,23 @@ cdef inline AstFromAch(int ach, int achPrev = achInvdI):
cdef int csgr = 0
if (achPrev == achInvdI) or (uachPrev.sach.fgCol != uach.sach.fgCol):
sgr[csgr] = (uach.sach.fgCol & 7) + 30
csgr = csgr + 1
fBright = uach.sach.fgCol & FBRIGHTI
if (achPrev == achInvdI) or (fBright != uachPrev.sach.fgCol & FBRIGHTI):
if (achPrev == achInvdI) or (fBright != (uachPrev.sach.fgCol & FBRIGHTI)):
if fBright:
sgr[csgr] = 1
else:
sgr[csgr] = 2
csgr = csgr + 1
fBlink = uach.sach.fgCol & FBLINKI
if (achPrev == achInvdI) or (fBlink != uachPrev.sach.fgCol & FBLINKI):
if fBlink:
sgr[csgr] = 5
else:
sgr[csgr] = 25
sgr[csgr] = 0
achPrev = achInvdI
csgr = csgr + 1
sgr[csgr] = (uach.sach.fgCol & 7) + 30
csgr = csgr + 1
# fBlink = uach.sach.fgCol & FBLINKI
# if (achPrev == achInvdI) or (fBlink != uachPrev.sach.fgCol & FBLINKI):
# if fBlink:
# sgr[csgr] = 5
# else:
# sgr[csgr] = 25
# csgr = csgr + 1
if (achPrev == achInvdI) or (uachPrev.sach.bgCol != uach.sach.bgCol):
sgr[csgr] = uach.sach.bgCol + 40
csgr = csgr + 1
@ -471,14 +472,15 @@ cdef class AscrI(object):
rgast.append("%sD%s@" % (esc, esc))
# finally, draw the character before the last character in the line.
rgast.append(AstFromAch(achBeforeEOL, achNew))
achPrev = achBeforeEOL
else:
if xz != xzPred:
xzPred = xz
rgast.append("%s%d;%dH" % (esc, yz + 1, xz + 1))
achPrev = achInvdI
rgast.append(AstFromAch(achNew, achPrev))
achPrev = achNew
achPrev = achNew
xzPred = xzPred + 1
xz = xz + 1
if xz == self.w: