The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.
A tab dropped on a pinned tab makes a pinned split in its place, as in Arc (#180)
Victorb2955ba00246
diff --git a/Sources/Cra/Services/SidebarStore.swift b/Sources/Cra/Services/SidebarStore.swiftindex 0ff691e..3e3f292 100644--- a/Sources/Cra/Services/SidebarStore.swift+++ b/Sources/Cra/Services/SidebarStore.swift@@ -897,9 +897,10 @@ final class SidebarStore {}/// Put tabs into a new split, panes in the given order, at the place of- /// `anchorID` (default: the first tab) in the sidebar.+ /// `anchorID` (default: the first tab) in the sidebar. `inPlace` keeps a pinned anchor's split+ /// where the anchor is, with the tabs themselves as panes (a sidebar drop, `combineIntoSplit`).@discardableResult- func createSplit(with tabIDs: [UUID], at anchorID: UUID? = nil) -> SidebarItem? {+ func createSplit(with tabIDs: [UUID], at anchorID: UUID? = nil, inPlace: Bool = false) -> SidebarItem? {let tabs = tabIDs.compactMap { items[$0] }.filter { $0.isTab }guard let first = anchorID.flatMap({ a in tabs.first { $0.id == a } }) ?? tabs.first else { return nil }if let existing = splitContaining(first.id) {@@ -911,7 +912,7 @@ final class SidebarStore {// tab moves into the split at its own slot.var parentID = first.parentID ?? focusedSpace.todayContainerIDvar at = items[parentID]?.children.firstIndex(of: first.id) ?? 0- if isPinned(first.id) {+ if isPinned(first.id), !inPlace {parentID = (spaceID(ofItem: first.id).flatMap { spaces[$0] } ?? focusedSpace).todayContainerIDat = 0}@@ -927,7 +928,7 @@ final class SidebarStore {var anchorPane: UUID?for t in tabs {let paneID: UUID- if isPinned(t.id), let data = t.tab {+ if isPinned(t.id), !inPlace, let data = t.tab {// Keep the pinned tab; the pane is a Today copy of its page.var copy = SidebarItem.tab(data.url, title: data.savedTitle, parent: split.id)copy.data = .tab({ var c = TabData(url: data.url, title: data.savedTitle); c.faviconKey = data.faviconKey; c.activeTabBeforeCreationID = t.id; return c }())@@ -953,6 +954,30 @@ final class SidebarStore {return items[split.id]}+ /// A tab dropped on the middle of another tab's row (Arc: `draggedToCombineSplitCompatibleItems`,+ /// GitHub #191, #180): the two become one split in the target's place, so a drop on a pinned tab+ /// makes a pinned split, inside its folder if it has one. Both tabs move into it, the dropped+ /// one on the side it was dropped; nothing is copied. The dropped tab first moves next to the+ /// target the way any drop there would move it (pinning or unpinning it).+ @discardableResult+ func combineIntoSplit(_ draggedID: UUID, onto targetID: UUID, leading: Bool) -> SidebarItem? {+ guard draggedID != targetID, items[draggedID]?.isTab == true, let target = items[targetID], target.isTab,+ let parentID = target.parentID, items[parentID]?.isSplit == false, !isFavorite(targetID) else {+ return createSplit(with: leading ? [draggedID, targetID] : [targetID, draggedID], at: targetID)+ }+ if items[draggedID]?.parentID != parentID {+ moveItem(draggedID, to: parentID, index: items[parentID]?.children.firstIndex(of: targetID))+ guard items[draggedID]?.parentID == parentID else { return nil }+ }+ guard let split = createSplit(with: leading ? [draggedID, targetID] : [targetID, draggedID], at: targetID, inPlace: true),+ var sd = split.split else { return nil }+ // Arc focuses the dropped tab's pane (the ring and the full toolbar are on it).+ sd.focusTabID = draggedID+ items[split.id]?.data = .split(sd)+ touch()+ return items[split.id]+ }+/// The pane that stands for `tabID` in its split (the tab itself, or the/// Today copy made for a pinned tab).func paneID(for tabID: UUID, in split: SidebarItem) -> UUID? {diff --git a/Sources/Cra/UI/Sidebar/List/SpaceListView.swift b/Sources/Cra/UI/Sidebar/List/SpaceListView.swiftindex 949016c..1ba02a5 100644--- a/Sources/Cra/UI/Sidebar/List/SpaceListView.swift+++ b/Sources/Cra/UI/Sidebar/List/SpaceListView.swift@@ -1002,7 +1002,8 @@ final class SpaceListView: NSView, NSDraggingSource {case .insert(let parent, let index)?:store.moveItems(group, to: parent, index: index)case .split(let tab, let leading)?:- store.createSplit(with: leading ? [id, tab] : [tab, id], at: tab)+ // Arc opens the tab a drag picks up, so the new split ends up open on its pane (#180).+ if store.combineIntoSplit(id, onto: tab, leading: leading) != nil { store.selectTab(id, window: ui.windowID) }case .into(let target)?:if store.item(target)?.isFolder == true {store.moveItems(group, to: target, index: nil)@@ -1027,8 +1028,8 @@ final class SpaceListView: NSView, NSDraggingSource {}/// Top and bottom quarters of a row insert before/after it; the middle combines: a folder- /// takes the item, a Today tab makes a split (the dragged tab goes on the side of the row- /// it hovers), a pinned tab makes a new folder, a split row takes a pane.+ /// takes the item, a tab, pinned or not, makes a split in its place (the dragged tab goes on+ /// the side of the row it hovers), a split row takes a pane.func resolve(dragged id: UUID, at p: CGPoint) -> SidebarListDrop {guard let space = store.space(spaceID) else { return SidebarListDrop(draggedID: id) }let items = rows.filter { $0.itemID != nil }@@ -1050,8 +1051,8 @@ final class SpaceListView: NSView, NSDraggingSource {else if f >= 0.75 { target = store.isExpanded(rid) ? .insert(parent: rid, index: 0) : after }else { target = .into(rid) }} else if middle && isTab && item.isTab {- // Arc combines two tabs into a split wherever the target sits (#191): a pinned- // one stays pinned and the split opens in Today with a copy of it.+ // Arc combines two tabs into a split wherever the target sits (#191), in the+ // target's place: on a pinned tab it is a pinned split (#180).target = .split(with: rid, leading: p.x < r.frame.midX)} else if middle && isTab && item.isSplit {target = .into(rid)diff --git a/Tests/StoreTests.swift b/Tests/StoreTests.swiftindex c5709a1..c421053 100644--- a/Tests/StoreTests.swift+++ b/Tests/StoreTests.swift@@ -1197,28 +1197,46 @@ enum StoreTests {expect(heard == [a.id, a.id], "pinning it again does")}- // promise: #191- /// A tab dropped on a pinned tab makes a split, as on a Today tab (Arc, #191): the pinned tab- /// stays pinned where it was, and the split opens at the top of Today with the dropped tab on- /// the side it was dropped and a copy of the pinned page beside it.+ // promise: #191 #180+ /// A tab dropped on the middle of a pinned tab makes a split, not a folder (#191), in the+ /// pinned tab's place, as Arc 1.172 does (#180, observed live): a Today tab becomes a pinned+ /// split with it, two pinned tabs combine where the target was, inside its folder if it has+ /// one. Both tabs move into the split (no copies), the dropped one on the side it was dropped,+ /// its pane focused.@MainActorprivate static func dropOnPinnedTabSplits() {let store = AppComposition(clock: ManualScheduler()).storelet sid = store.createSpace(title: "Drop", emoji: "🪂").idguard let space = store.space(sid) else { return expect(false, "the space is made") }+ let first = store.createTab(url: "https://example.com/first", title: "First", in: sid, pinned: true, select: false)let pinned = store.createTab(url: "https://example.com/pinned", title: "Pinned", in: sid, pinned: true, select: false)+ let last = store.createTab(url: "https://example.com/last", title: "Last", in: sid, pinned: true, select: false)let older = store.createTab(url: "https://example.com/older", in: sid, select: false)let dragged = store.createTab(url: "https://example.com/dragged", in: sid, select: false)- let pinnedOrder = store.children(of: space.pinnedContainerID).map(\.id)- // What the list does with a drop on the left half of the pinned row: .split(with: pinned, leading: true).- guard let split = store.createSplit(with: [dragged.id, pinned.id], at: pinned.id) else { return expect(false, "the drop makes a split") }- expect(store.isPinned(pinned.id) && store.children(of: space.pinnedContainerID).map(\.id) == pinnedOrder,- "the pinned tab stays pinned, in its place")- expect(store.children(of: space.todayContainerID).map(\.id) == [split.id, older.id], "the split opens at the top of Today")- let panes = store.children(of: split.id)- expect(panes.count == 2 && panes[0].id == dragged.id && panes[1].id != pinned.id- && panes[1].tab?.url == "https://example.com/pinned" && store.paneID(for: pinned.id, in: split) == panes[1].id,- "the dropped tab takes the side it was dropped on, a copy of the pinned page the other")++ // A Today tab on the left half of the pinned row: .split(with: pinned, leading: true).+ guard let split = store.combineIntoSplit(dragged.id, onto: pinned.id, leading: true) else {+ return expect(false, "the drop makes a split")+ }+ expect(store.children(of: space.pinnedContainerID).map(\.id) == [first.id, split.id, last.id],+ "the split is pinned, in the pinned tab's place")+ expect(store.children(of: space.todayContainerID).map(\.id) == [older.id], "the dropped tab left Today; nothing opened there")+ expect(store.children(of: split.id).map(\.id) == [dragged.id, pinned.id],+ "both tabs are the panes, the dropped one on the side it was dropped")+ expect(store.isPinned(dragged.id) && store.item(dragged.id)?.tab?.savedURL == "https://example.com/dragged",+ "the dropped tab is pinned, its page its home")+ expect(store.item(split.id)?.split?.focusTabID == dragged.id, "the dropped tab's pane is focused")++ // Pinned on pinned (the reporter's case), inside a folder, on the right half.+ let folder = store.createFolder(named: "F", in: space.pinnedContainerID)+ let a = store.createTab(url: "https://example.com/a", in: sid, pinned: true, select: false, parent: folder.id)+ let b = store.createTab(url: "https://example.com/b", in: sid, pinned: true, select: false, parent: folder.id)+ guard let inner = store.combineIntoSplit(last.id, onto: b.id, leading: false) else {+ return expect(false, "the second drop makes a split")+ }+ expect(store.children(of: folder.id).map(\.id) == [a.id, inner.id] && store.children(of: inner.id).map(\.id) == [b.id, last.id],+ "two pinned tabs combine in the target's folder, with no new folder and no copy")+ expect(store.children(of: space.pinnedContainerID).map(\.id) == [first.id, split.id, folder.id], "the dropped tab left its slot")expect(store.integrityProblems().isEmpty, "and the sidebar stays sound")}diff --git a/Tests/promises.lock b/Tests/promises.lockindex 8792ee9..19a3469 100644--- a/Tests/promises.lock+++ b/Tests/promises.lock@@ -282,6 +282,7 @@#178 Packages/CraCore/Tests/CraCoreTests/ToolbarExtensionFitTests.swift::pinsGoBeforeRefresh f9abe9cd9c7f#178 Packages/CraCore/Tests/CraCoreTests/ToolbarExtensionFitTests.swift::refreshGoesOnceThePinsAreNotEnough e723177218d9#178 Packages/CraCore/Tests/CraCoreTests/ToolbarExtensionFitTests.swift::theSlidersGoOnlyWhenTheAddressWouldBeSqueezed e8aec2739640+#180 Tests/StoreTests.swift::dropOnPinnedTabSplits e363bbd33fb2#183 Packages/CraCore/Tests/CraCoreTests/LinkMenuTests.swift::defaultSwitchesToTheNewTabLikeArc 169e27801cfa#183 Packages/CraCore/Tests/CraCoreTests/LinkMenuTests.swift::settingIsOffForSettingsWithoutIt 6d661c8bddc5#183 Packages/CraCore/Tests/CraCoreTests/LinkMenuTests.swift::settingOnKeepsThePageInFrontAndOffersTheSwitch 9086830db26d@@ -292,7 +293,7 @@#190 Packages/CraCore/Tests/CraCoreTests/DownloadLocationTests.swift::eachProfileKeepsItsOwn f394f179f5ba#190 Packages/CraCore/Tests/CraCoreTests/DownloadLocationTests.swift::goingBackToTheDefaultDropsTheEntry 96fe0ad9a50b#190 Packages/CraCore/Tests/CraCoreTests/DownloadLocationTests.swift::profilesWithoutAChoiceUseDownloadsWithoutAsking ffef7f30e25f-#191 Tests/StoreTests.swift::dropOnPinnedTabSplits ac72302089d5+#191 Tests/StoreTests.swift::dropOnPinnedTabSplits e363bbd33fb2#195 Packages/CraCore/Tests/CraCoreTests/ActionSearchScopeTests.swift::barOpenersAreLeftOut 1a36c34470fb#195 Packages/CraCore/Tests/CraCoreTests/ActionSearchScopeTests.swift::nothingTypedListsByUseThenMenuOrder 55375f23aad1#195 Packages/CraCore/Tests/CraCoreTests/ActionSearchScopeTests.swift::typedRanksByMatchThenUse 4614e4f53f66diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.mdindex 170c896..edcdacc 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -3304,9 +3304,17 @@ Read from the arm64 slice's Swift field metadata (`__swift5_fieldmd`, case and f- [O metadata] Sidebar drops: `SidebarDropTarget = tabList(…) | appTray`, `SidebarDropTargetRegion = left | right`,`SidebarDropOperation = move | copy`, the window action `draggedToCombineSplitCompatibleItems(…)`. No drop makes afolder: `createFolderFromItems` / `createFolderFromSelection` are the menus' "New Folder with N Items". Cra (#191):- a tab dropped on the middle of any tab row, pinned or Today, offers the split (the pinned tab stays, the split- opens in Today with a copy, `SidebarStore.createSplit`); Cra's own "New Folder" drop on pinned rows is gone.- [?] Not observed live: Arc's drop on a pinned row.+ a tab dropped on the middle of any tab row, pinned or Today, offers the split; Cra's own "New Folder" drop on+ pinned rows is gone.+- [O] Tab-on-tab drops, live (Arc 1.172, offline copy, 7 Nov 2026, discussion #180): the split takes the TARGET's+ place and both tabs move into it, no copies. A Today tab dropped on the left of pinned "pina" made a pinned split+ "todaya | pina" in pina's slot (minus button, gone from Today); pinned "pinb" dropped on the right of Today+ "todayb" made a Today split "todayb | pinb" in todayb's slot (gone from Pinned). The reporter's capture shows+ pinned on pinned the same way. Arc opens the tab a drag picks up, so the split ends up open with the dropped+ tab's pane focused (ring and full toolbar on it). Cra (#180): `SidebarStore.combineIntoSplit` moves the dropped+ tab beside the target (pinning or unpinning it like any drop there), then `createSplit(inPlace:)`; the list+ selects the dropped tab. Other ways into a split (⌥Return, a drop on the page, Add Split View) keep the Today+ copy of a pinned tab observed on 24 Oct.- [O strings/metadata] Settings ▸ Profiles "Download location" is per profile: `DownloadLocationView { store,_selectedTag, _panelOpen }` with tags `arc.folder`, `arc.promptForDownload`, `arc.other` ("Button to confirmselection of directory for file downloads"). [?] The menu's own labels aren't in the strings. Cra (#190):