Skip to content

Commit

Permalink
feat: dont open result buffer automatically when opening Curl tab, wa…
Browse files Browse the repository at this point in the history
…it for execution instead

this is more inline with other plugins
  • Loading branch information
oysandvik94 committed Aug 26, 2024
1 parent 4576324 commit b826067
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
4 changes: 0 additions & 4 deletions lua/curl/buffers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ local function open_or_goto_curl_tab()
end

local open_command_buffer = function(command_file)
close_curl_buffer(COMMAND_BUF_ID, false)
vim.cmd.edit(command_file)
local new_bufnr = vim.fn.bufnr(command_file, false)
local new_win = vim.api.nvim_get_current_win()
Expand Down Expand Up @@ -105,9 +104,6 @@ M.setup_curl_tab_for_file = function(filename)

local new_buf_id, current_win = open_command_buffer(filename)
COMMAND_BUF_ID = new_buf_id

close_curl_buffer(OUTPUT_BUF_ID, false)
open_result_buffer(current_win)
end

M.close_curl_tab = function(force)
Expand Down
11 changes: 1 addition & 10 deletions tests/buffers/buffer_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@ describe("Api", function()

local tab = vim.api.nvim_get_current_tabpage()
local windows = vim.api.nvim_tabpage_list_wins(tab)
assert(#windows == 2, "Tab should open with two buffers")
assert(#windows == 1, "Tab should open with one buffer")

local left_buffer = vim.api.nvim_win_get_buf(windows[1])
assert(left_buffer > 0, "Name for left buffer was not set")

local right_buffer = vim.api.nvim_win_get_buf(windows[2])
assert(right_buffer > 0, "Name for right buffer was not set")
end)

it("should not open multiple tabs", function()
Expand Down Expand Up @@ -119,16 +116,10 @@ describe("Buffer", function()
api.open_global_tab()
local third_buf_id = COMMAND_BUF_ID
assert(second_buf_id ~= third_buf_id, "Buffer should change")
assert(vim.tbl_contains(vim.api.nvim_list_bufs(), second_buf_id) == false, "cwd buffer should be closed")

test_util.assert_equals(post_buf_count, #vim.api.nvim_list_bufs(), "should replace after opening global")

api.open_scoped_collection("test")
local fourth_buf_id = COMMAND_BUF_ID
assert(third_buf_id ~= fourth_buf_id, "Buffer should change")
assert(vim.tbl_contains(vim.api.nvim_list_bufs(), third_buf_id) == false, "global buffer should be closed")

test_util.assert_equals(post_buf_count, #vim.api.nvim_list_bufs(), "should replace after opening scoped")

local tabs = vim.api.nvim_list_tabpages()
test_util.assert_equals(#inital_tabs + 1, #tabs, "Should only have opened one extra tab")
Expand Down

0 comments on commit b826067

Please sign in to comment.