Skip to content

Commit

Permalink
Rendered useful
Browse files Browse the repository at this point in the history
  • Loading branch information
StellarWitch7 committed Aug 1, 2024
1 parent 73addf7 commit 26418dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/xd/arkosammy/edtr/view/ViewFinder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ interface ViewFinder {

fun onKeyStroke(keyStroke: KeyStroke)

fun render() : List<TextLine>
fun render(): List<TextLine>
}
12 changes: 11 additions & 1 deletion src/main/kotlin/xd/arkosammy/edtr/view/Workspace.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package xd.arkosammy.edtr.view

import com.googlecode.lanterna.TerminalPosition
import com.googlecode.lanterna.input.KeyStroke
import com.googlecode.lanterna.input.KeyType
import com.googlecode.lanterna.terminal.Terminal
Expand All @@ -24,6 +25,15 @@ class Workspace(override val terminal: Terminal) : ViewContainer<Workspace> {
}

override fun render() {
TODO("Not yet implemented")
focusedViewFinder?.let {
val graphics = terminal.newTextGraphics()
val lines = it.render()

for ((y, line) in lines.withIndex()) {
for ((x, character) in line.textCharacters.withIndex()) {
graphics.setCharacter(TerminalPosition(x, y), character)
}
}
}
}
}

0 comments on commit 26418dd

Please sign in to comment.