mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-16 12:36:38 +00:00
libcanvas/CanvasExportStore.py:exportTextBuffer(): correctly encode {bold,underline} cell state changes.
This commit is contained in:
parent
72b96b7c77
commit
299a045aa9
@ -166,15 +166,28 @@ 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]) \
|
||||
if (canvasColColours[0] != canvasLastColours[0]) \
|
||||
and (canvasColColours[1] != canvasLastColours[1]):
|
||||
if (canvasColColours[0] == -1) \
|
||||
if (canvasColColours[0] == -1) \
|
||||
and (canvasColColours[1] == -1):
|
||||
outBuffer += "\u000f"
|
||||
elif canvasColColours[1] == -1:
|
||||
|
Loading…
Reference in New Issue
Block a user