helix/helix-term
Michael Davis 3906f6605f
Avoid allocations in Picker file preview callback
The `FileLocation` and `PathOrId` types can borrow paths rather than
requiring them to be owned. This takes a refactor of the preview
functions and preview internals within `Picker`. With this change we
avoid an unnecessary `PathBuf` clone per render for any picker with a
file preview function (i.e. most pickers).

This refactor is not fully complete. The `PathOrId` is _sometimes_ an
owned `PathBuf`. This is for pragmatic reasons rather than technical
ones. We need a further refactor to introduce more core types like
`Location` in order to eliminate the Cow and only use `&Path`s within
`PathOrId`. This is left for future work as it will be a larger refactor
almost entirely fitting into the LSP commands module and helix-core -
i.e. mostly unrelated to refactoring the `Picker` code itself.

Co-authored-by: Pascal Kuthe <pascalkuthe@pm.me>
2024-07-15 09:31:33 -04:00
..
src Avoid allocations in Picker file preview callback 2024-07-15 09:31:33 -04:00
tests refactor(commands): trim end of `pipe`-like output (#10952) 2024-07-13 10:44:48 +09:00
.gitignore Initial import. 2020-05-20 18:14:51 +09:00
Cargo.toml Implement Error for InjectorShutdown 2024-07-15 09:31:32 -04:00
build.rs Add icon to Windows executable (#9104) 2024-01-28 18:31:10 +09:00