Skip to content

Commit

Permalink
Small refactor action context
Browse files Browse the repository at this point in the history
  • Loading branch information
notomo committed May 6, 2024
1 parent 50e6a58 commit 3281b38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
1 change: 1 addition & 0 deletions lua/gesture/core/gesture_map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function GestureMap.add(self, gesture)
self._map[key] = gestures
end

--- @param ctx GestureActionContext
function GestureMap.match(self, bufnr, ctx, nowait)
vim.validate({
bufnr = { bufnr, "number" },
Expand Down
17 changes: 4 additions & 13 deletions lua/gesture/core/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function State.close(self)
self.view:close()
end

--- @return GestureActionContext
function State.action_context(self)
local point = self.view:current_point()
return {
Expand All @@ -94,19 +95,9 @@ function State.action_context(self)
point.x,
},

inputs = vim
.iter(self._inputs)
:map(function(input)
return input
end)
:totable(),

window_ids = vim
.iter(self._window_ids)
:map(function(window_id)
return window_id
end)
:totable(),
inputs = vim.iter(self._inputs):totable(),

window_ids = vim.iter(self._window_ids):totable(),
}
end

Expand Down

0 comments on commit 3281b38

Please sign in to comment.