Skip to content
This repository was archived by the owner on Nov 7, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/core-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: VisuStructCore tests
name: CI

on:
push:
Expand All @@ -17,3 +17,17 @@ jobs:
run: swift --version
- name: Build and test
run: swift test

app-build:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Xcode version
run: xcodebuild -version
- name: Build app for iOS Simulator
run: |
xcodebuild build \
-project VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct.xcodeproj \
-scheme VisuStruct \
-destination 'generic/platform=iOS Simulator' \
CODE_SIGNING_ALLOWED=NO
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,9 @@ struct ContentView: View {
tabs[i].lineEditorText = el.textLines.joined(separator: "\n")
tabsModel.tabs = tabs

if !isPhone, focusedField == nil, el.type != .forSchleife {
if DiagramInspectorAutoFocus.shouldFocusOnSelection,
focusedField == nil,
el.type != .forSchleife {
focusedField = .textEditor
editorFocusToken = UUID()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ private struct CodeLineEditorUIKit: UIViewRepresentable {
tv.commitOnReturn = commitOnReturn
tv.onCommit = onCommit
tv.delegate = context.coordinator
// Beim Erzeugen nicht fokussieren: Nur ein späterer Token-Wechsel holt die Tastatur.
context.coordinator.lastFocusToken = focusToken
return tv
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import SwiftUI
#if canImport(GameController)
import GameController
#endif
#if canImport(UIKit)
import UIKit
#endif

/// Gemeinsame Fokus-Markierung für Diagrammtitel, Inspector-Felder und Zeileneditor.
enum DiagramEditorFocusTarget: Hashable {
Expand All @@ -8,3 +14,32 @@ enum DiagramEditorFocusTarget: Hashable {
/// Zählschleife: drei Kopf-Felder (Start / Bedingung / Schritt).
case forLoopPart(Int)
}

/// Ob der Inspector nach einer Zeilenauswahl automatisch den Cursor bekommt.
///
/// Auf dem iPhone nie (zu wenig Platz). Auf dem Mac (Designed for iPad) immer.
/// Auf dem iPad nur, wenn eine Hardware-Tastatur verbunden ist — sonst würde die
/// Software-Tastatur das Diagramm verdecken.
enum DiagramInspectorAutoFocus {
static var shouldFocusOnSelection: Bool {
if ProcessInfo.processInfo.isiOSAppOnMac {
return true
}
#if canImport(UIKit)
switch UIDevice.current.userInterfaceIdiom {
case .phone:
return false
case .pad:
#if canImport(GameController)
return GCKeyboard.coalesced != nil
#else
return false
#endif
default:
return false
}
#else
return false
#endif
}
}
Loading