diff options
author | bptato <nincsnevem662@gmail.com> | 2021-11-15 23:16:03 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2021-11-19 21:51:47 +0100 |
commit | bbd416f5ffba5ba5e5d41869042cef1f85323146 (patch) | |
tree | d0ea32286e9cd3633d84c7a1a64a33ecde8db68e /src/io/buffer.nim | |
parent | d3d9139dd6aa535ed1d7f2c78accd6ac5fa89b3e (diff) | |
download | chawan-bbd416f5ffba5ba5e5d41869042cef1f85323146.tar.gz |
Operation "get rid of FlexibleCell" part one
Diffstat (limited to 'src/io/buffer.nim')
-rw-r--r-- | src/io/buffer.nim | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/io/buffer.nim b/src/io/buffer.nim index 7fa926f7..9196504b 100644 --- a/src/io/buffer.nim +++ b/src/io/buffer.nim @@ -3,7 +3,6 @@ import uri import strutils import unicode -import types/color import types/enums import css/style import utils/twtstr @@ -221,7 +220,6 @@ proc refreshDisplay*(buffer: Buffer) = inc n buffer.display[dls + j - n].runes.add(line[i].rune) buffer.display[dls + j - n].formatting = line[i].formatting - buffer.display[dls + j - n].nodes = line[i].nodes j += line[i].rune.width() inc i @@ -534,8 +532,6 @@ proc refreshTermAttrs*(buffer: Buffer): bool = return true return false -proc setText*(buffer: Buffer, x: int, y: int, text: seq[Rune]) = buffer.lines.setText(x, y, text) - func formatFromLine(line: CSSRowBox): Formatting = result.fgcolor = line.color.cellColor() if line.fontstyle in { FONT_STYLE_ITALIC, FONT_STYLE_OBLIQUE }: @@ -566,7 +562,7 @@ proc setRowBox(buffer: Buffer, line: CSSRowBox) = cx += buffer.lines[y][i].rune.width() inc i - let oline = buffer.lines[y][i..high(buffer.lines[y])] + var oline = buffer.lines[y].subline(i) buffer.lines[y].setLen(i) var j = 0 var nx = cx @@ -576,8 +572,9 @@ proc setRowBox(buffer: Buffer, line: CSSRowBox) = buffer.lines.addCell(y, Rune(' ')) inc nx + buffer.lines.addFormat(y, format) while j < line.runes.len: - buffer.lines.addCell(y, line.runes[j], format, line.nodes) + buffer.lines.addCell(y, line.runes[j]) nx += line.runes[j].width() inc j @@ -587,7 +584,8 @@ proc setRowBox(buffer: Buffer, line: CSSRowBox) = inc i if i < oline.len: - buffer.lines[y].add(oline[i..high(oline)]) + let nol = oline.subLine(i) + buffer.lines[y].add(nol) proc updateCursor(buffer: Buffer) = if buffer.fromy > buffer.lastVisibleLine - 1: |