diff options
| author | raiguard <caleb.heuer@gmail.com> | 2021-12-23 21:00:48 -0700 |
|---|---|---|
| committer | raiguard <caleb.heuer@gmail.com> | 2021-12-23 21:00:48 -0700 |
| commit | 9bf3299200674271e93cd166986a853da85f6dcd (patch) | |
| tree | c058b92df8ac74b19a44059fb4bbb3c52f4a2aa2 /harpoon.kak | |
| parent | 6748d8ce880058a549670370ef20d2a30d9d0034 (diff) | |
Fix crash when there are gaps in the list
Diffstat (limited to 'harpoon.kak')
| -rw-r--r-- | harpoon.kak | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/harpoon.kak b/harpoon.kak index 1af38b8..e10c2e1 100644 --- a/harpoon.kak +++ b/harpoon.kak @@ -10,7 +10,7 @@ define-command harpoon-nav -params 1 -docstring "Navigate to the file at the spe for i = 2, #arg do local index, bufname = string.match(arg[i], "(%d+)=(.*)") index = tonumber(index) - table.insert(buffers, index, bufname) + buffers[index] = bufname end if buffers[to_index] then @@ -33,7 +33,7 @@ define-command harpoon-add -params ..1 -docstring "Add the current file to the l for i = 3, #arg do local index, bufname = string.match(arg[i], "(%d+)=(.*)") index = tonumber(index) - table.insert(buffers, index, bufname) + buffers[index] = bufname end -- This will handle gaps in the list as well, since # will return the first contiguous section index = #buffers + 1 @@ -62,7 +62,7 @@ define-command harpoon-add-or-nav -params 1 -docstring "Add or navigate to the f for i = 2, #arg do local index, bufname = string.match(arg[i], "(%d+)=(.*)") index = tonumber(index) - table.insert(buffers, index, bufname) + buffers[index] = bufname end local index = args() |
