Adds `--max-count=1000` flag to the `git log` command in the
`git_branch_log` previewer. This prevents potential fork bombing
issues with large repositories.
Using `bat` would result in the command being a nested list.
eg. using `:Telescope plaents` with `bat` installed
```
{
"bat",
{ "--pager", "less -RS" },
"--style=plain",
"--color=always",
"--paging=always",
"--",
"/home/jt/projects/telescope.nvim/data/memes/planets/earth",
}
```
This would cause `vim.fn.termopen` to throw an error as the command is
expected to be a flat list or string.
* fix(help_tags): show help tags on windows (#3126)
On Windows, `builtin.help_tags` picker does not show any help tags.
To fix this, the following changes are needed:
1. `util.path_tail` checks unix separator `/` on Windows and leave the
original implementation intact on unix systems.
2. Line endings should be taken carefully on Windows. `vim.split` with
only newline `\n` character as separator may result in unexpected
crash when parsing large files. When splits on lines are needed, call
it with `\r?\n`, or even set up a wrapper function in utils is more
prefered.
Fixes#3126
* fix: handle cross platform line splits
* fix(previewer): improve binary mime type check
Problem: mime type for a ts/js file can either return `text/plain` or
`application/javascript` based on the contents of the file.
Previously, this meant `application/javascript` would be considered
"possibly binary". This, in conjunction with how `vim.filetype.match`
does not give a result for a filename that ends in `.ts`, would lead to
a typescript file taking the path of `check_mime_type` and eventually
`mime_hook`.
Solution: Include `application/javascript` as a non-binary file type
during mime type check.
* [docgen] Update doc/telescope.txt
skip-checks: true
---------
Co-authored-by: Github Actions <actions@github>
Not showing a preview with the new changes in the latest changes of
[plenary.nvim PR
#575](https://github.com/nvim-lua/plenary.nvim/pull/575).
The error occurs when changing from `nomodifiable` to `modifiable`.
Telescope itself works, but the previews don't render.
* fix(set_preview_message): check line height of previewer before setting message.
* style: run changed file through stylua and remove unused variable.
* refactor: change lines table instead. check max between line_pos and 0
* style: run changed file through stylua.
This implements a experimental interface for allowing prompts like this `file.txt:3:4`. It is already enabled on default for `find_files` and `git_files`.
Be wary of breaking changes for the interface if you plan to manually enable it.
With this change we will check if the provided buffer number is valid,
before querying its `buftype` option. This is necessary, because
currently we would fail with:
```
Error executing vim.schedule lua callback:
...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:473:
Invalid buffer id: X
```
error, if we try to resume a jumplist picker after doing `:bwipeout`.
This commit fixes the following error:
E5108: Error executing lua: Vim:Can't send data to closed stream
stack traceback:
[C]: in function 'chansend'
/lua/telescope/previewers/term_previewer.lua:224: in function '_send_input'
/lua/telescope/previewers/previewer.lua:85: in function 'send_input'
/lua/telescope/previewers/term_previewer.lua:238: in function '_scroll_fn'
/lua/telescope/previewers/previewer.lua:93: in function 'scroll_fn'
/lua/telescope/actions/set.lua:249: in function 'run_replace_or_original'
/lua/telescope/actions/mt.lua:65: in function 'scroll_previewer'
/lua/telescope/actions/init.lua:222: in function 'run_replace_or_original'
This happens when previewers.new_termopen_previewer()'s get_command()
ends without pagination.