From cab5fc75c7cdafce07086b5ef6eb62894b7581cc Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Thu, 17 Sep 2020 12:45:09 -0400 Subject: [PATCH] fix: Don't error if we can't set cursor. Just try our best --- lua/telescope/actions.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/telescope/actions.lua b/lua/telescope/actions.lua index 74d6c56..d102e0d 100644 --- a/lua/telescope/actions.lua +++ b/lua/telescope/actions.lua @@ -2,6 +2,7 @@ local a = vim.api +local log = require('telescope.log') local state = require('telescope.state') local actions = setmetatable({}, { @@ -98,7 +99,10 @@ local function goto_file_selection(prompt_bufnr, command) local bufnr = vim.api.nvim_get_current_buf() a.nvim_buf_set_option(bufnr, 'buflisted', true) if row and col then - a.nvim_win_set_cursor(0, {row, col}) + local ok, err_msg = pcall(a.nvim_win_set_cursor, 0, {row, col}) + if not ok then + log.debug("Failed to move to cursor:", err_msg) + end end end end