fix ctrl+down
This commit is contained in:
parent
2452633e32
commit
4323e5872c
|
@ -25,6 +25,7 @@ proc render*(textBuffer: TextBuffer, termBuffer: Buffer, prompt: string, scroll:
|
|||
|
||||
if bufWidth != termWidth or bufHeight != min(lineCount, termHeight):
|
||||
termBuffer.resize(termWidth, min(lineCount, termHeight))
|
||||
|
||||
|
||||
termBuffer.clear()
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import unicode
|
||||
import escapeSequences
|
||||
import sequtils
|
||||
import strformat
|
||||
|
||||
type
|
||||
Buffer* = ref object
|
||||
|
@ -47,7 +48,7 @@ func getCursorPos*(buf: Buffer): (int, int) =
|
|||
|
||||
proc setCursorPos*(buf: Buffer, x, y: int) =
|
||||
if x < 0 or y < 0 or x >= buf.width or y >= buf.height:
|
||||
raise newException(ValueError, "Provided x or y out of bounds for SetCursorPos.")
|
||||
raise newException(ValueError, &"Provided x ({x}) or y ({y}) out of bounds (x: {0}..{buf.width-1}; y: {0}..{buf.height-1}) for SetCursorPos.")
|
||||
buf.bufferX = x
|
||||
buf.bufferY = y
|
||||
|
||||
|
|
|
@ -97,9 +97,9 @@ proc enter*(buf: TextBuffer) =
|
|||
proc newLine*(buf: TextBuffer) =
|
||||
# inserts a new empty line below the current one
|
||||
# and moves cursor to it
|
||||
# TODO fix crash
|
||||
inc buf.cursorY
|
||||
buf.content.insert(@[], buf.cursorY)
|
||||
let empty: seq[Rune] = @[]
|
||||
buf.content.insert(empty, buf.cursorY)
|
||||
buf.cursorX = 0
|
||||
|
||||
proc getLineCount*(buf: TextBuffer): int =
|
||||
|
|
Loading…
Reference in New Issue