Skip to content
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

Rename goto_split top/bottom directions to up/down. #3427

Merged
merged 3 commits into from
Jan 2, 2025

Conversation

dpatterbee
Copy link
Contributor

Renames the top/bottom directions of goto_split to up/down. I have tested this on linux (nixos) but given that goto_split is broken on linux anyway (#2866) there's not a whole lot to test.

I have no way to build on macOS so I can't verify that I've changed everything correctly for that.

Closes #3237

@dpatterbee dpatterbee force-pushed the rename-goto_split-directions branch from b1ad8f4 to 22fb12c Compare December 27, 2024 16:07
@dpatterbee dpatterbee force-pushed the rename-goto_split-directions branch from 22fb12c to 8cbf8d5 Compare December 27, 2024 16:16
@dpatterbee dpatterbee marked this pull request as ready for review December 27, 2024 18:05
@mitchellh
Copy link
Contributor

Thanks this looks good but I'm a bit worried now that we're released about backwards compatibility. Let me think about that.

@dpatterbee
Copy link
Contributor Author

Here's a small patch which would retain "top" and "bottom" as aliases of the new "up" and "down" directions if that's the direction you'd like to go. I agree that breaking backwards compatibility 2 days post-launch is probably not ideal.

diff --git a/src/Surface.zig b/src/Surface.zig
index 1442af86..b4e9e593 100644
--- a/src/Surface.zig
+++ b/src/Surface.zig
@@ -4046,6 +4046,8 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
             .{ .surface = self },
             .goto_split,
             switch (direction) {
+                .top => apprt.action.GotoSplit.up,
+                .bottom => apprt.action.GotoSplit.down,
                 inline else => |tag| @field(
                     apprt.action.GotoSplit,
                     @tagName(tag),
diff --git a/src/input/Binding.zig b/src/input/Binding.zig
index f8cc71d0..1c318852 100644
--- a/src/input/Binding.zig
+++ b/src/input/Binding.zig
@@ -473,6 +473,11 @@ pub const Action = union(enum) {
         left,
         down,
         right,
+
+        // For backwards compatilbility purposes we also support "top" and "bottom" as aliases for
+        // "up" and "down"
+        top,
+        bottom,
     };
 
     pub const SplitResizeDirection = enum {

@mitchellh
Copy link
Contributor

Thanks. It might be easier to actually implement a custom parseCLI function for this enum and translate the old values to the new values. That would clean up everything else. If you do this I will merge.

Please add tests for that as well.

Thank you!

@mitchellh mitchellh merged commit 9503c9f into ghostty-org:main Jan 2, 2025
21 checks passed
@mitchellh
Copy link
Contributor

Fantastic. Thank you!

@github-actions github-actions bot added this to the 1.0.2 milestone Jan 2, 2025
@gigamonster256
Copy link
Contributor

Documentation for goto_split was just added in #4388 which is out of date as of this being merged (assuming new names should be in the documentation instead of legacy top/bottom)

gigamonster256 added a commit to gigamonster256/ghostty that referenced this pull request Jan 3, 2025
In ghostty-org#4388, documentation was added for goto_split but in ghostty-org#3427 this
documentation was made outdated but not updated. This makes the
documentation up to date and brings the ordering in line with new_split
mitchellh added a commit that referenced this pull request Jan 3, 2025
In #4388, documentation was added for goto_split but in #3427 this
documentation was made outdated but not updated. This makes the
documentation up to date and brings the ordering in line with new_split
@dpatterbee dpatterbee deleted the rename-goto_split-directions branch January 24, 2025 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keybinds: Inconsistent Direction Parameters for new_split and goto_split
3 participants