Skip to content
Open
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
1 change: 1 addition & 0 deletions lua/codediff/ui/explorer/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function M.create(status_result, git_root, tabpage, width, base_revision, target
wrap = false,
signcolumn = "no",
foldcolumn = "0",
statuscolumn = "",
spell = false,
winfixwidth = true,
winfixheight = true,
Expand Down
1 change: 1 addition & 0 deletions lua/codediff/ui/history/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function M.create(commits, git_root, tabpage, width, opts)
wrap = false,
signcolumn = "no",
foldcolumn = "0",
statuscolumn = "",
spell = false,
},
})
Expand Down
8 changes: 8 additions & 0 deletions tests/ui/explorer/explorer_window_layout_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ h.ensure_plugin_loaded()

describe("Explorer window layout", function()
local repo
local original_statuscolumn

before_each(function()
original_statuscolumn = vim.o.statuscolumn
vim.o.statuscolumn = "%s%=%l %C "
require("codediff").setup({})
repo = h.create_temp_git_repo()
repo.write_file("file1.txt", { "line 1", "line 2" })
Expand All @@ -21,6 +24,7 @@ describe("Explorer window layout", function()
end)

after_each(function()
vim.o.statuscolumn = original_statuscolumn
h.close_extra_tabs()
if repo then
repo.cleanup()
Expand All @@ -34,6 +38,10 @@ describe("Explorer window layout", function()

local explorer_win = h.find_window_by_filetype("codediff-explorer")
assert.is_not_nil(explorer_win, "explorer window not found")
assert.equal("", vim.wo[explorer_win].statuscolumn,
"explorer should not inherit the user's status column")
assert.equal(0, vim.fn.getwininfo(explorer_win)[1].textoff,
"explorer rows should use the full window width")

local wins = vim.api.nvim_tabpage_list_wins(0)
assert.is_true(#wins >= 3, "expected at least 3 windows (explorer + 2 diff panes), got " .. #wins)
Expand Down
8 changes: 8 additions & 0 deletions tests/ui/history/history_layout_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ h.ensure_plugin_loaded()

describe("History layout", function()
local repo
local original_statuscolumn

before_each(function()
original_statuscolumn = vim.o.statuscolumn
vim.o.statuscolumn = "%s%=%l %C "
require("codediff").setup({})
repo = h.create_temp_git_repo()
repo.write_file("file.txt", { "version 1" })
Expand All @@ -22,6 +25,7 @@ describe("History layout", function()
end)

after_each(function()
vim.o.statuscolumn = original_statuscolumn
h.close_extra_tabs()
if repo then
repo.cleanup()
Expand All @@ -40,6 +44,10 @@ describe("History layout", function()
local history_win, history_buf = h.find_window_by_filetype("codediff-history")
assert.is_not_nil(history_win)
assert.is_not_nil(history_buf)
assert.equal("", vim.wo[history_win].statuscolumn,
"history should not inherit the user's status column")
assert.equal(0, vim.fn.getwininfo(history_win)[1].textoff,
"history rows should use the full window width")

local content = h.get_buffer_content(history_buf)
local lines = h.get_buffer_lines(history_buf)
Expand Down