Repository: nvim-telescope/telescope.nvim (lua)

Issue:
Incorrect `lnum` locations in quickfix list generated by `send_selected_to_qflist`
### Description

If the prompt is just a simple file name with no location part (e.g. just `file.txt`) in a picker where the experimental file location feature is enabled, the `lnum` of selected entry (or entries) defaults to `0` which makes quickfix list items generated by `send_selected_to_qflist` invalid.

I'd be happy to submit a PR to fix this, but I don't know where it should be fixed:
- when parsing file location in `utils.__separate_file_path_location()`
- in `Picker:set_selection()`
- in `entry_to_qflist()` in `send_selected_to_qflist()`.
- or somewhere else...

From what I've gathered, this feature is experimental and is planned to be rewritten/redesigned. But this is messing up quickfix lists at the moment.

NOTE: this doesn't happen in `send_all_to_qflist()`

### Neovim version

```markdown
NVIM v0.10.0-dev-2060+g63a17322dd
Build type: RelWithDebInfo
LuaJIT 2.1.1702233742
```


### Operating system and version

ArchLinux

### Telescope version / branch / rev

b3ff5f33201f474d58f5be96244869f189bbc091

### checkhealth telescope

```markdown
==============================================================================
telescope: health#telescope#check

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.1.0
- OK fd: found fd 9.0.0

===== Installed extensions ===== ~

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Telescope Extension: `ui-select` ~
- No healthcheck provided
```


### Steps to reproduce

1. `nvim -nu minimal.lua`
2. `:Telescope find_files`
3. multi select a couple of files
4. send selected to qflist with `<M-q>`
5. Observe the quickfix list.

### Expected behavior

The quickfix list should look something like this:

```
Makefile|1 col 1| Makefile
.gitignore|1 col 1| .gitignore
```

### Actual behavior

The quickfix list looks like this (notice missing locations, because they are invalid I guess):
```
Makefile|| Makefile
.gitignore|| .gitignore
```

### Minimal config

```Lua
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
        },
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup()
  require('telescope').load_extension('fzf')
  -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
```

Pull request description:
Fixes couple of regressions from #2791 when no line number info is given in the prompt (eg. `file.txt` rather than `file.txt:10`). 
Both issues stemming from the fact that when no line number info is given, the `entry.lnum` was set to `0`. `entry.lnum` is 1-index.
- Sending results to quickfix would send faulty results (closes #2864)
- Will no open the file on the correct (previous) line number
For this, setting the lnum to 1 is still undesirable since this overwrites the lnum priority handling in the `select` action.

Patch:
diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua
index 32df244600..ff7339ddf6 100644
--- a/lua/telescope/utils.lua
+++ b/lua/telescope/utils.lua
@@ -569,7 +569,10 @@ end
 
 --- Takes the path and parses optional cursor location `$file:$line:$column`
 --- If line or column not present `0` returned.
---- @param path string
+---@param path string
+---@return string path
+---@return integer? lnum
+---@return integer? col
 utils.__separate_file_path_location = function(path)
   local location_numbers = {}
   for i = #path, 1, -1 do
@@ -600,7 +603,7 @@ utils.__separate_file_path_location = function(path)
     return path, location_numbers[1], 0
   end
 
-  return path, 0, 0
+  return path, nil, nil
 end
 
 return utils


Test patch:
diff --git a/lua/tests/automated/utils_spec.lua b/lua/tests/automated/utils_spec.lua
index b0f5d22c47..ebe00a6b53 100644
--- a/lua/tests/automated/utils_spec.lua
+++ b/lua/tests/automated/utils_spec.lua
@@ -108,8 +108,6 @@ describe("separates file path location", function()
     {
       input = "file:",
       file = "file",
-      row = 0,
-      col = 0,
     },
   }