Blaž Hrastnik
c955eaa6cd
Revert "Improve dedent behavior, make kill_to_line_end behave like emacs ( #1173 )"
...
1. pressing o on a line with no indentation will open a new line as
expected, but esc will then delete the line altogether
2. the kill_line behavior happens after insert mode changes are already
commited to history, and the change isn't commited. pressing u after
this will break highlighting & undo history
This reverts commit c08d2fae58
.
2021-12-01 13:40:54 +09:00
Blaž Hrastnik
259678585c
ui: Optimize tree-sitter style lookups
...
Tree sitter returns an index referring to the position of the scope in
the scopes array. We can use that same index to avoid a hashmap lookup
and instead store the styles in an array.
This currently stores the styles in both a map and an array because the
UI still uses hashmap lookups, but it's a reasonable tradeoff.
2021-12-01 13:08:20 +09:00
Blaž Hrastnik
7bbf4c5b06
ui: Only calculate span styling when it's actually in bounds
2021-12-01 12:57:57 +09:00
WindSoilder
c08d2fae58
Improve dedent behavior, make kill_to_line_end behave like emacs ( #1173 )
...
* restore indent when press esc right after open a new line
* add comment for restore_indent
* fix, and make kill to line end behaves like emacs
* update comment
* fix comment
* adjust cancel restore_indent situation
* check esc logic in mode transaction
* improve comment
* add more check for dedent
* update comment
* use matches to check for last_cmd
* no need to introduct CommandFun type
2021-11-30 16:40:38 +09:00
Blaž Hrastnik
225e8ccf31
Extract gutters into helix-view
2021-11-29 11:00:28 +09:00
Blaž Hrastnik
27c1a84f05
Reuse a text buffer for each gutter line
2021-11-29 11:00:28 +09:00
Blaž Hrastnik
ba45db84d4
Tie the GutterFn lifetime to the doc so we can avoid cloning data
2021-11-29 11:00:28 +09:00
Blaž Hrastnik
30171416cb
Gutter functions
2021-11-29 11:00:28 +09:00
Martin Junghanns
a3a3b0b517
Jump to end char of surrounding pair from any cursor pos ( #1121 )
...
* Jump to end char of surrounding pair from any cursor pos
* Separate bracket matching into exact and fuzzy search
* Add constants for bracket chars
* Abort early if char under cursor is not a bracket
* Simplify bracket char validation
* Refactor node search and unify find methods
* Remove bracket constants
2021-11-20 23:17:25 +09:00
Blaž Hrastnik
8db6fffe90
ui: Increase diagnostics sideline width to 100 max and wrap if needed
2021-11-16 15:02:48 +09:00
ath3
35c974c9c4
Implement "Goto last modification" command ( #1067 )
2021-11-15 00:11:53 +09:00
Cole Helbling
b74912ea78
helix-term/editor: display scratch buffer name in status bar
2021-11-14 12:33:17 +05:30
Omnikar
d131a9dd0e
Allow keys to be mapped to sequences of commands ( #589 )
...
* Allow keys to be mapped to sequences of commands
* Handle `Sequence` at the start of `Keymap::get`
* Use `"[Multiple commands]"` as command sequence doc
* Add command sequence example to `remapping.md`
2021-11-11 13:44:50 +09:00
Omnikar
cfc8285867
Allow infoboxes to be disabled ( #972 )
...
* Allow infoboxes to be disabled
* Document `infoboxes` default value
* Rename `infoboxes` to `auto_info`
* Document `auto-info`
* Fix incomplete rename
2021-11-05 11:25:08 +09:00
Blaž Hrastnik
e2560f427e
Replace documents SlotMap with BTreeMap
2021-11-04 13:43:45 +09:00
Blaž Hrastnik
e5de103728
Extract a clear_completion method
2021-10-29 16:48:41 +09:00
Omnikar
2505802d39
Improve statusline ( #916 )
...
* Improve statusline
* Change diagnostic count display to show counts of individual
diagnostic types next to their corresponding gutter dots.
* Add selection count to the statusline.
* Do not display info or hint count in statusline
* Reduce padding
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Reduce padding
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Use `Span::styled`
* Reduce padding
* Use `Style::patch`
* Remove unnecessary `Cow` creation
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-10-27 12:24:24 +09:00
Blaž Hrastnik
acc5ac5e73
fix warning
2021-10-25 11:11:11 +09:00
Blaž Hrastnik
3edca7854e
completion: fully revert state before apply & insertText common prefix
2021-10-25 11:09:09 +09:00
Blaž Hrastnik
cee7ad781e
Mark a few functions as const
2021-10-24 17:28:29 +09:00
Blaž Hrastnik
f692ede2b7
fix: Don't crash on empty completion, don't retrigger on close
2021-10-07 10:37:35 +09:00
Blaž Hrastnik
66f26e82ce
Filter the initial completion
2021-10-05 22:27:35 +09:00
Blaž Hrastnik
40abec80e1
Experiment with autocompletion on idle
2021-10-05 22:27:33 +09:00
Blaž Hrastnik
f99bea404f
idle timer wip
2021-10-05 22:27:10 +09:00
Blaž Hrastnik
dd0b15e1f1
syntax: Properly handle injection-regex for language injections
2021-09-16 15:50:14 +09:00
Blaž Hrastnik
72cf86e462
Regex prompts should have a history with a specifiable register
2021-09-08 16:34:04 +09:00
Gokul Soumya
183dcce992
Add a sticky mode for keymaps ( #635 )
2021-09-05 12:55:13 +09:00
gbaranski
9c5752cbac
fix: use .cursor() instead of .head
2021-08-30 12:03:10 -07:00
gbaranski
b590504143
fix: use head instead of anchor for relative line
2021-08-30 12:03:10 -07:00
Omnikar
03ad9e0bfa
Fix code indentation ( #671 )
2021-08-30 09:15:49 +09:00
Grzegorz Baranski
cec5d437d8
fix: show current line number even if relative line is on ( #656 )
2021-08-26 23:18:33 +05:30
Kirawi
59e0ceef8c
better panic messages for when you're missing selection scopes ( #608 )
2021-08-22 11:15:33 +09:00
Gokul Soumya
f9375f449c
Refactor new Rect construction ( #575 )
...
* 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
2021-08-21 14:21:20 +09:00
Blaž Hrastnik
0595b0626a
Fix clippy attr
2021-08-19 16:05:05 +09:00
Blaž Hrastnik
5f8b1c7320
Avoid looking up ui.text per highlight range
2021-08-19 15:59:08 +09:00
Blaž Hrastnik
557fd86e71
Extract view.inner_area(), simplify render_focused_view_elements
2021-08-19 15:59:03 +09:00
Blaž Hrastnik
9776553ad0
Refactor view.first_line/first_col into view.offset (Position)
2021-08-19 12:52:07 +09:00
Grzegorz Baranski
78923496a6
feat: relative numbers ( #485 )
...
* feat(helix-view): configuring line-number
* feat(helix-term): relative line numbers
* feat(helix-term): passing editor::Config to render
* fix(helix-view): remove LineNumber::None
* feat(helix-term): rendering line-number according to configuration
* fix(term): put calculating current line above line iteration
* fix: add abs_diff function
* deps: cargo update
* fix: pass config argument
2021-08-16 11:11:53 +09:00
Gokul Soumya
d84f8b5fde
Show file preview in split pane in fuzzy finder ( #534 )
...
* 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
2021-08-12 16:00:42 +09:00
Dmitry Sharshakov
7d51805e94
Support primary clipboard ( #548 )
...
* clipboard-none: add in-memory fallback buffer
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* view: add Wayland primary clipboard
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Format
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: copy to primary selection after mouse move stops
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: don't update primary selection if it is a single character
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: discard result of setting primary selection
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: add commands for interaction with primary clipboard
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* editor: implement primary selection copy/paste using commands
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* clipboard: support xsel for primary selection
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* clipboard: support xclip for primary selection
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: multiple cursor support for middle click paste
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* rename primary selection to primary clipboard in scope of PR
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: make middle click paste optional
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Format
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Update helix-term/src/ui/editor.rs
* fix formatting
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* config: correct defaults if terminal prop is not set
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* refactor: merge clipboard and primary selection implementations
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Tidy up code
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* view: remove names for different clipboard/selection providers
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Update helix-view/src/clipboard.rs
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
* helix-view: tidy macros
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: refactor paste-replace commands
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: use new config for middle-click-paste
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* clipboard: remove memory fallback for command and windows providers
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* clipboard-win: fix build
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* clipboard: return empty string when primary clipboard is missing
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* clipboard: fix errors in Windows build
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
2021-08-12 11:53:48 +09:00
Dmitry Sharshakov
27b551d345
helix-term: handle scrolling when mouse is enabled ( #554 )
...
* helix-term: handle scrolling when mouse is enabled
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: configure scrolling speed
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: use new config for scrolling
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* config: defaults for edtior config
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* config: add scroll-lines property
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: scroll hovered view
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: support inverted scrolling
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: remove duplicating code
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: do not focus view while scrolled
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* helix-term: refactor mouse events and scrolling
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* simplify
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-08-10 14:35:20 +09:00
Blaž Hrastnik
86209c93a3
Appease clippy
2021-08-10 10:58:46 +09:00
Blaž Hrastnik
0a7add4ad4
Only recalculate resize during rendering, this stops flashing on resize
2021-08-10 10:52:52 +09:00
Kirawi
815ee9e334
fix small terminal size panic with info popup ( #563 )
...
* fix small terminal size panic with info popup
* remove unused enumerator
* fix subtraction overflow panic
2021-08-09 15:46:58 +09:00
Blaž Hrastnik
a2ccfffda1
config: Rename [terminal] to [editor] and pass it into Editor
2021-08-08 14:10:01 +09:00
Blaž Hrastnik
62eb8c6b40
mouse: Remove verify_screen_coords, refactor primary selection modification
2021-07-30 16:52:14 +09:00
Blaž Hrastnik
6bb744aeac
Remove the jump
2021-07-30 16:52:10 +09:00
Dmitry Sharshakov
8361de45dc
Mouse selection support ( #509 )
...
* Initial mouse selection support
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Disable mouse event capture if editor crashes
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Translate screen coordinates to view position
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Select full lines by dragging on line numbers
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* editor: don't register dragging as a jump
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Count graphemes correctly
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Do not select lines when dragging on the line number bar
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Split out verify_screen_coords
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Do not iterate over the graphemes twice
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Switch view by clicking on it
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Add disable-mouse config option
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Support multiple selections with mouse
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Remove unnecessary check
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Refactor using match expression
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Rename local variable
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Rename mouse option
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Refactor code
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Fix dragging selection
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Fix crash when clicking past last line
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Count characters better
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Remove comparison not needed anymore
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Validate coordinates before resolving position
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Tidy up references to editor tree
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Better way to determine line end and avoid overflow
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Fix for last line
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
* Add unit tests for text_pos_at_screen_coords
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
2021-07-30 16:52:00 +09:00
Nathan Vegdahl
a873e719d5
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
2021-07-28 14:11:08 -07:00
Gokul Soumya
1493313750
Show pending keys in status line ( #515 )
...
* Show pending keys and counts in status line
* Refactor pending key display
2021-07-28 13:57:07 +09:00