Commit Graph

335 Commits (210a7e1c1275f9dc232bb9d52e1604df0f2f6a91)

Author SHA1 Message Date
Blaž Hrastnik 7909d6f05e
keymap: Store pending/sticky on the root level 2 years ago
Blaž Hrastnik 59f05088b9
Optimize rendering by using Ropey::byte_slice
This avoids costly conversions via byte_to_char (which are then
reversed back into bytes internally in Ropey).

Reduces time spent in slice/byte_to_char from ~24% to ~5%.
2 years ago
Blaž Hrastnik fd02d1bf89
Fix tab rendering to use dynamic tab width
Each tab is just wide enough to round to the nearest tab stop.

Refs #1243
2 years ago
Blaž Hrastnik 0062af6a19
minor: Remove some outdated comments 2 years ago
Blaž Hrastnik 68bad148a5
Extract idle timeout code into ui/editor.rs 2 years ago
Mateusz S. Szczygieł 14e2ced440
Make repeat operator work with completion edits (#1640)
* add basic completion replay

* use transaction as the last completion

* completion replay only on trigger position

* cache changes in CompletionAction

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
Ludwig Stecher 59c691d2db
Highlight matching text in file picker suggestions (#1635)
* Highlight matching text in file picker suggestions

* Remove cache, specialize highlighting code

* Fix outdated comments
2 years ago
Daniel S Poulin b13d44156c
Show infobox to hint textobjects with `mi` and `ma` (#1686)
* Show infobox to hint textobjects with `mi` and `ma`

* Add note to infobox than any pair of characters will work too

The wording could probably be a little more clear, but I wanted to
keep it short but still accurate.

* Don't allocate a vec for the static help text

* Fix bug where `mi<esc>` would swallow next input and persist infobox

* Better help text for arbitrary pair matching in textobject selection

* Add way to add fake pending key data below status, use with `mi`/`ma`

This is a bit hacky as it makes use of global state which will end
up managed in multiple places, but has precedent in the way autoinfo
works. There should probably be a bigger refactor to handle this
kind of state better.

* Return early on anything other than `mi` and `ma` for autoinfo

* Remove "ascii" from help text with `mi` and `ma`

* Update helix-term/src/ui/editor.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
Bram 40eb1268c7
Close some popups automatically (#1285)
* Add Event::Used to use event callback without consuming

* Close popup if contents ignored event

* collect event results before executing callbacks

* don't add new result variant, use Ignored(..) instead

* break in match cases

* Make auto_close configurable

* fix merge

* auto close hover popups

* fix formatting
2 years ago
Matouš Dzivjak afec54485a
feat(commands): command palette (#1400)
* feat(commands): command palette

Add new command to display command pallete that can be used
to discover and execute available commands.

Fixes: https://github.com/helix-editor/helix/issues/559

* Make picker take the whole context, not just editor

* Bind command pallete

* Typable commands also in the palette

* Show key bindings for commands

* Fix tests, small refactor

* Refactor keymap mapping, fix typo

* Ignore sequence key bindings for now

* Apply suggestions

* Fix lint issues in tests

* Fix after rebase

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
Blaž Hrastnik bd549d8a20 Merge remote-tracking branch 'origin/master' into debug 2 years ago
Gokul Soumya bf773db451 Show infobox with register contents 2 years ago
Blaž Hrastnik 62561e9d23 Stop collecting highlight_iter events then turning back into iter 2 years ago
Blaž Hrastnik 5aead46f4b Remove some unnecessary clippy tags 2 years ago
Blaž Hrastnik 2a7ae963e1 Automatically commit changes to history if not in insert mode
Fixes #1500
2 years ago
Blaž Hrastnik e2d2f19fd0
Merge pull request #1154 from sudormrfbin/cursor-shape-new
Change cursor shape on mode change
2 years ago
Blaž Hrastnik add3be8528 Slicing micro-optimization 2 years ago
Blaž Hrastnik 11c3ba9350 Speed up ensure_next_boundary during render
This code:

    let start = ensure_grapheme_boundary_next(text, text.byte_to_char(start));
    let end = ensure_grapheme_boundary_next(text, text.byte_to_char(end));

Would convert byte to char index, but then internally immediately convert back
to byte index, operate on it, then convert it to char index.

This change reduces the amount of time spent in ensure_grapheme_boundary from
29% to 2%.
2 years ago
Blaž Hrastnik 6728e44490 syntax: Split parsing and highlighting 2 years ago
Mathis Brossier f5b0821860
Fix panics when resizing (#1408)
* Change buffer.get & buffer.get_mut to return Option, Implement Trait Index & IndexMut to panic

* Prevent FilePicker from drawing outside buffer (rust panics)

* apply suggestion

* add function in_bounds to avoid useless calculations

Co-authored-by: mathis <mathis.brossier@universite-paris-saclay.fr>
2 years ago
Gokul Soumya 449624965b Merge branch 'master' into cursor-shape-new 3 years ago
Kirawi 93a948d889
switch redundant current! usage to doc! (#1416) 3 years ago
Matouš Dzivjak 4b0b1a5657
feat(ui): file encoding in statusline (#1355)
* feat(ui): file encoding in statusline

Display file encoding in statusline if the encoding
isn't UTF-8.

* Re-export encoding_rs from core

From there it can be imported by other mods
that rely on it.
3 years ago
BB 60f3225c7f
Truncate the start of file paths in the StatusLine (#1351)
* Truncate the start of file paths in the StatusLine

* cargo fmt

Co-authored-by: Bódi Balázs <97936@4ig.hu>
3 years ago
Gokul Soumya c0bbadcaaf Manually draw all block cursors 3 years ago
Gokul Soumya d4fb1d0633 Merge branch 'master' into cursor-shape-new 3 years ago
Gokul Soumya 016640f4fb Remove ui.cursor.primary and hashmap lookups 3 years ago
Blaž Hrastnik 730d3be201 Add ui.gutter to theme all gutters (i.e. set bg) 3 years ago
Omnikar e91d357fae
Macros (#1234)
* Macros WIP

`helix_term::compositor::Callback` changed to take a `&mut Context` as
a parameter for use by `play_macro`

* Default to `@` register for macros

* Import `KeyEvent`

* Special-case shift-tab -> backtab in `KeyEvent` conversion

* Move key recording to the compositor

* Add comment

* Add persistent display of macro recording status

When macro recording is active, the pending keys display will be shifted
3 characters left, and the register being recorded to will be displayed
between brackets — e.g., `[@]` — right of the pending keys display.

* Fix/add documentation
3 years ago
Oskar Nehlin a06871a689
feat: Make it possible to keybind `TypableCommands` (#1169)
* Make TypableCommands mappable

* Fix pr comments

* Update PartialEq implementation
3 years ago
Blaž Hrastnik 34f46e7502 Bump rust to 1.57, fix new lint failures 3 years ago
Blaž Hrastnik dfd499f5a9 dap: Highlight line of current stack frame 3 years ago
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.
3 years ago
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.
3 years ago
Blaž Hrastnik 7bbf4c5b06 ui: Only calculate span styling when it's actually in bounds 3 years ago
Blaž Hrastnik 96ae5897a1 Remove another parameter from render_view 3 years ago
Blaž Hrastnik 30ac5869df dap: Extract diagnostics gutter into gutters.rs 3 years ago
Blaž Hrastnik 8ffafb826f dap: Rewrite breakpoints so that there's a single set maintained 3 years ago
Blaž Hrastnik 3633f85b38 Pass editor into render_view & gutter, reducing the number of params 3 years ago
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
3 years ago
Blaž Hrastnik 9ed930b233 Merge remote-tracking branch 'origin/master' into debug 3 years ago
Blaž Hrastnik 225e8ccf31 Extract gutters into helix-view 3 years ago
Blaž Hrastnik 27c1a84f05 Reuse a text buffer for each gutter line 3 years ago
Blaž Hrastnik ba45db84d4 Tie the GutterFn lifetime to the doc so we can avoid cloning data 3 years ago
Blaž Hrastnik 30171416cb Gutter functions 3 years ago
Gokul Soumya 7961355ba1 Change cursor shape on mode change
Fixes #323. Due to terminal limitations we can only
change the shape of the primary cursor.
3 years ago
Blaž Hrastnik 85b4410703 dap: Toggle breakpoints without changing selection, fix offset calc 3 years ago
Blaž Hrastnik 28fd704bce ui: Since diagnostics are sorted, we can use binary search 3 years ago
Blaž Hrastnik 5f329a22c4 dap: Modify breakpoints in place with no cloning 3 years ago
Blaž Hrastnik d1854d8e6a Merge remote-tracking branch 'origin/master' into debug 3 years ago
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
3 years ago
Blaž Hrastnik 8db6fffe90 ui: Increase diagnostics sideline width to 100 max and wrap if needed 3 years ago
ath3 35c974c9c4
Implement "Goto last modification" command (#1067) 3 years ago
Cole Helbling b74912ea78 helix-term/editor: display scratch buffer name in status bar 3 years ago
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`
3 years ago
Blaž Hrastnik 8b85903116 wip 3 years ago
Blaž Hrastnik 5938ab1bf1 dap: Fully extract template parameter prompts 3 years ago
Blaž Hrastnik 64bb1f7563 dap: Extract out variable rendering
Will improve on the UI later
3 years ago
Blaž Hrastnik e2a23ac0b5 If there is no live debugger, treat breakpoints as unverified 3 years ago
Blaž Hrastnik 2e1aa5f15b Fix compilation 3 years ago
Blaž Hrastnik 14a3502cf1 dap: Move template selection into a picker
It's time to move all these components out of ui/editor.rs
3 years ago
Blaž Hrastnik f2b709a3c3 Merge branch 'master' into debug 3 years ago
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
3 years ago
Blaž Hrastnik e2560f427e Replace documents SlotMap with BTreeMap 3 years ago
Blaž Hrastnik e5de103728 Extract a clear_completion method 3 years ago
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>
3 years ago
Blaž Hrastnik acc5ac5e73 fix warning 3 years ago
Blaž Hrastnik 3edca7854e completion: fully revert state before apply & insertText common prefix 3 years ago
Blaž Hrastnik cee7ad781e Mark a few functions as `const` 3 years ago
Blaž Hrastnik 0a6b60085a Merge branch 'master' into debug 3 years ago
Blaž Hrastnik f692ede2b7 fix: Don't crash on empty completion, don't retrigger on close 3 years ago
Blaž Hrastnik 66f26e82ce Filter the initial completion 3 years ago
Blaž Hrastnik 40abec80e1 Experiment with autocompletion on idle 3 years ago
Blaž Hrastnik f99bea404f idle timer wip 3 years ago
Dmitry Sharshakov bf53aff27d Merge branch 'master' into debug 3 years ago
Blaž Hrastnik dd0b15e1f1 syntax: Properly handle injection-regex for language injections 3 years ago
Blaž Hrastnik 72cf86e462 Regex prompts should have a history with a specifiable register 3 years ago
Dmitry Sharshakov 507a1f8dd6 Get breakpoint reports from debugger 3 years ago
Dmitry Sharshakov 0add0c5639
Make conditional logpoints underlined 3 years ago
Dmitry Sharshakov 0e1e4edc5e different display for conditional logpoints 3 years ago
Dmitry Sharshakov 8a609047c3 Mouse command for editing logpoint 3 years ago
Dmitry Sharshakov 3b0ec750ff Support editing breakpoint condition with right click 3 years ago
Gokul Soumya 183dcce992
Add a sticky mode for keymaps (#635) 3 years ago
Dmitry Sharshakov 1befbd076c Add command for editing breakpoint condition 3 years ago
Dmitry Sharshakov 698583c241 Support setting breakpoints with mouse 3 years ago
Blaž Hrastnik b997d2cdeb dap: Allow setting breakpoints before starting the adapter 3 years ago
Dmitry Sharshakov 2c89107349
Fix crash when stack trace not loaded
Still doesn't address the issue though
3 years ago
Dmitry Sharshakov 5b20f6020a Merge remote-tracking branch 'origin/master' into debug
Contains type fix on helix-term/src/ui/editor.rs:752:13
3 years ago
gbaranski 9c5752cbac fix: use .cursor() instead of .head 3 years ago
gbaranski b590504143 fix: use head instead of anchor for relative line 3 years ago
Blaž Hrastnik 0b0b1d850a dap: Stop comparing file paths per line number 3 years ago
Blaž Hrastnik 2c7b75475f dap: refactor frame handling 3 years ago
Omnikar 03ad9e0bfa
Fix code indentation (#671) 3 years ago
Dmitry Sharshakov b42631942b
Defaults in completions, better schema 3 years ago
Dmitry Sharshakov f53d8411cb
Add extra annotations to completions 3 years ago
Dmitry Sharshakov 98fda6b8f0
better completion 3 years ago
Dmitry Sharshakov 9d2f2a9e32
Support multiple arguments for debug configs 3 years ago
Dmitry Sharshakov 2d42766a71
wip: refactor parameters in UI start 3 years ago
Dmitry Sharshakov af657ef2ec
Fix lints 3 years ago
Dmitry Sharshakov 94901b8677
Customized completion for template parameters 3 years ago