Skip to content

Commit bf36586

Browse files
committed
update to Mosaic 0.18
1 parent b8d1bab commit bf36586

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ kotlin {
1313
mingwX64 { binaries { executable() } }
1414

1515
sourceSets.commonMain.dependencies {
16-
implementation("com.jakewharton.mosaic:mosaic-runtime:0.16.0")
16+
implementation("com.jakewharton.mosaic:mosaic-runtime:0.18.0")
1717
implementation("org.jetbrains.kotlinx:kotlinx-io-core:0.8.0")
1818
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
1919
}

src/commonMain/kotlin/ui.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import androidx.compose.runtime.getValue
55
import androidx.compose.runtime.mutableIntStateOf
66
import androidx.compose.runtime.remember
77
import androidx.compose.runtime.setValue
8-
import com.jakewharton.mosaic.LocalTerminal
8+
import com.jakewharton.mosaic.LocalTerminalState
99
import com.jakewharton.mosaic.layout.background
10+
import com.jakewharton.mosaic.layout.fillMaxSize
1011
import com.jakewharton.mosaic.layout.fillMaxWidth
1112
import com.jakewharton.mosaic.layout.height
1213
import com.jakewharton.mosaic.layout.onKeyEvent
@@ -21,11 +22,11 @@ import com.jakewharton.mosaic.ui.TextStyle
2122

2223
@Composable
2324
fun App(viewModel: ViewModel) {
24-
val terminal = LocalTerminal.current
25+
val terminal = LocalTerminalState.current
2526
val selectedLine by viewModel.selectedLine.collectAsState()
2627
val content by viewModel.content.collectAsState()
2728
// subtraction of one is necessary, because there is a line with a cursor at the bottom, which moves up all the content
28-
val height = terminal.size.height - 1
29+
val height = terminal.size.rows - 1
2930
var offset by remember { mutableIntStateOf(0) }
3031
LaunchedEffect(selectedLine.first) {
3132
if (selectedLine.first < offset) {
@@ -40,7 +41,7 @@ fun App(viewModel: ViewModel) {
4041

4142
Box(
4243
Modifier
43-
.width(terminal.size.width)
44+
.width(terminal.size.columns)
4445
.height(height)
4546
.onKeyEvent { event -> viewModel.onKeyEvent(event) }
4647
) {

0 commit comments

Comments
 (0)