diff options
Diffstat (limited to 'src/local')
-rw-r--r-- | src/local/pager.nim | 11 | ||||
-rw-r--r-- | src/local/select.nim | 4 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim index 254c074e..9275a5d3 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -277,7 +277,7 @@ proc refreshDisplay(pager: Pager, container = pager.container) = container.highlightMarks(pager.display, hlcolor) # Note: this function does not work correctly if start < i of last written char -proc writeStatusMessage(pager: Pager, str: string, format = newFormat(), +proc writeStatusMessage(pager: Pager, str: string, format = Format(), start = 0, maxwidth = -1, clip = '$'): int {.discardable.} = var maxwidth = maxwidth if maxwidth == -1: @@ -302,7 +302,7 @@ proc writeStatusMessage(pager: Pager, str: string, format = newFormat(), pager.statusgrid[i].format = format i += w result = i - var def = newFormat() + var def = Format() while i < e: pager.statusgrid[i].str = "" pager.statusgrid[i].format = def @@ -327,8 +327,7 @@ proc refreshStatusMsg*(pager: Pager) = pager.writeStatusMessage(pager.alerts[0]) pager.alerts.delete(0) else: - var format = newFormat() - format.reverse = true + var format = Format(flags: {FLAG_REVERSE}) pager.alerton = false container.clearHover() var msg = $(container.cursory + 1) & "/" & $container.numLines & " (" & @@ -350,7 +349,7 @@ proc showAlerts*(pager: Pager) = pager.refreshStatusMsg() proc drawBuffer*(pager: Pager, container: Container, ostream: Stream) = - var format = newFormat() + var format = Format() container.readLines(proc(line: SimpleFlexibleLine) = if line.formats.len == 0: ostream.write(line.str & "\n") @@ -370,7 +369,7 @@ proc drawBuffer*(pager: Pager, container: Container, ostream: Stream) = s &= pager.term.processFormat(format, f.format) if i < line.str.len: s &= pager.term.processOutputString(line.str.substr(i), w) - s &= pager.term.processFormat(format, newFormat()) & "\n" + s &= pager.term.processFormat(format, Format()) & "\n" ostream.write(s)) ostream.flush() diff --git a/src/local/select.nim b/src/local/select.nim index 0be38104..bfa3faf8 100644 --- a/src/local/select.nim +++ b/src/local/select.nim @@ -223,7 +223,7 @@ proc drawBorders(display: var FixedGrid, sx, ex, sy, ey: int, let tr = if upmore: VerticalBar else: CornerTopRight let bl = if downmore: VerticalBar else: CornerBottomLeft let br = if downmore: VerticalBar else: CornerBottomRight - const fmt = newFormat() + const fmt = Format() display[sy * display.width + sx].str = tl display[sy * display.width + ex].str = tr display[ey * display.width + sx].str = bl @@ -279,7 +279,7 @@ proc drawSelect*(select: Select, display: var FixedGrid) = inc sx var r: Rune var k = 0 - var format = newFormat() + var format = Format() while k < select.selected.len and select.selected[k] < si: inc k for y in sy ..< ey: |