-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Keyboard shortcut to switch sidebar navigator tabs #1382
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
f2d2e29
Fixed close tab and close window shortcut
FastestMolasses 210884b
Replace .hidden modifier with .opacity modifier
FastestMolasses 518c4ab
Fixed tab switching shortcuts not working
FastestMolasses 3e07428
Undo changes
FastestMolasses 3ac4741
Fixed the close button not being able to be pressed
FastestMolasses 3cb05fb
Merge branch 'main'
FastestMolasses 989ecb2
Update keyboard shortcuts to switch between sidebar navigator items
FastestMolasses 85e31a7
Remove old shortcut
FastestMolasses 395e922
Remove old code
FastestMolasses 3a042b8
Small refactor
FastestMolasses d9f514e
New drag gestures, refactors
FastestMolasses 2e7379e
Merge remote-tracking branch 'origin' into switch-tabs
FastestMolasses b2f5634
Cleanup and added comments
FastestMolasses e728a7b
Merge main
FastestMolasses ecb34c6
Removed file
FastestMolasses 02703c0
Fixed variable bindings
FastestMolasses e13e2d0
Added ObservedObject to NavigatorSidebarViewModel
FastestMolasses 89395a9
Limit index shortcuts to 9
FastestMolasses 72a7184
Refactors
FastestMolasses 2612387
Refactored swapping code
FastestMolasses b250c2f
Merge branch 'main' into switch-tabs
FastestMolasses 5ddc478
Fixed variable that wasnt renamed
FastestMolasses 8a7815b
Lint fixes
FastestMolasses 40f6356
Remove comment
FastestMolasses File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// | ||
// ListTable.swift | ||
// CodeEdit | ||
// | ||
// Created by Abe Malla on 8/26/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct Item: Identifiable { | ||
let id = UUID() | ||
var name: String | ||
} | ||
|
||
struct ContentView: View { | ||
@State private var items = [Item]() | ||
@State private var showingModal = false | ||
@State private var selection: Item.ID? | ||
|
||
var body: some View { | ||
VStack { | ||
Table(items, selection: $selection) { | ||
TableColumn("Items", value: \.name) | ||
} | ||
} | ||
.paneToolbar { | ||
HStack(spacing: 2) { | ||
Button { | ||
showingModal = true | ||
} label: { | ||
Image(systemName: "plus") | ||
} | ||
|
||
Divider() | ||
.frame(minHeight: 15) | ||
|
||
Button { | ||
removeItem() | ||
} label: { | ||
Image(systemName: "minus") | ||
} | ||
.disabled(selection == nil) | ||
.opacity(selection == nil ? 0.5 : 1) | ||
} | ||
Spacer() | ||
} | ||
.sheet(isPresented: $showingModal) { | ||
NewItemView { text in | ||
items.append(Item(name: text)) | ||
showingModal = false | ||
} | ||
} | ||
.cornerRadius(6) | ||
} | ||
|
||
private func removeItem() { | ||
if let selectedId = selection { | ||
items.removeAll(where: { $0.id == selectedId }) | ||
selection = nil | ||
} | ||
} | ||
} | ||
|
||
struct NewItemView: View { | ||
@State private var text = "" | ||
var completion: (String) -> Void | ||
|
||
var body: some View { | ||
VStack { | ||
Text("Enter new item name") | ||
TextField("Name", text: $text) | ||
.textFieldStyle(.roundedBorder) | ||
Button("Add") { | ||
if !text.isEmpty { | ||
completion(text) | ||
} | ||
} | ||
} | ||
.padding() | ||
} | ||
} | ||
|
||
struct ContentView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ContentView() | ||
.environmentObject(DebugAreaTabViewModel()) | ||
} | ||
} |
You are viewing a condensed version of this merge commit. You can view the full changes here.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.