Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,7 @@
repositoryURL = "https://github.com/CodeEditApp/CodeEditSourceEditor";
requirement = {
kind = exactVersion;
version = 0.14.0;
version = 0.14.1;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions CodeEdit/Features/Editor/Models/EditorInstance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,15 @@ class EditorInstance: Hashable {
}
return (endTextLine.index - startTextLine.index) + 1
}

func moveLinesUp() {
guard let controller = textViewController else { return }
controller.moveLinesUp()
}

func moveLinesDown() {
guard let controller = textViewController else { return }
controller.moveLinesDown()
}
}
}
1 change: 1 addition & 0 deletions CodeEdit/Features/WindowCommands/CodeEditCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct CodeEditCommands: Commands {
FindCommands()
NavigateCommands()
if sourceControlIsEnabled { SourceControlCommands() }
EditorCommands()
ExtensionCommands()
WindowCommands()
HelpCommands()
Expand Down
33 changes: 33 additions & 0 deletions CodeEdit/Features/WindowCommands/EditorCommands.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// EditorCommands.swift
// CodeEdit
//
// Created by Bogdan Belogurov on 21/05/2025.
//

import SwiftUI
import CodeEditKit

struct EditorCommands: Commands {

@UpdatingWindowController var windowController: CodeEditWindowController?
private var editor: Editor? {
windowController?.workspace?.editorManager?.activeEditor
}

var body: some Commands {
CommandMenu("Editor") {
Menu("Structure") {
Button("Move line up") {
editor?.selectedTab?.rangeTranslator?.moveLinesUp()
}
.keyboardShortcut("[", modifiers: [.command, .option])

Button("Move line down") {
editor?.selectedTab?.rangeTranslator?.moveLinesDown()
}
.keyboardShortcut("]", modifiers: [.command, .option])
}
}
}
}