Skip to content

Commit a38945a

Browse files
authored
Merge pull request #1590 from NeogitOrg/development
2 parents 11e14b6 + ed01faa commit a38945a

File tree

17 files changed

+88
-13
lines changed

17 files changed

+88
-13
lines changed

doc/neogit.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ NeogitDiffContext
522522
NeogitDiffAdd
523523
NeogitDiffDelete
524524
NeogitDiffHeader
525+
NeogitActiveItem Highlight of current commit-ish open
525526

526527
SIGNS FOR LINE HIGHLIGHTING CURRENT CONTEXT
527528
These are essentially an accented version of the above highlight groups. Only

lua/neogit/buffers/commit_view/init.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ function M:close()
8181
M.instance = nil
8282
end
8383

84+
---@return string
85+
function M.current_oid()
86+
if M.is_open() then
87+
return M.instance.commit_info.oid
88+
else
89+
return "null-oid"
90+
end
91+
end
92+
8493
---Opens the CommitViewBuffer if it isn't open or performs the given action
8594
---which is passed the window id of the commit view buffer
8695
---@param commit_id string commit
@@ -145,10 +154,6 @@ end
145154
function M:open(kind)
146155
kind = kind or config.values.commit_view.kind
147156

148-
if M.is_open() then
149-
M.instance:close()
150-
end
151-
152157
M.instance = self
153158

154159
self.buffer = Buffer.create {

lua/neogit/buffers/common.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,13 @@ M.CommitEntry = Component.new(function(commit, remotes, args)
271271
}
272272
),
273273
details,
274-
}, { oid = commit.oid, foldable = args.details == true, folded = true, remote = info.remotes[1] })
274+
}, {
275+
item = commit,
276+
oid = commit.oid,
277+
foldable = args.details == true,
278+
folded = true,
279+
remote = info.remotes[1],
280+
})
275281
end)
276282

277283
M.CommitGraph = Component.new(function(commit, padding)

lua/neogit/buffers/log_view/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ function M:open()
8181
context_highlight = false,
8282
header = self.header,
8383
scroll_header = false,
84+
active_item_highlight = true,
8485
status_column = not config.values.disable_signs and "" or nil,
8586
mappings = {
8687
v = {

lua/neogit/buffers/reflog_view/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ function M:open(_)
5656
scroll_header = true,
5757
status_column = not config.values.disable_signs and "" or nil,
5858
context_highlight = true,
59+
active_item_highlight = true,
5960
mappings = {
6061
v = {
6162
[popups.mapping_for("CherryPickPopup")] = popups.open("cherry_pick", function(p)

lua/neogit/buffers/reflog_view/ui.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ M.Entry = Component.new(function(entry, total)
4848
{ date, "Special" },
4949
},
5050
}),
51-
}, { oid = entry.oid })
51+
}, {
52+
oid = entry.oid,
53+
item = entry,
54+
})
5255
end)
5356

5457
---@param entries ReflogEntry[]

lua/neogit/buffers/stash_list_view/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function M:open()
3939
scroll_header = true,
4040
kind = config.values.stash.kind,
4141
context_highlight = true,
42+
active_item_highlight = true,
4243
mappings = {
4344
v = {
4445
[popups.mapping_for("CherryPickPopup")] = function()

lua/neogit/buffers/stash_list_view/ui.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ M.Stash = Component.new(function(stash)
2323
{ config.values.log_date_format ~= nil and stash.date or stash.rel_date, "Special" },
2424
},
2525
}),
26-
}, { oid = label })
26+
}, { oid = label, item = stash })
2727
end)
2828

2929
---@param stashes StashItem[]

lua/neogit/buffers/status/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ function M:open(kind)
104104
disable_line_numbers = config.values.disable_line_numbers,
105105
disable_relative_line_numbers = config.values.disable_relative_line_numbers,
106106
foldmarkers = not config.values.disable_signs,
107+
active_item_highlight = true,
107108
on_detach = function()
108109
Watcher.instance(self.root):unregister(self)
109110

lua/neogit/buffers/status/ui.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ local SectionItemStash = Component.new(function(item)
314314
text.highlight("NeogitSubtleText")(name),
315315
text.highlight("NeogitSubtleText")(": "),
316316
text(item.message),
317-
}, { yankable = name, item = item })
317+
}, { yankable = item.oid, item = item })
318318
end)
319319

320320
local SectionItemCommit = Component.new(function(item)

0 commit comments

Comments
 (0)