diff options
-rw-r--r-- | src/local/container.nim | 15 | ||||
-rw-r--r-- | src/local/pager.nim | 10 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/local/container.nim b/src/local/container.nim index e22f0f4e..81f5ffb0 100644 --- a/src/local/container.nim +++ b/src/local/container.nim @@ -468,12 +468,16 @@ proc drawSelect*(select: Select; display: var FixedGrid) = while j < select.options[i].len: let pj = j let u = select.options[i].nextUTF8(j) - let ox = x - x += u.twidth(x) - if x > ex: + let nx = x + u.twidth(x) + if nx > ex: break - display[dls + ox].str = select.options[i].substr(pj, j - 1) - display[dls + ox].format = format + display[dls + x].str = select.options[i].substr(pj, j - 1) + display[dls + x].format = format + inc x + while x < nx: + display[dls + x].str = "" + display[dls + x].format = format + inc x while x < ex: display[dls + x].str = " " display[dls + x].format = format @@ -774,6 +778,7 @@ proc setNumLines(container: Container; lines: int; finish = false) = if container.startpos.isSome and finish: container.pos = container.startpos.get container.startpos = none(CursorPosition) + container.needslines = true container.updateCursor() proc queueDraw*(container: Container) = diff --git a/src/local/pager.nim b/src/local/pager.nim index 31d21b6e..3e0c21a0 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -404,12 +404,16 @@ proc writeStatusMessage(pager: Pager; str: string; format = Format(); pager.status.grid[x].str = u.toUTF8() pager.status.grid[x].format = format lx = x - x += w + let nx = x + w + inc x + while x < nx: # clear unset cells + pager.status.grid[x].str = "" + pager.status.grid[x].format = Format() + inc x result = x - var def = Format() while x < e: pager.status.grid[x].str = "" - pager.status.grid[x].format = def + pager.status.grid[x].format = Format() inc x # Note: should only be called directly after user interaction. |