aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/picker.rs
Commit message (Collapse)AuthorAge
* fix syntax highlights in dynamic picker (#8206)Pascal Kuthe2023-09-09
|
* Fix Clone definition for Injector (#8194)Michael Davis2023-09-07
|
* avoid excessive memory consumption in picker (#8127)Pascal Kuthe2023-09-01
| | | | | | | | | | | * avoid excessive memory consumption from file picker * fix typos Co-authored-by: Chris <75008413+cd-a@users.noreply.github.com> --------- Co-authored-by: Chris <75008413+cd-a@users.noreply.github.com>
* transition to nucleo for fuzzy matching (#7814)Pascal Kuthe2023-08-30
| | | | | | | | | | | | | | | | | | * transition to nucleo for fuzzy matching * drop flakey test case since the picker streams in results now any test that relies on the picker containing results is potentially flakely * use crates.io version of nucleo * Fix typo in commands.rs Co-authored-by: Skyler Hawthorne <skyler@dead10ck.com> --------- Co-authored-by: Skyler Hawthorne <skyler@dead10ck.com>
* Remove unnecessary `Err` from `get_canonicalized_path` (#8009)nkitsaini2023-08-20
| | | | Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Center the picker preview selection using visual lines (#7837)Jesse Luehrs2023-08-08
| | | | this way the preview always shows the selection even if lines were wrapped
* Reformat with nightly rustfmt for better let-else formatting (#7721)Philipp Mildenberger2023-07-27
|
* Prefer RopeSlice to &Rope in helix_core::syntaxMichael Davis2023-07-27
| | | | | | | | | | | | | | | Pascal and I discussed this and we think it's generally better to take a 'RopeSlice' rather than a '&Rope'. The code block rendering function in the markdown component module is a good example for how this can be useful: we can remove an allocation of a rope and instead directly turn a '&str' into a 'RopeSlice' which is very cheap. A change to prefer 'RopeSlice' to '&Rope' whenever the rope isn't modified would be nice, but it would be a very large diff (around 500+ 500-). Starting off with just the syntax functions seems like a nice middle-ground, and we can remove a Rope allocation because of it. Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Fix Component implementations for Picker (#7382)Michael Davis2023-06-19
|
* Completely remove old Picker and rename FilePicker to PickerGokul Soumya2023-06-18
|
* Make file preview callback optionalMichael Davis2023-06-18
| | | | | | | When Picker and FilePicker are merged, not all Pickers will be able to show a preview. Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
* Move FilePicker struct def closer to impl blockGokul Soumya2023-06-18
|
* Render the preview in FilePickerGokul Soumya2023-06-18
|
* Move Picker::render into FilePicker::renderGokul Soumya2023-06-18
|
* Move Component methods except render() to FilePickerGokul Soumya2023-06-18
|
* Move handle_event methods from Picker to FilePickerGokul Soumya2023-06-18
|
* Move navigation methods from Picker to FilePickerGokul Soumya2023-06-18
|
* Move scoring functions from Picker to FilePickerGokul Soumya2023-06-18
|
* Copy struct fields and new() from Picker to FilePickerGokul Soumya2023-06-18
|
* Move FilePicker::render from Component impl to normal implGokul Soumya2023-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merges the code for the Picker and FilePicker into a single Picker that can show a file preview if a preview callback is provided. This change was mainly made to facilitate refactoring out a simple skeleton of a picker that does not do any filtering to be reused in a normal Picker and a DynamicPicker (see #5714; in particular [mikes-comment] and [gokuls-comment]). The crux of the issue is that a picker maintains a list of predefined options (eg. list of files in the directory) and (re-)filters them every time the picker prompt changes, while a dynamic picker (eg. interactive global search, #4687) recalculates the full list of options on every prompt change. Using a filtering picker to drive a dynamic picker hence does duplicate work of filtering thousands of matches for no reason. It could also cause problems like interfering with the regex pattern in the global search. I tried to directly extract a PickerBase to be reused in Picker and FilePicker and DynamicPicker, but the problem is that DynamicPicker is actually a DynamicFilePicker (i.e. it can preview file contents) which means we would need PickerBase, Picker, FilePicker, DynamicPicker and DynamicFilePicker and then another way of sharing the previewing code between a FilePicker and a DynamicFilePicker. By merging Picker and FilePicker into Picker, we only need PickerBase, Picker and DynamicPicker. [gokuls-comment]: https://github.com/helix-editor/helix/issues/5714#issuecomment-1410949578 [mikes-comment]: https://github.com/helix-editor/helix/issues/5714#issuecomment-1407451963
* automatically disable TS when parsing takes longer than 500msPascal Kuthe2023-05-18
|
* async picker syntax highlightingPascal Kuthe2023-05-18
|
* Fix typos (#6643)Daniel Sedlak2023-04-07
|
* Truncate paths in the file picker (#6410)mWalrus2023-03-31
|
* Fix highlighting in picker with multiple columns (#6333)exp802023-03-18
|
* Feat: LSP Type Hints (#5934)Poliorcetics2023-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * misc: missing inline, outdated link * doc: Add new theme keys and config option to book * fix: don't panic in Tree::try_get(view_id) Necessary for later, where we could be receiving an LSP response for a closed window, in which case we don't want to crash while checking for its existence * fix: reset idle timer on all mouse events * refacto: Introduce Overlay::new and InlineAnnotation::new * refacto: extract make_job_callback from Context::callback * feat: add LSP display_inlay_hint option to config * feat: communicate inlay hints support capabilities of helix to LSP server * feat: Add function to request range of inlay hint from LSP * feat: Save inlay hints in document, per view * feat: Update inlay hints on document changes * feat: Compute inlay hints on idle timeout * nit: Add todo's about inlay hints for later * fix: compute text annotations for current view in view.rs, not document.rs * doc: Improve Document::text_annotations() description * nit: getters don't use 'get_' in front * fix: Drop inlay hints annotations on config refresh if necessary * fix: padding theming for LSP inlay hints * fix: tracking of outdated inlay hints should not be dependant on document revision (because of undos and such) * fix: follow LSP spec and don't highlight padding as virtual text * config: add some LSP inlay hint configs
* DynamicPicker: Recalculate column widths for new options (#6004)Michael Davis2023-03-08
| | | | | | | | | | | | | | This fixes blank row text in a DynamicPicker which is initially given no options. This can happen for language servers which respond to the workspace symbol request for an empty query with an empty list of symbols, and that behavior is somewhat common since returning all symbols as the spec suggests is very expensive. For empty options, `Picker::new` calculated the widths of each column as 0. We can recalculate the column widths when the new options are set to fix this. This refactor is also a good opportunity to formalize setting new options on a picker: besides setting the new options and calculating column widths we also want to reset the cursor and rescore the options.
* bump msrv to 1.63 (#5570)Pascal Kuthe2023-02-09
| | | | | * bump msrv to 1.63 * resolve new complex type clippy lints
* add substring matching options to picker (#5114)Pascal Kuthe2023-02-02
|
* rework positioning/rendering and enable softwrap/virtual text (#5420)Pascal Kuthe2023-01-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * rework positioning/rendering, enables softwrap/virtual text This commit is a large rework of the core text positioning and rendering code in helix to remove the assumption that on-screen columns/lines correspond to text columns/lines. A generic `DocFormatter` is introduced that positions graphemes on and is used both for rendering and for movements/scrolling. Both virtual text support (inline, grapheme overlay and multi-line) and a capable softwrap implementation is included. fix picker highlight cleanup doc formatter, use word bondaries for wrapping make visual vertical movement a seperate commnad estimate line gutter width to improve performance cache cursor position cleanup and optimize doc formatter cleanup documentation fix typos Co-authored-by: Daniel Hines <d4hines@gmail.com> update documentation fix panic in last_visual_line funciton improve soft-wrap documentation add extend_visual_line_up/down commands fix non-visual vertical movement streamline virtual text highlighting, add softwrap indicator fix cursor position if softwrap is disabled improve documentation of text_annotations module avoid crashes if view anchor is out of bounds fix: consider horizontal offset when traslation char_idx -> vpos improve default configuration fix: mixed up horizontal and vertical offset reset view position after config reload apply suggestions from review disabled softwrap for very small screens to avoid endless spin fix wrap_indicator setting fix bar cursor disappearring on the EOF character add keybinding for linewise vertical movement fix: inconsistent gutter highlights improve virtual text API make scope idx lookup more ergonomic allow overlapping overlays correctly track char_pos for virtual text adjust configuration deprecate old position fucntions fix infinite loop in highlight lookup fix gutter style fix formatting document max-line-width interaction with softwrap change wrap-indicator example to use empty string fix: rare panic when view is in invalid state (bis) * Apply suggestions from code review Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * improve documentation for positoning functions * simplify tests * fix documentation of Grapheme::width * Apply suggestions from code review Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * add explicit drop invocation * Add explicit MoveFn type alias * add docuntation to Editor::cursor_cache * fix a few typos * explain use of allow(deprecated) * make gj and gk extend in select mode * remove unneded debug and TODO * mark tab_width_at #[inline] * add fast-path to move_vertically_visual in case softwrap is disabled * rename first_line to first_visual_line * simplify duplicate if/else --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Fix clippy 1.67 warnings (#5697)Miguel Madrid-Mencía2023-01-27
|
* Replace menu::Item::{row, label} with format()Gokul Soumya2023-01-18
|
* Minimize allocation when converting table rows to stringGokul Soumya2023-01-18
|
* Use upstream implementation of table column calculationGokul Soumya2023-01-18
| | | | Changed in https://github.com/fdehau/tui-rs/commit/a68e38e59e6735c0a99139303b1609669d2c38da.
* Reuse table in pickerGokul Soumya2023-01-18
|
* Added opening files in the background with A-ret shortcut (#4435)Itay1232023-01-16
|
* Better sorting in picker in case of ties (#5169)Alex Kladov2022-12-17
|
* DynamicPicker: Reset idle timeout on refreshMichael Davis2022-12-15
| | | | | | | If the new results shown by the picker select a file that hasn't been previewed before, the idle timeout would not trigger highlighting on that file. With this change, we reset the idle timeout and allow that file to be highlighted on the next idle timeout event.
* DynamicPicker: Use idle-timeout as debounceMichael Davis2022-12-15
| | | | | | This change uses the idle-timeout event to trigger fetching new results in the DynamicPicker, so idle-timeout becomes a sort of debounce. This prevents querying the language server overly aggressively.
* Add DynamicPicker for updating options on every keyGokul Soumya2022-12-15
|
* Add force_score() for scoring picker items without optimizationsGokul Soumya2022-12-15
|
* Add preview for scratch buffers in buffer picker (#3454)A-Walrus2022-11-21
|
* sort fuzzy matches with equal score by length in picker (#4698)Pascal Kuthe2022-11-16
|
* Render diagnostics in the file picker preview (#4324)Michael Davis2022-10-25
| | | | | This is mostly for the sake of the diagnostics pickers: without rendering the diagnostic styles, it's hard to tell where the entries in the picker are pointing to.
* remove filterting with C-space from pickerPascal Kuthe2022-10-11
|
* Treat space as a seperator instead of a character in fuzzy pickerPascal Kuthe2022-10-11
|
* picker: Highlight the document on idle timeoutBlaž Hrastnik2022-10-11
|
* chore: remove unneeded attribute after MSRV bump to 1.61 (#3961)Poliorcetics2022-09-25
|
* Document MSRV policy (#3913)Pascal Kuthe2022-09-23
|
* fix: Recalculate completion when going through prompt history (#3193)Frojdholm2022-08-31
| | | | | | | | | | | | | | | | | | | | | | | | * fix: Recalculate completion when going through prompt history * Update completion when the prompt line is changed It should not be possible to update the line without also updating the completion since the completion holds an index into the line. * Fix Prompt::with_line recalculate completion with_line was the last function where recalculate completion had to be done manually. This function now also recalculates the completion so that it's impossible to forget. * Exit selection when recalculating completion Keeping the selection index when the completion has been recalculated doesn't make sense. This clears the selection automatically, removing most needs to manually clear it. * Remove &mut on save_filter Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>