Removed code duplication in terminalWriteChar.
This commit is contained in:
parent
af091674a6
commit
e0c0d8cfa3
@ -43,19 +43,20 @@ proc setTerminalColour(newColour: int) =
|
|||||||
terminalColour = newColour
|
terminalColour = newColour
|
||||||
|
|
||||||
proc terminalWriteChar(writeChar: char) =
|
proc terminalWriteChar(writeChar: char) =
|
||||||
if(writeChar == '\L'):
|
|
||||||
|
proc scrollCheckAndSet() =
|
||||||
if(terminalRow < vgaHeight - 1): inc(terminalRow)
|
if(terminalRow < vgaHeight - 1): inc(terminalRow)
|
||||||
else: # If we are at the bottom of the screen then scroll the screen.
|
else: # If we are at the bottom of the screen then scroll the screen.
|
||||||
terminalScroll()
|
terminalScroll()
|
||||||
terminalColumn = 0
|
terminalColumn = 0
|
||||||
|
|
||||||
|
if(writeChar == '\L'):
|
||||||
|
scrollCheckAndSet()
|
||||||
return
|
return
|
||||||
terminalWriteAtPoint(writeChar, terminalColour, terminalColumn, terminalRow)
|
terminalWriteAtPoint(writeChar, terminalColour, terminalColumn, terminalRow)
|
||||||
inc(terminalColumn)
|
inc(terminalColumn)
|
||||||
if(terminalColumn == vgaWidth):
|
if(terminalColumn == vgaWidth):
|
||||||
terminalColumn = 0
|
scrollCheckAndSet()
|
||||||
if(terminalRow < vgaHeight - 1): inc(terminalRow)
|
|
||||||
else: # If we are at the bottom of the screen then scroll the screen.
|
|
||||||
terminalScroll()
|
|
||||||
|
|
||||||
proc terminalWrite*(data: string) =
|
proc terminalWrite*(data: string) =
|
||||||
for character in data:
|
for character in data:
|
||||||
|
Loading…
Reference in New Issue
Block a user