Skip to content

Commit 6896985

Browse files
committed
CMD+DOWN handler
1 parent 818df11 commit 6896985

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

editor-runtime/src/commonMain/kotlin/org/modelix/editor/CaretSelection.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class CaretSelection(val layoutable: LayoutableCell, val start: Int, val end: In
6363
}
6464
KnownKeys.ArrowUp -> {
6565
if (event.modifiers.meta) {
66-
layoutable.cell.let { editor.changeSelection(CellSelection(it)) }
66+
layoutable.cell.let { editor.changeSelection(CellSelection(it, this)) }
6767
} else {
6868
createNextPreviousLineSelection(false, desiredXPosition ?: getAbsoluteX())
6969
?.let { editor.changeSelection(it) }

editor-runtime/src/commonMain/kotlin/org/modelix/editor/NodeSelection.kt renamed to editor-runtime/src/commonMain/kotlin/org/modelix/editor/CellSelection.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@
1313
*/
1414
package org.modelix.editor
1515

16-
import kotlinx.html.TagConsumer
17-
import kotlinx.html.div
18-
import kotlinx.html.span
19-
20-
data class CellSelection(val cell: Cell): Selection() {
16+
data class CellSelection(val cell: Cell, val downSelection: Selection?): Selection() {
2117
fun getEditor(): EditorComponent? = cell.editorComponent
2218

2319
override fun isValid(): Boolean {
@@ -27,7 +23,7 @@ data class CellSelection(val cell: Cell): Selection() {
2723
override fun update(editor: EditorComponent): Selection? {
2824
return cell.data.cellReferences.asSequence()
2925
.flatMap { editor.resolveCell(it) }
30-
.map { CellSelection(it) }
26+
.map { CellSelection(it, downSelection?.update(editor)) }
3127
.firstOrNull()
3228
}
3329

@@ -37,7 +33,12 @@ data class CellSelection(val cell: Cell): Selection() {
3733
KnownKeys.ArrowUp -> {
3834
if (event.modifiers.meta) {
3935
cell.ancestors().firstOrNull { it.getProperty(CommonCellProperties.selectable) }
40-
?.let { editor.changeSelection(CellSelection(it)) }
36+
?.let { editor.changeSelection(CellSelection(it, this)) }
37+
}
38+
}
39+
KnownKeys.ArrowDown -> {
40+
if (event.modifiers.meta && downSelection != null) {
41+
editor.changeSelection(downSelection)
4142
}
4243
}
4344
else -> {}

0 commit comments

Comments
 (0)