Repository navigation
iOS: add pane-grouped deck and Safari-style pane map #8188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 79 commits
b6b780e
c76eb70
27db84d
bb707a7
2d28715
ce3e3a6
ba4b648
29e9f20
0891f8b
881f34d
8c26fef
03bf449
305e785
b3c7741
f441a45
b33638d
51d30bf
bdddcf2
75fc3a3
bd307f6
8e3613f
682fe04
afe4c04
f4dbc09
fe5da35
d7ea14b
3b2a8e1
bc666eb
35934fc
d85a567
7488cf0
a37d8b3
28f14d6
24a2c49
c0a6fae
e50db56
aad1eff
92792d4
1b739ac
24985d8
bb34705
f074baa
b887b36
2677ab8
387dda4
69ae8a5
2892256
b62c281
9502fdc
bec4e06
ee9eca7
f5293f7
2e156bb
0584137
86f10d0
6c2d150
5562acf
d129f58
4811f75
53b92bf
dff67f9
70a69a9
58f0bcb
e844e98
cac569f
5cc12c6
3185cdb
6545e29
3217729
77e66b5
7e64b92
7cbecf3
5dbefae
f637c36
719ec2c
4cdd8eb
1a3ffce
b38947c
afb4b6c
61c2901
bb81ab3
2d0fc11
00bf152
7386aa1
51bf1ab
5536a50
b27745f
38a06df
059ed21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,6 +104,8 @@ public struct WorkspaceSyncRecord: MobileSyncRecord { | |
| public let sortIndex: Int | ||
| /// Terminal rows belonging to this workspace, in spatial order. | ||
| public let terminals: [Terminal] | ||
| /// The workspace's complete pane layout, when the Mac supports pane sync. | ||
| public let layout: MobileWorkspaceLayout? | ||
|
|
||
| /// ``MobileSyncRecord`` identity: the workspace id. | ||
| public var syncID: String { id } | ||
|
|
@@ -127,7 +129,8 @@ public struct WorkspaceSyncRecord: MobileSyncRecord { | |
| lastActivityAt: Double, | ||
| hasUnread: Bool, | ||
| sortIndex: Int, | ||
| terminals: [Terminal] | ||
| terminals: [Terminal], | ||
| layout: MobileWorkspaceLayout? = nil | ||
| ) { | ||
| self.id = id | ||
| self.windowID = windowID | ||
|
|
@@ -145,6 +148,7 @@ public struct WorkspaceSyncRecord: MobileSyncRecord { | |
| self.hasUnread = hasUnread | ||
| self.sortIndex = sortIndex | ||
| self.terminals = terminals | ||
| self.layout = layout | ||
| } | ||
|
|
||
| public init(from decoder: any Decoder) throws { | ||
|
|
@@ -168,6 +172,7 @@ public struct WorkspaceSyncRecord: MobileSyncRecord { | |
| hasUnread = try container.decode(Bool.self, forKey: .hasUnread) | ||
| sortIndex = try container.decode(Int.self, forKey: .sortIndex) | ||
| terminals = try container.decode([Terminal].self, forKey: .terminals) | ||
| layout = try container.decodeIfPresent(MobileWorkspaceLayout.self, forKey: .layout) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sync layout decode fails closedMedium Severity
Additional Locations (1)Reviewed by Cursor Bugbot for commit afb4b6c. Configure here. |
||
| } | ||
|
|
||
| private enum CodingKeys: String, CodingKey { | ||
|
|
@@ -187,6 +192,7 @@ public struct WorkspaceSyncRecord: MobileSyncRecord { | |
| case hasUnread = "has_unread" | ||
| case sortIndex = "sort_index" | ||
| case terminals | ||
| case layout | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -28,6 +28,61 @@ extension MobileTerminalRenderGridFrame.RowSpan { | |||||
| var gridCellWidth: Int { | ||||||
| cellWidth ?? max(1, text.renderGridEstimatedCellWidth) | ||||||
| } | ||||||
|
|
||||||
| /// Resolves each grapheme to the producer-reported width of this span. | ||||||
| /// | ||||||
| /// Unicode's ambiguous-width characters can occupy one or two terminal | ||||||
| /// cells depending on the producer. The aggregate ``cellWidth`` is the | ||||||
| /// authority; this method distributes that width only when the mapping is | ||||||
| /// unambiguous enough to preserve every grapheme's producer column. | ||||||
| var resolvedCharacterCellWidths: [Int]? { | ||||||
| guard !text.isEmpty, gridCellWidth > 0 else { return nil } | ||||||
| var widths: [Int] = [] | ||||||
| var expandable: [Bool] = [] | ||||||
| var hasUntrustedExpansionCandidate = false | ||||||
| widths.reserveCapacity(text.count) | ||||||
| expandable.reserveCapacity(text.count) | ||||||
| for character in text { | ||||||
| let width = character.renderGridEstimatedCellWidth | ||||||
| let canExpand = character.canExpandForAmbiguousRenderGridWidth | ||||||
| widths.append(width) | ||||||
| expandable.append(canExpand) | ||||||
| if width == 1, | ||||||
| !canExpand, | ||||||
| character.unicodeScalars.contains(where: { | ||||||
| $0.value > 0x7F | ||||||
| && !$0.isRenderGridZeroWidthScalar | ||||||
| }) { | ||||||
| hasUntrustedExpansionCandidate = true | ||||||
| } | ||||||
| } | ||||||
| let total = widths.reduce(0, +) | ||||||
| if total < gridCellWidth { | ||||||
| guard !hasUntrustedExpansionCandidate else { | ||||||
| return nil | ||||||
| } | ||||||
| let expansionCandidates = widths.indices.filter { | ||||||
| widths[$0] < 2 && expandable[$0] | ||||||
| } | ||||||
| let remaining = gridCellWidth - total | ||||||
| guard remaining == expansionCandidates.count else { | ||||||
| return nil | ||||||
| } | ||||||
| for index in expansionCandidates { | ||||||
| widths[index] += 1 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Mixed ambiguous-width spans can be replayed in the wrong producer columns. Aggregate Prompt for AI agentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Mixed ambiguous-width text can be pinned to the wrong columns: an aggregate width of 3 for Prompt for AI agents |
||||||
| } | ||||||
| } else if total > gridCellWidth { | ||||||
| let contractionCandidates = widths.indices.filter { widths[$0] > 1 } | ||||||
| let excess = total - gridCellWidth | ||||||
| guard excess == contractionCandidates.count else { | ||||||
| return nil | ||||||
| } | ||||||
| for index in contractionCandidates { | ||||||
| widths[index] -= 1 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Spans whose reported width is narrower than multiple wide graphemes can be assigned to incorrect columns. The aggregate does not identify which wide grapheme was narrow, so only resolve a unique reduction or fall back instead of choosing from the end. Prompt for AI agents |
||||||
| } | ||||||
| } | ||||||
| return widths | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Leading zero-width scalars disappear from pane-map previews. Return Prompt for AI agents
Suggested change
|
||||||
| } | ||||||
| } | ||||||
|
|
||||||
| extension Character { | ||||||
|
|
||||||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: A malformed or newer layout makes the entire workspace record/delta fail to decode instead of retaining its normal workspace data. Isolate this optional capability field so clients fall back to
nillayout, matching the legacy workspace response behavior.Prompt for AI agents