diff --git a/lua/winmove/init.lua b/lua/winmove/init.lua index 7b4a03b..556a266 100644 --- a/lua/winmove/init.lua +++ b/lua/winmove/init.lua @@ -308,7 +308,8 @@ local function split_into(win_id, dir) ---@diagnostic disable-next-line:param-type-mismatch if layout.are_siblings(win_id, target_win_id) then ---@diagnostic disable-next-line:param-type-mismatch - local reldir = layout.get_sibling_relative_dir(win_id, target_win_id, dir) + local reldir = + layout.get_sibling_relative_dir(win_id, target_win_id, dir, winmove.current_mode()) split_options.vertical = not split_options.vertical split_options.rightbelow = reldir == "l" or reldir == "j" diff --git a/lua/winmove/layout.lua b/lua/winmove/layout.lua index 8fb6092..c6146af 100644 --- a/lua/winmove/layout.lua +++ b/lua/winmove/layout.lua @@ -1,7 +1,7 @@ local layout = {} local winutil = require("winmove.winutil") -local Mode = require("winmove.mode") +local Mode = require("winmove.mode").Mode ---@class winmove.BoundingBox ---@field top integer @@ -128,6 +128,8 @@ function layout.are_siblings(win_id1, win_id2) end end end + + return false end return _are_siblings(win_layout, nil, win_id1) diff --git a/tests/relative_cursor_spec.lua b/tests/relative_cursor_spec.lua index 11aada5..d4bfa68 100644 --- a/tests/relative_cursor_spec.lua +++ b/tests/relative_cursor_spec.lua @@ -35,7 +35,8 @@ describe("relative cursor", function() }) vim.api.nvim_set_current_win(main_win_id) - winmove.move_window(main_win_id, "l") + winmove.start_mode(winmove.Mode.Move) + vim.cmd.normal("l") assert.matches_winlayout(vim.fn.winlayout(), { "row", @@ -80,7 +81,8 @@ describe("relative cursor", function() }) vim.api.nvim_set_current_win(main_win_id) - winmove.move_window(main_win_id, "l") + winmove.start_mode(winmove.Mode.Move) + vim.cmd.normal("l") assert.matches_winlayout(vim.fn.winlayout(), { "row", @@ -132,7 +134,8 @@ describe("relative cursor", function() }) vim.api.nvim_set_current_win(main_win_id) - winmove.move_window(main_win_id, "l") + winmove.start_mode(winmove.Mode.Move) + vim.cmd.normal("l") assert.matches_winlayout(vim.fn.winlayout(), { "row", @@ -206,7 +209,8 @@ describe("relative cursor", function() local long_line = ("x"):rep(width * 0.75) vim.api.nvim_buf_set_lines(buffer, 0, 1, true, { long_line }) - winmove.move_window(win_id, "k") + winmove.start_mode(winmove.Mode.Move) + vim.cmd.normal("k") assert.matches_winlayout(vim.fn.winlayout(), { "row",