Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

keyboard shortcut for tab switching#1677

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
austincondiff merged 3 commits intoCodeEditApp:mainfromknotbin:main
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from2 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
4 changes: 4 additions & 0 deletionsCodeEdit.xcodeproj/project.pbxproj
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -248,6 +248,7 @@
58F2EB1E292FB954004A9BDE /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 58F2EB1D292FB954004A9BDE /* Sparkle */; };
58FD7608291EA1CB0051D6E4 /* QuickActionsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58FD7605291EA1CB0051D6E4 /* QuickActionsViewModel.swift */; };
58FD7609291EA1CB0051D6E4 /* QuickActionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58FD7607291EA1CB0051D6E4 /* QuickActionsView.swift */; };
5994B6DA2BD6B408006A4C5F /* EditorTabSwitchExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5994B6D92BD6B408006A4C5F /* EditorTabSwitchExtension.swift */; };
5B241BF32B6DDBFF0016E616 /* IgnorePatternListItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B241BF22B6DDBFF0016E616 /* IgnorePatternListItemView.swift */; };
5B698A0A2B262FA000DE9392 /* SearchSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B698A092B262FA000DE9392 /* SearchSettingsView.swift */; };
5B698A0D2B26327800DE9392 /* SearchSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B698A0C2B26327800DE9392 /* SearchSettings.swift */; };
Expand DownExpand Up@@ -810,6 +811,7 @@
58F2EAE1292FB2B0004A9BDE /* SoftwareUpdater.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SoftwareUpdater.swift; sourceTree = "<group>"; };
58FD7605291EA1CB0051D6E4 /* QuickActionsViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuickActionsViewModel.swift; sourceTree = "<group>"; };
58FD7607291EA1CB0051D6E4 /* QuickActionsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuickActionsView.swift; sourceTree = "<group>"; };
5994B6D92BD6B408006A4C5F /* EditorTabSwitchExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditorTabSwitchExtension.swift; sourceTree = "<group>"; };
5B241BF22B6DDBFF0016E616 /* IgnorePatternListItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IgnorePatternListItemView.swift; sourceTree = "<group>"; };
5B698A092B262FA000DE9392 /* SearchSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchSettingsView.swift; sourceTree = "<group>"; };
5B698A0C2B26327800DE9392 /* SearchSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchSettings.swift; sourceTree = "<group>"; };
Expand DownExpand Up@@ -2752,6 +2754,7 @@
6CA1AE942B46950000378EAB /* EditorInstance.swift */,
6CC9E4B129B5669900C97388 /* Environment+ActiveEditor.swift */,
6C092ED92A53A58600489202 /* EditorLayout+StateRestoration.swift */,
5994B6D92BD6B408006A4C5F /* EditorTabSwitchExtension.swift */,
);
path = Models;
sourceTree = "<group>";
Expand DownExpand Up@@ -3475,6 +3478,7 @@
581550CF29FBD30400684881 /* StandardTableViewCell.swift in Sources */,
B62AEDB82A1FE2DC009A9F52 /* UtilityAreaOutputView.swift in Sources */,
B67DB0FC2AFDF71F002DC647 /* IconToggleStyle.swift in Sources */,
5994B6DA2BD6B408006A4C5F /* EditorTabSwitchExtension.swift in Sources */,
587B9E5C29301D8F00AC7927 /* Parameters.swift in Sources */,
61538B932B11201900A88846 /* String+Character.swift in Sources */,
613DF55E2B08DD5D00E9D902 /* FileHelper.swift in Sources */,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
//
// EditorTabSwitchExtension.swift
// CodeEdit
//
// Created by Roscoe Rubin-Rottenberg on 4/22/24.
//

import Foundation

extension Editor {
func selectNextTab() {
guard let currentTab = selectedTab, let currentIndex = tabs.firstIndex(of: currentTab) else { return }
let nextIndex = tabs.index(after: currentIndex)
if nextIndex < tabs.endIndex {
selectedTab = tabs[nextIndex]
} else {
// Wrap around to the first tab if it's the last one
selectedTab = tabs.first
}
}

func selectPreviousTab() {
guard let currentTab = selectedTab, let currentIndex = tabs.firstIndex(of: currentTab) else { return }
let previousIndex = tabs.index(before: currentIndex)
if previousIndex >= tabs.startIndex {
selectedTab = tabs[previousIndex]
} else {
// Wrap around to the last tab if it's the first one
selectedTab = tabs.last
}
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,6 +114,8 @@ struct EditorTabs: View {
CGFloat(140)
)
}



// Disable the rule because this function is implementing the drag gesture and its animations.
// It is fairly complicated, so ignore the function body length limitation for now.
Expand Down
15 changes: 9 additions & 6 deletionsCodeEdit/Features/WindowCommands/NavigateCommands.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,18 +39,20 @@ struct NavigateCommands: Commands {
Divider()

}

Group {
Button("Show Previous Tab") {

editor?.selectPreviousTab()
}
.disabled(true)
.keyboardShortcut("{", modifiers: [.command])
.disabled(editor?.tabs.count ?? 0 <= 1) // Disable if there's one or no tabs

Button("Show Next Tab") {

editor?.selectNextTab()
}
.disabled(true)

.keyboardShortcut("}", modifiers: [.command])
.disabled(editor?.tabs.count ?? 0 <= 1) // Disable if there's one or no tabs
}
Group {
Divider()

Button("Go Forward") {
Expand All@@ -62,6 +64,7 @@ struct NavigateCommands: Commands {
editor?.goBackInHistory()
}
.disabled(!(editor?.canGoBackInHistory ?? false))

}
.disabled(editor == nil)
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp