25 Commits

Author SHA1 Message Date
LM
c8df96270a
refactor(help): more informative help panel (#668)
## 📺 PR Description

Rework the help panel to show live keybinding source information
(global, channel) instead of hard-coded entries

Before
<img width="511" height="934" alt="image"
src="https://github.com/user-attachments/assets/bea29e07-ec4a-443d-a468-be1e9f28a705"
/>

After
<img width="690" height="1355" alt="image"
src="https://github.com/user-attachments/assets/a930382b-e814-482a-a729-54ef2dc286c4"
/>

## Env

### Command

```bash
RUST_LOG=debug cargo run -q -- --cable-dir ./cable/unix --config-file ./.config/config.toml --show-help-panel --keybindings "f10 = \"toggle_help\"; f9 = \"toggle_status_bar\""
```

### Config file
```toml
[metadata]
name = "files"
description = "A channel to select files and directories"
requirements = ["fd", "bat"]

[source]
command = ["fd -t f", "fd -t f -H"]

[preview]
command = "bat -n --color=always '{}'"
env = { BAT_THEME = "ansi" }

[keybindings]
shortcut = "f1"
f9 = "toggle_preview"
f8 = "quit"
esc = false
```

## Checklist

<!-- a quick pass through the following items to make sure you haven't
forgotten anything -->

- [x] my commits **and PR title** follow the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format
- [x] if this is a new feature, I have added tests to consolidate the
feature and prevent regressions
- [ ] if this is a bug fix, I have added a test that reproduces the bug
(if applicable)
- [x] I have added a reasonable amount of documentation to the code
where appropriate
2025-07-25 13:16:12 +02:00
Alex Pasmantier
a019f18229 perf(channel): avoid unnecessary allocations 2025-07-25 01:31:40 +02:00
Alex Pasmantier
098f3f4fe4
feat: ansi-styled results with --ansi or corresponding channel option (#655)
# Examples:
## ripgrep
```toml
[metadata]
name = "text"
description = "A channel to find and select text from files"
requirements = ["rg", "bat"]

[source]
command = "rg . --no-heading --line-number --colors 'match:fg:white' --colors 'path:fg:blue' --color=always"
ansi = true
output = "{strip_ansi|split:\\::..2}"

[preview]
command = "bat -n --color=always '{strip_ansi|split:\\::0}'"
env = { BAT_THEME = "ansi" }
offset = '{strip_ansi|split:\::1}'

[ui]
preview_panel = { header = '{strip_ansi|split:\::..2}' }
```

<img width="2880" height="1620" alt="Screenshot From 2025-07-19
20-56-53"
src="https://github.com/user-attachments/assets/67055fd1-d03e-4c4b-ad82-dbc3ba8c80d4"
/>

## git-log

```toml
[metadata]
name = "git-log"
description = "A channel to select from git log entries"
requirements = ["git", "delta"]

[source]
command = "git log --graph --pretty=format:'%C(yellow)%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --color=always"
output = "{strip_ansi|split: :1}"
ansi = true

[preview]
command = "git show -p --stat --pretty=fuller --color=always '{strip_ansi|split: :1}' | delta"
```

<img width="2880" height="1620" alt="Screenshot From 2025-07-19
19-17-15"
src="https://github.com/user-attachments/assets/be97ff35-8a35-4d26-ad14-afd5ece3fed6"
/>
2025-07-19 22:52:12 +02:00
alexandre pasmantier
fb97f011be fix(themes): selection_fg was not applied correctly + code improvements
Fixes #636
2025-07-13 00:21:39 +02:00
Alex Pasmantier
dc75e80fb9
fix(ui): avoid glitches caused by programs outputting control sequences (#579)
Fixes #561
2025-07-01 15:39:56 +02:00
LM
ad4e254ae6 feat(ui): new keybindings panel and status bar (#559)
Add a new keybinding manager (à la which-key helix style)

it adapts to the current mode

channel mode

![image](https://github.com/user-attachments/assets/d1748d93-d62b-4377-a4cd-9825318300e0)

remote mode

![image](https://github.com/user-attachments/assets/fa6ab776-a9bd-421c-ae75-a0b6013401fa)

Add sorting for remote entries

---------

Co-authored-by: Alex Pasmantier <alex.pasmant@gmail.com>
2025-06-28 16:56:09 +02:00
lalvarezt
80cb6c3606 refactor(picker): new movement system 2025-06-28 16:56:09 +02:00
lalvarezt
7ac2f28be7 refactor(screen): new result line abstraction that can be reused 2025-06-28 16:56:09 +02:00
alexandre pasmantier
51617b1775 refactor: clearer separation of channels vs remote, better deserialization of prototype sub-structures, etc. 2025-06-28 16:56:09 +02:00
LM
783d96bb67 feat(ui): preview size customization (#545)
This PR adds support for configuring the preview panel size through the CLI, the configuration file, and cable files.
2025-06-28 16:56:09 +02:00
alexandre pasmantier
bc8d636005 feat(cli): add cli options to override configuration and cable directories
`tv --config-dir=/my/dir --cable-dir=/my/other/dir`
2025-06-28 16:56:09 +02:00
LM
415dd38c66 fix(app): honor cli no-help and no-preview (#539)
precedence should be 
cli flags > local config > global config
2025-06-28 16:56:09 +02:00
alexandre pasmantier
e76a3df776 refactor(cable)!: cable format redesign 2025-06-28 16:56:09 +02:00
Alex Pasmantier
738fe08fbb
chore(rust): update rust edition to 2024 and version to 1.87 (#528) 2025-06-05 15:01:27 +02:00
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