mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 15:26:37 +00:00
libcanvas/CanvasExportStore.py:exportTextBuffer(): correctly encode {bold,underline} cell state changes.
This commit is contained in:
parent
0c1b62a609
commit
1f7d63802c
@ -166,10 +166,23 @@ class CanvasExportStore():
|
||||
def exportTextBuffer(self, canvasMap, canvasSize):
|
||||
outBuffer = ""
|
||||
for canvasRow in range(canvasSize[1]):
|
||||
canvasLastColours = [15, -1]
|
||||
canvasLastAttrs, canvasLastColours = self._CellState.CS_NONE, [15, -1]
|
||||
for canvasCol in range(canvasSize[0]):
|
||||
canvasColAttrs = canvasMap[canvasRow][canvasCol][2]
|
||||
canvasColColours = canvasMap[canvasRow][canvasCol][0:2]
|
||||
canvasColText = canvasMap[canvasRow][canvasCol][3]
|
||||
if (canvasColAttrs & self._CellState.CS_BOLD) \
|
||||
and (not (canvasLastAttrs & self._CellState.CS_BOLD)):
|
||||
outBuffer += "\u0002"; canvasLastAttrs = canvasLastAttrs | self._CellState.CS_BOLD;
|
||||
if (not (canvasColAttrs & self._CellState.CS_BOLD)) \
|
||||
and (canvasLastAttrs & self._CellState.CS_BOLD):
|
||||
outBuffer += "\u0002"; canvasLastAttrs = canvasLastAttrs & ~self._CellState.CS_BOLD;
|
||||
if (canvasColAttrs & self._CellState.CS_UNDERLINE) \
|
||||
and (not (canvasLastAttrs & self._CellState.CS_UNDERLINE)):
|
||||
outBuffer += "\u001f"; canvasLastAttrs = canvasLastAttrs | self._CellState.CS_UNDERLINE;
|
||||
if (not (canvasColAttrs & self._CellState.CS_UNDERLINE)) \
|
||||
and (canvasLastAttrs & self._CellState.CS_UNDERLINE):
|
||||
outBuffer += "\u001f"; canvasLastAttrs = canvasLastAttrs & ~self._CellState.CS_UNDERLINE;
|
||||
if canvasColColours[0] == -1:
|
||||
canvasColColours[0] = canvasColColours[1]
|
||||
if (canvasColColours[0] != canvasLastColours[0]) \
|
||||
|
Loading…
Reference in New Issue
Block a user