Adds ctrl! and alt! macros (which existed before the big keymap
refactor) and uses them in event handling of Components. Note
that this converts crossterm's KeyEvent to our own KeyEvent on
each invocation of handle_event in Components.
* Prevent preview binary or large file (#847)
* fix wrong method name
* fix add use trait
* update lock file
* rename MAX_PREVIEW_SIZE from MAX_BYTE_PREVIEW
* read small bytes to determine cotent type
* [WIP] add preview struct to represent calcurated preveiw
* Refactor content type detection
- Remove unwraps
- Reuse a single read buffer to avoid 1kb reallocations between previews
* Refactor preview rendering so we don't construct docs when not necessary
* Replace unwarap whit Preview::NotFound
* Use index access to hide unwrap
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* fix Get and unwarp equivalent to referce of Index acess
* better preview implementation
* Rename Preview enum and vairant
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
* fixup! Rename Preview enum and vairant
* simplify long match
* Center text, add docs, fix formatting, refactor
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
* Truncate the starts of file paths in picker
* Simplify the truncate implementation
* Break loop at appropriate point
* Fix alignment and ellipsis presence
* Remove extraneous usage of `x_offset`
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Refactor new Rect construction
Introduces methods that can be chained to construct new Rects
out of pre-existing ones
* Clamp x and y to edges in Rect chop methods
* Rename Rect clipping functions
* Add preview pane for fuzzy finder
* Fix picker preview lag by caching
* Add picker preview for document symbols
* Cache picker preview per document instead of view
* Use line instead of range for preview doc
* Add picker preview for buffer picker
* Fix render bug and refactor picker
* Refactor picker preview rendering
* Split picker and preview and compose
The current selected item is cloned on every event, which is
undesirable
* Refactor out clones in previewed picker
* Retrieve doc from editor if possible in filepicker
* Disable syntax highlight for picker preview
Files already loaded in memory have syntax highlighting enabled
* Ignore directory symlinks in file picker
* Cleanup unnecessary pubs and derives
* Remove unnecessary highlight from file picker
* Reorganize buffer rendering
* Use normal picker for code actions
* Remove unnecessary generics and trait impls
* Remove prepare_for_render and make render mutable
* Skip picker preview if screen small, less padding
* reverse the dependency between helix-tui and helix-view by moving a fiew types to view
* fix tests
* clippy and format fixes
Co-authored-by: Keith Simmons <keithsim@microsoft.com>