@@ -67,14 +67,23 @@ function M.toggle()
6767 M .render ()
6868end
6969
70- function M .get_selected_hashes ()
71- local hashes = {}
70+ function M .get_selected_indices ()
71+ local indices = {}
7272 for i = 1 , # M .state .commits do
7373 if M .state .selected [i ] then
74- local h = M .state .commits [i ]:match (" ^(%w+)" )
75- if h then
76- table.insert (hashes , h )
77- end
74+ table.insert (indices , i )
75+ end
76+ end
77+ return indices
78+ end
79+
80+ function M .get_selected_hashes ()
81+ local hashes = {}
82+ local indices = M .get_selected_indices ()
83+ for _ , i in ipairs (indices ) do
84+ local h = M .state .commits [i ]:match (" ^(%w+)" )
85+ if h then
86+ table.insert (hashes , h )
7887 end
7988 end
8089 return hashes
@@ -92,7 +101,8 @@ function M.keymaps()
92101 vim .keymap .set (" n" , " <space>" , M .toggle , opts )
93102
94103 vim .keymap .set (" n" , " <CR>" , function ()
95- require (" gitlogdiff.actions" ).show_selected (M .get_selected_hashes ())
104+ local ui = require (" gitlogdiff.ui" )
105+ require (" gitlogdiff.actions" ).show_selected (ui .get_selected_hashes (), ui .get_selected_indices ())
96106 end , opts )
97107
98108 vim .keymap .set (" n" , " q" , function ()
0 commit comments