Commit Graph

102 Commits (11f20af25fa7335f3f49c0e33d6a2790d60c9647)

Author SHA1 Message Date
Ivan Tham ca806d4f85 Refactor key into helix-view
Now also make use of Deserialize for Config.
2021-06-19 16:37:15 +09:00
wojciechkepka 1c1474c3b8 Add `ui.statusline.inactive`, use `ui.statusline` for statusline text 2021-06-18 15:18:58 -04:00
Benoît CORTIER 8664d70e73 Replace `Editor::current` by a macro
This is necessary to workaround ownership issues across function calls.
The issue notably arised when implementing the registers into `Editor`
and I was getting annoyed again when implementing copy/pasting into
system clipboard.
The problem is addressed by using macro calls instead of function calls.
There is no notable side effect.
2021-06-18 09:38:10 +09:00
PabloMansanet f7e00cf720
Configurable keys 2 (Mapping keys to commands) (#268)
* Add convenience/clarity wrapper for Range initialization

* Add keycode parse and display methods

* Add remapping functions and tests

* Implement key remapping

* Add remapping book entry

* Use raw string literal for toml

* Add command constants

* Make command functions private

* Map directly to commands

* Match key parsing/displaying to Kakoune

* Formatting pass

* Update documentation

* Formatting

* Fix example in the book

* Refactor into single config file

* Formatting

* Refactor configuration and add keymap newtype wrappers

* Address first batch of PR comments

* Replace FromStr with custom deserialize
2021-06-17 20:08:05 +09:00
Gokul Soumya d1c8a74771 Add theme key for selected line number
Adds `ui.linenr.selected` which controls highlight of linu numbes which
have cursors on.

- Fallback to linenr if linenr.selected is missing

- Update docs and themes

- Add TODOs for themes with temporary linenr.selected
2021-06-16 15:00:14 +09:00
Ivan Tham 124514aa70 Add cursor kind to separate hidden cursor from pos
Now IME cursor position should be correct since we can still set cursor
position without drawing the cursor.
2021-06-15 23:46:21 +08:00
Benoît CORTIER 6bdf609caa Remove RwLock for registers
Registers are stored inside `Editor` and accessed without `RwLock`.
To work around ownership, I added a sister method to `Editor::current`:
`Editor::current_with_context`. I tried to modify `Editor::current`
directly but it's used at a lot of places so I reverted into this for
now at least.
2021-06-15 23:01:56 +08:00
Benoît CORTIER 6fb2d2679d Use `_impl` suffix instead of `_` prefix
Helpers / internal implementations where using the `_` prefix.
However, this prefix also suppress unused warnings.
I suggest we use the `_impl` suffix instead.
2021-06-15 02:33:12 -04:00
Nathan Vegdahl 4faf1d3bf4 Remove indent style status-line display for now. 2021-06-14 18:32:23 -07:00
Nathan Vegdahl 358ea6a37c Implement command to change the indent-style setting of a document. 2021-06-14 18:32:23 -07:00
Nathan Vegdahl 8648e483f7 Render indent-style status in status line.
Also cleaned up the status line code a little.
2021-06-14 18:32:23 -07:00
Gokul Soumya f33aaba53f Add ui.selection to theme.toml
Enables changing the color of the selection which was previously
hard coded.
2021-06-15 00:06:53 +09:00
Zheming Li ae51065213 Support go to line 1 2021-06-08 17:27:21 +09:00
Wojciech Kępka 1bffb34350 Make matching bracket dimmed, prevent out of bounds rendering 2021-06-08 17:23:05 +09:00
Blaž Hrastnik 3cee0bf200 Address clippy lint 2021-06-07 23:08:51 +09:00
Benoît CORTIER 68affa3c59 Implement register selection
User can select register to yank into with the " command.
A new state is added to `Editor` and `commands::Context` structs.
This state is managed by leveraging a new struct `RegisterSelection`.
2021-06-07 21:52:09 +09:00
Blaž Hrastnik 14830e75ff Revert the line number rendering change, we were correct before 2021-06-07 13:24:03 +09:00
ahkrr e2d780f993 fix: 2 panics while setting style + off by 1
The panics would occur because set_style 
would draw outside of the the surface. 
Both occured using `find_prev` or `till_prev`
In my case the first panic! would appear
in a terminal with around 80 columns 
in helix/README.md going to the end of the file
with `geglf(`
the second with `geglfX`
The off by one fix ensures that `find_nth_prev` 
starts at the first character to the left
2021-06-07 09:15:08 +09:00
Wojciech Kępka 16b1cfa3be Add diagnostics keybindings 2021-06-07 09:11:52 +09:00
ahkrr c5c3ec07f4 fix: panicked at 'attempt to subtract with overflow'
helix-term/src/ui/editor.rs:275:29
This would happen when the window-size was to small to display the entire width and one would start jumping forwards with f<some_char> and the beginning of the highlighted area would end up outside of the window
2021-06-06 00:01:16 +09:00
Kirawi c17dcb8633
Fixing Multiple Panics (#121)
* init

* wip

* wip
2021-06-05 12:49:19 +09:00
Blaž Hrastnik f2e554d761 matchbrackets: Needs to render with the viewport offset 2021-06-04 15:11:55 +09:00
Ivan Tham 29b9eed33c Fix panic paint mysterious matching pair
When the matching pair is out of bounds it still paints it causing an
out of bound panic. A dirty fix since it still have some issue, at least
it does not panic now.
2021-06-04 09:25:03 +09:00
Jan Hrastnik c1c3750d38 key is now modified in place at start of handle_event 2021-06-03 23:16:04 +09:00
Jan Hrastnik daad8ebe12 key_canonicalization now only matches chars 2021-06-03 23:16:04 +09:00
Jan Hrastnik 68abc67ec6 put the key canonicalization in a seperate function. only chars now get stripped of Shift modifier 2021-06-03 23:16:04 +09:00
Jan Hrastnik 712f25c2b9 removed shift matching 2021-06-03 23:16:04 +09:00
notoria c3a98b6a3e Highlight matching brackets 2021-06-03 11:40:46 +02:00
Blaž Hrastnik 661dbdca57 Fix cursor not showing on (0, 0) 2021-06-03 13:34:00 +09:00
Blaž Hrastnik c0332bd935 Fix split sizes getting out of sync with the terminal size, refs #69 2021-06-03 10:28:49 +09:00
Blaž Hrastnik d54ae09d3b ESC should exit both completion and insert mode 2021-05-29 10:37:47 +09:00
Blaž Hrastnik 094203c74e Update deps, introduce the new tree-sitter lifetimes 2021-05-28 00:00:51 +09:00
Blaž Hrastnik fae2127a11 Drop cx.view_id, it was used before we had cx.current. 2021-05-15 10:50:36 +09:00
Blaž Hrastnik f0712479cb Define text color (mostly) in theme.toml. 2021-05-07 17:42:09 +09:00
Blaž Hrastnik 7c915dc065 Add the :new command, don't crash if saving without filename. 2021-05-07 14:19:58 +09:00
Blaž Hrastnik 355ad3cb82 Tokio migration. 2021-05-06 13:56:34 +09:00
Blaž Hrastnik d559199cec Stop crashing if last view is closed. 2021-05-03 17:46:14 +09:00
Blaž Hrastnik 28c167d71d doc: Be smarter about calculating modified status.
This way edit -> undo will properly show up as unmodified.
2021-05-03 17:23:11 +09:00
Blaž Hrastnik 3e5f24a9d5 lsp: support both utf-8 and utf-16 offsets.
Still need to implement the clangd encoding negotiation, but it's
a start. Should also manually override to utf8 for pyls.
2021-04-14 15:39:31 +09:00
Blaž Hrastnik 7493d19098 Re-introduce clearing with bg color, seems the TUI issue was fixed. 2021-04-10 00:25:46 +09:00
Blaž Hrastnik 73f4abbb37 N as extend with search (for now, N should be search_prev). 2021-04-10 00:21:13 +09:00
Blaž Hrastnik 978f5114d8 Horizontal scrolling! It only took a year to get around to it. 2021-04-09 19:29:01 +09:00
Blaž Hrastnik d692390d10 Render current line:col. 2021-04-09 18:57:46 +09:00
Blaž Hrastnik 52da68e49a Render a separator between vertical splits. 2021-04-08 22:34:06 +09:00
Blaž Hrastnik f0d49d3ca4 hack: make queries load relative to source dir for now.
We want to provide a runtime dir later on.
2021-04-07 18:05:59 +09:00
Blaž Hrastnik e8298a398c Fix selection rendering, it would be off by 1 if reverse. 2021-04-07 16:57:58 +09:00
Blaž Hrastnik 7c44443994 Handle c-n, c-p, etc. autocompletion events. 2021-04-06 15:34:52 +09:00
Blaž Hrastnik 95d0bba81a ui: Improve completion state handling. 2021-04-05 18:23:37 +09:00
Blaž Hrastnik 0dbd5b61ef Simplify code by providin cx.current() = (view, doc). 2021-04-01 11:01:26 +09:00
Blaž Hrastnik ceea5eacd8 clippy lint 2021-03-31 23:42:16 +09:00