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