diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-03 23:56:49 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-03 23:56:49 -0400 |
| commit | 839f57efb37cba7a9542b67b31370e1babaf194a (patch) | |
| tree | 2e502a58d83bc528e78b3d44d92134ec96d1345a /lua/telescope/actions.lua | |
| parent | 737363097b8710566cf624776f1d0a18c03a0d8b (diff) | |
feat: Major improvements in API. Particularly relating to entries.
Diffstat (limited to 'lua/telescope/actions.lua')
| -rw-r--r-- | lua/telescope/actions.lua | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/lua/telescope/actions.lua b/lua/telescope/actions.lua index f1b4a38..dd47f4d 100644 --- a/lua/telescope/actions.lua +++ b/lua/telescope/actions.lua @@ -42,23 +42,32 @@ function actions.goto_file_selection(prompt_bufnr) print("[telescope] Nothing currently selected") return else - local value = entry.value - if not value then - print("Could not do anything with blank line...") - return + local filename, row, col + if entry.filename then + filename = entry.filename + -- TODO: Check for off-by-one + row = entry.row or entry.lnum + col = entry.col + else + -- TODO: Might want to remove this and force people + -- to put stuff into `filename` + local value = entry.value + if not value then + print("Could not do anything with blank line...") + return + end + + if type(value) == "table" then + value = entry.display + end + + local sections = vim.split(value, ":") + + filename = sections[1] + row = tonumber(sections[2]) + col = tonumber(sections[3]) end - -- TODO: This is not great. - if type(value) == "table" then - value = entry.display - end - - local sections = vim.split(value, ":") - - local filename = sections[1] - local row = tonumber(sections[2]) - local col = tonumber(sections[3]) - vim.cmd(string.format([[bwipeout! %s]], prompt_bufnr)) a.nvim_set_current_win(picker.original_win_id or 0) |
