24 Commits

Author SHA1 Message Date
Alex Pasmantier
dfbdd65107
fix(config): use the config default_channel field as a fallback when no channel is specified (#524)
Fixes #520 

fyi @lalvarezt
2025-05-26 21:16:06 +02:00
Alex Pasmantier
ca09c503ca
refactor!(cable): update cable channel preview configuration format + add custom preview offsets (#511)
BREAKING CHANGE: the format of the cable channel files and more
specifically the preview specification is updated to be a single table
named `preview` (with keys `command`, `delimiter`, and `offset`) instead
of three flat fields.

```toml
preview_command = "echo 3"
preview_delimiter = " "
preview_offset = "{1}"
```

becomes: 

```toml
preview.command = "echo 3"
preview.delimiter = " "
preview.offset = "{1}"
```
2025-05-16 01:07:12 +02:00
Alexandre Pasmantier
67c067ff40
refactor(previewer): a much more efficient preview system for tv (#506)
Broke away the previewer logic into its own tokio task communicating
with the main thread over two mpsc channels.

Most of the previewer code is now much simpler and less verbose. 

This brings quite a nice bump to performance and overall UI
responsiveness and also makes the previewer consume less cpu resources.
2025-05-14 20:22:53 +02:00
Alexandre Pasmantier
1a5fa5dd4c
refactor(channels): some renaming and refactoring the channels module (#503) 2025-05-11 17:00:31 +02:00
Alexandre Pasmantier
2b2654b6aa
refactor: drop TelevisionChannel enum and all associated macros (#498)
This drops the `TelevisionChannel` enum which served as a unified
interface for builtin and cable channels as well as all related macros
and the `television-derive` package.
This simplifies the code quite a lot and will improve overall
maintainability.
2025-05-06 11:18:32 +02:00
Alexandre Pasmantier
58d73dbeba
refactor!(previews): drop builtin previewers and all related code and dependencies (#495)
BREAKING CHANGE: No more builtin previews which means channels currently using `:files:` and other builtins will now need to rely on external tools (examples to come).
2025-05-06 00:07:50 +02:00
Alexandre Pasmantier
b9f42e8c29
refactor(preview): simplify channel previews code and remove intermediate PreviewKind struct (#490) 2025-05-01 17:42:01 +02:00
Alexandre Pasmantier
4385317e06
refactor(cable): split cable related code into separate submodules (#486)
This refactors `television/channels/cable.rs` into two additional
submodules:
- `television/channels/cable/preview.rs`
- `television/channels/cable/prototypes.rs`
2025-04-29 18:07:42 +02:00
Alexandre Pasmantier
67677fb917
refactor!: all channels are now cable channels (#479)
- tv's default channel (when lauching `tv`) is now configurable via the
`default_channel` configuration option
- add `RUST_BACKTRACE=1` and `--nocapture` to ci testing for better
debugging
- remove all builtin channels and associated glue code as well as the
`ToCliChannel` and `ToUnitChannel` derive macros
- recode all builtin channels using shell commands (along with `fd`,
`bat`, and `rg`)
- add support for interactive shell commands inside cable channels
- drop the `send_to_channel` feature until further notice (will be
reimplemented later on in a more generic and customizable way)
2025-04-27 23:50:14 +02:00
nkxxll
bbbdcb0271
feat(cli): add substring matching with --exact flag (#477)
fixes #368 

@alexpasmantier I tried to parse down the exact flag to the find method,
but I can't find an elegant way to do so because the channel creates its
own configurations for the matcher inside of the `new` method. I started
adding the exact flag to the new function of each of the channels but it
just does not seem right to do so. Do you have an idea on how to improve
the change? I would think of passing the config struct to the new
function and exposing the config of the channel for channel transitions,
but I'm not sure... 🤔

I have done it here for the stdin channel just to show you how it would
look like and it works fine😄! Looking forward to hearing your thoughts
on that 👍

ref issue: #368

---------

Co-authored-by: Alexandre Pasmantier <alex.pasmant@gmail.com>
2025-04-22 00:37:07 +02:00
Alexandre Pasmantier
315a9f71fa
test(benches): refactor benches into a simpler and more scalable structure (#467) 2025-04-14 17:41:16 +00:00
Alexandre Pasmantier
5bf3d20c83
feat(cli): add a --no-help flag to allow disabling showing the help panel (#456)
This will disable the help panel and associated toggling actions
entirely. This is useful when the help panel is not needed or
when the user wants `tv` to run with a minimal interface (e.g. when
using it as a file picker for a script or embedding it in a larger
application).
2025-04-09 21:46:16 +00:00
Alexandre Pasmantier
6ba235fa11
fix(results): fix alignment for non unit width unicode characters (#442)
Fixes #439
2025-04-01 01:30:18 +02:00
Alexandre Pasmantier
8e17ef694e
refactor: nicer results alignment to improve discoverability of matched patterns (#435)
<img width="1018" alt="Screenshot 2025-03-23 at 16 13 54"
src="https://github.com/user-attachments/assets/89777043-e98f-464c-b508-0c0dce9d4b26"
/>

Fixes #373
2025-03-23 16:20:58 +01:00
Alexandre Pasmantier
a6a73c5bb3
refactor(shell): improve shell integration configuration syntax (#334)
Before:
```toml
[shell_integration.commands]
# Add your commands here. Each key is a command that will trigger tv with the
# corresponding channel as value.
# Example: say you want the following prompts to trigger the following channels
# when pressing <CTRL-T>:
#          `git checkout` should trigger the `git-branches` channel
#          `ls`           should trigger the `dirs` channel
#          `cat`          should trigger the `files` channel
#
# You would add the following to your configuration file:
# ```
# [shell_integration.commands]
# "git checkout" = "git-branch"
# "ls" = "dirs"
# "cat" = "files"
# ```

# environment variables
"export" = "env"
"unset" = "env"

# dirs channel
"cd" = "dirs"
"ls" = "dirs"
"rmdir" = "dirs"

# files channel
"cat" = "files"
"less" = "files"
"head" = "files"
"tail" = "files"
"vim" = "files"
"bat" = "files"

# git-diff channel
"git add" = "git-diff"

# git-branch channel
"git checkout" = "git-branch"
"git branch -d" = "git-branch"

# docker-images channel
"docker run" = "docker-images"

# gitrepos channel
"nvim" = "git-repos"

```

After

```toml
[shell_integration.channel_triggers]
# Add your channel triggers here. Each key is a channel that will be triggered
# by the corresponding commands.
# Example: say you want the following commands to trigger the following channels
# when pressing <CTRL-T>:
#          `git checkout`  should trigger the `git-branches` channel
#          `ls`            should trigger the `dirs` channel
#          `cat` and `cp`  should trigger the `files` channel
#
# You would add the following to your configuration file:
# ```
# [shell_integration.channel_triggers]
# "git-branches" = ["git checkout"]
# "dirs" = ["ls"]
# "files" = ["cat", "cp"]
# ```
"env" = ["export", "unset"]
"dirs" = ["cd", "ls", "rmdir"]
"files" = ["cat", "less", "head", "tail", "vim", "bat"]
"git-diff" = ["git add"]
"git-branch" = ["git checkout", "git branch -d"]
"docker-images" = ["docker run"]
"git-repos" = ["nvim"]
```
2025-02-03 00:03:09 +01:00
Alexandre Pasmantier
be80496549
refactor(draw): clearing out mut operations from rendering critical path, avoiding mutexes and perf improvements (#322) 2025-01-31 22:49:13 +01:00
Alex Pasmantier
172ba231ee
perf(async): make overall UI much smoother and snappier (#311) 2025-01-25 21:17:31 +01:00
Alex Pasmantier
3970f65946
chore: flatten workspace into a single crate (#306) 2025-01-25 00:44:34 +01:00
Alex Pasmantier
0624002f35
perf: use FxHash instead of SipHash where it makes sense (#237) 2025-01-07 02:11:12 +01:00
Alex Pasmantier
d20784891f
chore: fix linting warnings (#230) 2025-01-06 19:23:28 +01:00
Alexandre Pasmantier
937d0f0758
feat(cable): support cable channel invocation through the cli (#116) 2024-12-14 17:47:36 +01:00
Alexandre Pasmantier
913aa85af0
feat(themes): add support for ui themes (#114)
fixes #80 

### examples
| gruvbox | solarized |
| :-: | :-: |
| <img width="1792" alt="gruvbox"
src="https://github.com/user-attachments/assets/c0c168a5-5c95-4113-93fd-24b34a9344d8"
/> | ![Screenshot 2024-12-13 at 14 38
57](https://github.com/user-attachments/assets/368e3e37-7fdd-493a-8c0b-47e3731ae67b)
|
2024-12-13 14:54:38 +01:00
Bertrand Chardon
a4d15af694
perf: optimize entry ranges (#110) 2024-12-09 23:39:06 +01:00
Bertrand Chardon
c0db566a48
perf: add bench for build results list (#107)
This PR adds a benchmark for performance-critical function
`build_results_list` from `television_screen::results`

This should allows `television` to track performances improvements or
regressions across time for that function (and other in the future)

---------

Co-authored-by: alexpasmantier <alex.pasmant@gmail.com>
2024-12-08 18:43:38 +01:00