Commit Graph

328 Commits (04a4033b6c46e072eebb8b8bf1ec1745022d482d)

Author SHA1 Message Date
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>
2022-03-01 10:29:22 +09:00
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
2022-02-23 12:46:12 +09:00
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>
2022-02-17 14:03:11 +09:00
Blaž Hrastnik bd549d8a20 Merge remote-tracking branch 'origin/master' into debug 2022-02-13 18:31:51 +09:00
Gokul Soumya bf773db451 Show infobox with register contents 2022-02-10 10:52:06 +09:00
Blaž Hrastnik 62561e9d23 Stop collecting highlight_iter events then turning back into iter 2022-01-30 22:38:44 +09:00
Blaž Hrastnik 5aead46f4b Remove some unnecessary clippy tags 2022-01-30 22:38:44 +09:00
Blaž Hrastnik 2a7ae963e1 Automatically commit changes to history if not in insert mode
Fixes #1500
2022-01-30 22:38:44 +09:00
Blaž Hrastnik e2d2f19fd0
Merge pull request #1154 from sudormrfbin/cursor-shape-new
Change cursor shape on mode change
2022-01-23 16:35:22 +09:00
Blaž Hrastnik add3be8528 Slicing micro-optimization 2022-01-23 16:04:26 +09:00
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%.
2022-01-23 16:04:12 +09:00
Blaž Hrastnik 6728e44490 syntax: Split parsing and highlighting 2022-01-23 16:00:24 +09:00
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>
2022-01-16 10:55:28 +09:00
Gokul Soumya 449624965b Merge branch 'master' into cursor-shape-new 2022-01-06 11:32:03 +05:30
Kirawi 93a948d889
switch redundant current! usage to doc! (#1416) 2022-01-03 10:46:57 +09:00
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.
2021-12-26 00:10:46 +09:00
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>
2021-12-25 14:24:29 +09:00
Gokul Soumya c0bbadcaaf Manually draw all block cursors 2021-12-23 11:56:52 +05:30
Gokul Soumya d4fb1d0633 Merge branch 'master' into cursor-shape-new 2021-12-18 08:33:15 +05:30
Gokul Soumya 016640f4fb Remove ui.cursor.primary and hashmap lookups 2021-12-18 08:26:11 +05:30
Blaž Hrastnik 730d3be201 Add ui.gutter to theme all gutters (i.e. set bg) 2021-12-14 00:52:15 +09:00
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
2021-12-12 21:16:48 +09:00
Oskar Nehlin a06871a689
feat: Make it possible to keybind `TypableCommands` (#1169)
* Make TypableCommands mappable

* Fix pr comments

* Update PartialEq implementation
2021-12-04 20:17:18 +05:30
Blaž Hrastnik 34f46e7502 Bump rust to 1.57, fix new lint failures 2021-12-03 12:48:07 +09:00
Blaž Hrastnik dfd499f5a9 dap: Highlight line of current stack frame 2021-12-01 19:23:42 +09:00
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
Blaž Hrastnik 96ae5897a1 Remove another parameter from render_view 2021-12-01 01:08:52 +09:00
Blaž Hrastnik 30ac5869df dap: Extract diagnostics gutter into gutters.rs 2021-11-30 17:56:00 +09:00
Blaž Hrastnik 8ffafb826f dap: Rewrite breakpoints so that there's a single set maintained 2021-11-30 17:56:00 +09:00
Blaž Hrastnik 3633f85b38 Pass editor into render_view & gutter, reducing the number of params 2021-11-30 16:47:46 +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 9ed930b233 Merge remote-tracking branch 'origin/master' into debug 2021-11-30 13:06:30 +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
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.
2021-11-24 12:26:49 +05:30
Blaž Hrastnik 85b4410703 dap: Toggle breakpoints without changing selection, fix offset calc 2021-11-22 16:30:35 +09:00
Blaž Hrastnik 28fd704bce ui: Since diagnostics are sorted, we can use binary search 2021-11-22 11:26:16 +09:00
Blaž Hrastnik 5f329a22c4 dap: Modify breakpoints in place with no cloning 2021-11-22 11:09:09 +09:00
Blaž Hrastnik d1854d8e6a Merge remote-tracking branch 'origin/master' into debug 2021-11-21 20:06:45 +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
Blaž Hrastnik 8b85903116 wip 2021-11-08 10:03:08 +09:00
Blaž Hrastnik 5938ab1bf1 dap: Fully extract template parameter prompts 2021-11-07 18:13:37 +09:00
Blaž Hrastnik 64bb1f7563 dap: Extract out variable rendering
Will improve on the UI later
2021-11-07 17:55:01 +09:00
Blaž Hrastnik e2a23ac0b5 If there is no live debugger, treat breakpoints as unverified 2021-11-07 00:48:34 +09:00
Blaž Hrastnik 2e1aa5f15b Fix compilation 2021-11-07 00:32:28 +09:00
Blaž Hrastnik 14a3502cf1 dap: Move template selection into a picker
It's time to move all these components out of ui/editor.rs
2021-11-07 00:28:57 +09:00
Blaž Hrastnik f2b709a3c3 Merge branch 'master' into debug 2021-11-07 00:28:19 +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 0a6b60085a Merge branch 'master' into debug 2021-10-17 13:51:56 +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
Dmitry Sharshakov bf53aff27d Merge branch 'master' into debug 2021-09-25 23:14:59 +03: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
Dmitry Sharshakov 507a1f8dd6 Get breakpoint reports from debugger 2021-09-06 08:47:54 +03:00
Dmitry Sharshakov 0add0c5639
Make conditional logpoints underlined 2021-09-05 15:12:13 +03:00
Dmitry Sharshakov 0e1e4edc5e different display for conditional logpoints 2021-09-05 08:51:33 +03:00
Dmitry Sharshakov 8a609047c3 Mouse command for editing logpoint 2021-09-05 08:50:03 +03:00
Dmitry Sharshakov 3b0ec750ff Support editing breakpoint condition with right click 2021-09-05 08:14:17 +03:00
Gokul Soumya 183dcce992
Add a sticky mode for keymaps (#635) 2021-09-05 12:55:13 +09:00
Dmitry Sharshakov 1befbd076c Add command for editing breakpoint condition 2021-09-04 22:57:58 +03:00
Dmitry Sharshakov 698583c241 Support setting breakpoints with mouse 2021-09-04 21:14:24 +03:00
Blaž Hrastnik b997d2cdeb dap: Allow setting breakpoints before starting the adapter 2021-09-03 13:26:30 +09:00
Dmitry Sharshakov 2c89107349
Fix crash when stack trace not loaded
Still doesn't address the issue though
2021-09-02 19:58:03 +03:00
Dmitry Sharshakov 5b20f6020a Merge remote-tracking branch 'origin/master' into debug
Contains type fix on helix-term/src/ui/editor.rs:752:13
2021-08-31 21:29:11 +03: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
Blaž Hrastnik 0b0b1d850a dap: Stop comparing file paths per line number 2021-08-30 11:22:26 +09:00
Blaž Hrastnik 2c7b75475f dap: refactor frame handling 2021-08-30 11:07:59 +09:00
Omnikar 03ad9e0bfa
Fix code indentation (#671) 2021-08-30 09:15:49 +09:00
Dmitry Sharshakov b42631942b
Defaults in completions, better schema 2021-08-29 14:51:47 +03:00
Dmitry Sharshakov f53d8411cb
Add extra annotations to completions 2021-08-29 14:06:36 +03:00
Dmitry Sharshakov 98fda6b8f0
better completion 2021-08-29 13:16:57 +03:00
Dmitry Sharshakov 9d2f2a9e32
Support multiple arguments for debug configs 2021-08-29 13:06:22 +03:00
Dmitry Sharshakov 2d42766a71
wip: refactor parameters in UI start 2021-08-29 10:23:36 +03:00
Dmitry Sharshakov af657ef2ec
Fix lints 2021-08-28 19:15:13 +03:00
Dmitry Sharshakov 94901b8677
Customized completion for template parameters 2021-08-28 19:11:19 +03:00
Dmitry Sharshakov ef155e62ef
Add filename autocomplete to template args 2021-08-28 15:36:16 +03:00
Dmitry Sharshakov e315394631
Merge remote-tracking branch 'origin/master' into debug 2021-08-28 14:59:26 +03:00
Dmitry Sharshakov 8df6739759
New way of starting debug sessions 2021-08-28 14:23:54 +03:00
Dmitry Sharshakov 5e4da09be2
Don't let picker be too narrow 2021-08-28 13:55:52 +03:00
Dmitry Sharshakov 890b51b568
Paginated variables 2021-08-28 10:13:19 +03:00
Grzegorz Baranski cec5d437d8
fix: show current line number even if relative line is on (#656) 2021-08-26 23:18:33 +05:30
Dmitry Sharshakov c7759a5aa0
Merge remote-tracking branch 'origin/master' into debug 2021-08-25 19:22:01 +03:00