Commit Graph

310 Commits (1540b37f3455326f9b0052f137f9e565f936dc12)

Author SHA1 Message Date
wojciechkepka ac1e98d088 Add ability to theme cursor 3 years ago
Blaž Hrastnik 9706f1121d Fix small screen panics 3 years ago
Nathan Vegdahl 481c4ba044 Increment char_index by grapheme char count.
It was just assuming single-char graphemes before.
3 years ago
Joe Neeman fd1ae35051 Make the prompt callback take a Context. 3 years ago
Lionel Flandrin b56174d738 Implement change_current_directory command 3 years ago
Blaž Hrastnik 20f33ead67 minor: Remove old TODOs 3 years ago
Blaž Hrastnik a70de6e980
Merge pull request #224 from helix-editor/line_ending_detection
Line ending detection
3 years ago
wojciechkepka cc357d5096 Add progress spinners to status line 3 years ago
wojciechkepka b2804b14b1 Add a `Spinner` 3 years ago
Nathan Vegdahl e686c3e462 Merge branch 'master' of github.com:helix-editor/helix into line_ending_detection
Rebasing was making me manually fix conflicts on every commit, so
merging instead.
3 years ago
Nathan Vegdahl 4efd6713c5 Work on moving code over to LineEnding instead of assuming '\n'.
Also some general cleanup and some minor fixes along the way.
3 years ago
wojciechkepka fc39a6c40d Add comment, statusline + commandline = 2 3 years ago
wojciechkepka 0882712b45 Use full screen size 3 years ago
wojciechkepka 980e602352 Make completion window move to top when cursor is below half 3 years ago
Nathan Vegdahl 5d22e3c4e5 Misc fixes and clean up of line ending detect code. 3 years ago
Blaž Hrastnik 34ebe82654 ui: prompt: Add more keymappings 3 years ago
Blaž Hrastnik e9a3245aae Re-export unicode crates from helix_core 3 years ago
Blaž Hrastnik 9275021497 ui: prompt: Better unicode support
We copied over eval_movement from wezterm, that already solves most of
our problems. self.cursor is now byte-based.
3 years ago
wojciechkepka 2d629a880c Fix overflow 3 years ago
wojciechkepka a2db161d5a Add theme completer 3 years ago
wojciechkepka ce97a2f05f Add ability to change theme on editor 3 years ago
Blaž Hrastnik 10f9f72232 Revert "Refactor key into helix-view"
Did not use defaults when custom keymap was used

This reverts commit ca806d4f85.
3 years ago
Jan Hrastnik cdd9347457 Merge remote-tracking branch 'origin/master' into line_ending_detection 3 years ago
Ivan Tham ca806d4f85 Refactor key into helix-view
Now also make use of Deserialize for Config.
3 years ago
wojciechkepka 1c1474c3b8 Add `ui.statusline.inactive`, use `ui.statusline` for statusline text 3 years ago
Wojciech Kępka 41b07486ad
Fix expansion of `~` (#284)
* Fix expansion of `~`, dont use directory relative to cwd.

* Add `expand_tilde`

* Bring back `canonicalize_path`, use `expand_tilde` to `normalize`

* Make `:open ~` completion work

* Fix clippy

* Fold home dir into tilde in Document `realitve_path`
3 years ago
Benoît CORTIER 42142cf680 Fix panic when entering unicode in command prompt
It was attempted to use `String::insert` and `String::remove` to insert
without taking care of unicodes.

Fixes https://github.com/helix-editor/helix/issues/282
3 years ago
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.
3 years ago
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
3 years ago
Jan Hrastnik a4f5a0134e trying out line ending helper functions in commands.rs 3 years ago
Jan Hrastnik 3756c21bae rebase on branch line_ending_detection 3 years ago
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
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
Ivan Tham 002f1ad397 Add filter ability to picker
Inspired by doom emacs. Able to filter picker options multiple times.
3 years ago
Nathan Vegdahl 4faf1d3bf4 Remove indent style status-line display for now. 3 years ago
Nathan Vegdahl 358ea6a37c Implement command to change the indent-style setting of a document. 3 years ago
Nathan Vegdahl 8648e483f7 Render indent-style status in status line.
Also cleaned up the status line code a little.
3 years ago
Ivan Tham 1bda454149 Add ctrl-w for prompt 3 years ago
Gokul Soumya f33aaba53f Add ui.selection to theme.toml
Enables changing the color of the selection which was previously
hard coded.
3 years ago
Blaž Hrastnik d545e61644 ui: Prompt should figure out a reasonable column width
Fixes #192
Refs #225
3 years ago
Wojciech Kępka d8b5d1181f Add `Copy` derive to `PromptEvent` 3 years ago
Wojciech Kępka b500a2a138 commands: Add more write commands 3 years ago
Ivan Tham 1953588873 Change picker horizontal split to h
Follow window mode and vim behavior, x seemed weird.
3 years ago
wojciechkepka 4dbc23ff1c Fix documentation popup panic 3 years ago
Kevin Sjöberg b20e4a108c Only enforce limit outside of .git 3 years ago
Kevin Sjöberg 1bb9977faf Match keybindings of menu 3 years ago
Kevin Sjöberg 29962a5bd9 Fix Shift-Tab for moving upwards in menu 3 years ago
Blaž Hrastnik 83723957fe Fix crash when too many completions available
Refs #81
3 years ago
Zheming Li ae51065213 Support go to line 1 3 years ago
Wojciech Kępka 1bffb34350 Make matching bracket dimmed, prevent out of bounds rendering 3 years ago
Kevin Sjöberg 08f50310bd Bump file picker limit 3 years ago
Wojciech Kępka 6fc0e0b5fb completion: Fix unimplemented autocomplete 3 years ago
Blaž Hrastnik 3cee0bf200 Address clippy lint 3 years ago
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`.
3 years ago
Blaž Hrastnik 14830e75ff Revert the line number rendering change, we were correct before 3 years ago
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
3 years ago
Wojciech Kępka 16b1cfa3be Add diagnostics keybindings 3 years ago
Kevin Sjöberg 3494bb8ef0 Refactor index assignment
Co-authored-by: Ivan Tham <pickfire@riseup.net>
3 years ago
Kevin Sjöberg a4ff8cdd8a Allow moving backwards in completions 3 years ago
Kevin Sjöberg 145bc1970a Trigger directory completion upon pressing Enter 3 years ago
Kevin Sjöberg aa8a8baeeb Calculate offset when moving picker cursor 3 years ago
Kevin Sjöberg 2ac496f919 Do not move past number of matches 3 years ago
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
3 years ago
Kirawi c17dcb8633
Fixing Multiple Panics (#121)
* init

* wip

* wip
3 years ago
Blaž Hrastnik f2e554d761 matchbrackets: Needs to render with the viewport offset 3 years ago
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.
3 years ago
Jan Hrastnik c1c3750d38 key is now modified in place at start of handle_event 3 years ago
Jan Hrastnik daad8ebe12 key_canonicalization now only matches chars 3 years ago
Jan Hrastnik 68abc67ec6 put the key canonicalization in a seperate function. only chars now get stripped of Shift modifier 3 years ago
Jan Hrastnik 712f25c2b9 removed shift matching 3 years ago
notoria c3a98b6a3e Highlight matching brackets 3 years ago
Blaž Hrastnik 661dbdca57 Fix cursor not showing on (0, 0) 3 years ago
Blaž Hrastnik c0332bd935 Fix split sizes getting out of sync with the terminal size, refs #69 3 years ago
Blaž Hrastnik a2147fc7d5 Change help prompt styling 3 years ago
Blaž Hrastnik 87d0617f3b Completion: Format docs tabs & highlight in the doc's native language 3 years ago
Blaž Hrastnik 3810650a6b Completion: Render non-markdown docs too 3 years ago
Blaž Hrastnik d54ae09d3b ESC should exit both completion and insert mode 3 years ago
Blaž Hrastnik d708efe275 Fix cursor positioning for prompts 3 years ago
Blaž Hrastnik 3336023614 ui: Menu rendering adjustments 3 years ago
Blaž Hrastnik 094203c74e Update deps, introduce the new tree-sitter lifetimes 3 years ago
Blaž Hrastnik b114cfa119 Display more data in completion popups. 3 years ago
Blaž Hrastnik 51d1d43289 Double the UI picker file limit. 3 years ago
Blaž Hrastnik 8949347e2c Completion: apply additionalTextEdits.
Used for adding imports to the file when completing.
3 years ago
Blaž Hrastnik fae2127a11 Drop cx.view_id, it was used before we had cx.current. 3 years ago
Blaž Hrastnik ccdebb99b5 Drop some useless imports. 3 years ago
Blaž Hrastnik ff4c1d05de Replace the Clear widget with buffer.clear/clear_with. 3 years ago
Blaž Hrastnik 1255bcb8a3 Simplify the compositor callback. 3 years ago
Blaž Hrastnik 0fe19ae472 clippy lint 3 years ago
Blaž Hrastnik d24844b73d ui: Render command mode doc text if available. 3 years ago
Blaž Hrastnik f0712479cb Define text color (mostly) in theme.toml. 3 years ago
Blaž Hrastnik f87dee926a Simplify prompt autocompletion rendering code. 3 years ago
Blaž Hrastnik ff84c8e394 Command mode: Per command completers. 3 years ago
Blaž Hrastnik 7c915dc065 Add the :new command, don't crash if saving without filename. 3 years ago
Blaž Hrastnik fd4fd12fa3 clippy lint 3 years ago
Blaž Hrastnik 355ad3cb82 Tokio migration. 3 years ago
Blaž Hrastnik 3038c2ef6d ui: Draft for completion doc preview. 3 years ago
Blaž Hrastnik d559199cec Stop crashing if last view is closed. 3 years ago
Blaž Hrastnik 28c167d71d doc: Be smarter about calculating modified status.
This way edit -> undo will properly show up as unmodified.
3 years ago
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.
3 years ago
Blaž Hrastnik 811f952a41 Center search results. 3 years ago
Blaž Hrastnik 7493d19098 Re-introduce clearing with bg color, seems the TUI issue was fixed. 3 years ago
Blaž Hrastnik 73f4abbb37 N as extend with search (for now, N should be search_prev). 3 years ago
Blaž Hrastnik 978f5114d8 Horizontal scrolling! It only took a year to get around to it. 3 years ago
Blaž Hrastnik d692390d10 Render current line:col. 3 years ago
Blaž Hrastnik 52da68e49a Render a separator between vertical splits. 3 years ago
Blaž Hrastnik 8b33ba2284 Correct the naming issue with vsplit and hsplit being swapped. 3 years ago
Blaž Hrastnik f0d49d3ca4 hack: make queries load relative to source dir for now.
We want to provide a runtime dir later on.
3 years ago
Blaž Hrastnik 31e6bcbeb4 Clippy lint: replace with default -> take 3 years ago
Blaž Hrastnik e8298a398c Fix selection rendering, it would be off by 1 if reverse. 3 years ago
Blaž Hrastnik 0e9ecccfc1 clippy: Drop or-patterns for now because they're not on stable rust yet 3 years ago
Blaž Hrastnik 7c44443994 Handle c-n, c-p, etc. autocompletion events. 3 years ago
Blaž Hrastnik 95d0bba81a ui: Improve completion state handling. 3 years ago
Blaž Hrastnik cc058ad78f Simplify some code. 3 years ago
Blaž Hrastnik 0dbd5b61ef Simplify code by providin cx.current() = (view, doc). 3 years ago
Blaž Hrastnik ceea5eacd8 clippy lint 3 years ago
Blaž Hrastnik 6c4093c946 Weave through view_id references so that views into one file have independent selects. 3 years ago
Blaž Hrastnik 1b5316ea74 Track document modified state. 3 years ago
Blaž Hrastnik 88bb7a1f38 Repeat insert command (.). 3 years ago
Blaž Hrastnik e833d65b77 Teach file picker how to find the project root (.git). 3 years ago
Blaž Hrastnik 8098e9bdcd Allow setting a status message. 3 years ago
Blaž Hrastnik 742b3a709f Store intra-files jumps (goto) on the jumplist. 3 years ago
Blaž Hrastnik 5c2d2fda21 Wire up opening in splits via pickers. 3 years ago
Blaž Hrastnik aefafc25cd Replace Mode::Goto with just using on_next_key. 3 years ago
Blaž Hrastnik a24c3fff54 Filter the completion menu based on text entered. 3 years ago
Blaž Hrastnik 2a3910c1d9 wip: Async async. Delay response handling with a callback. 3 years ago
Blaž Hrastnik ad3325db8e minor: Remove a few unwraps. 3 years ago
Blaž Hrastnik e3c4edae32 Add the machinery to load syntax config from TOML.
It's embedded into the binary at build time for now, but it's progress.
3 years ago
Blaž Hrastnik 350081a3af Fix crash if pressing enter when nothing selected in completion. 3 years ago
Blaž Hrastnik 915fd9ebaf Restore buffer_picker. 3 years ago
Blaž Hrastnik 8a0ab447ec editor.open can now either replace the current view or open in a split. 3 years ago
Blaž Hrastnik 8328fe926d Drop refcell use, make view simply ref doc.id. 3 years ago
Blaž Hrastnik 3f9a94fd43 ui: markdown: remove trailing blank line. 3 years ago
Blaž Hrastnik bf95ee27aa Store Document on the Editor type, make View reference it. 3 years ago
Blaž Hrastnik 5e6716c89c Add tab_width and indent_unit config. 3 years ago
Blaž Hrastnik 698e4ddea4 clippy: Factor out a Completion type. 3 years ago
Blaž Hrastnik cbcacb1063 Merge some imports. 3 years ago
Blaž Hrastnik a32806b490 Improve completion: src/<tab> will now correctly complete to src/main.rs 3 years ago
Blaž Hrastnik f29f01858d Implement iter() and len() directly on Selection. 3 years ago
Blaž Hrastnik c331721565 Finish hiding doc.state / State as an implementation detail. 3 years ago
Blaž Hrastnik 8ba1e15d29 Expose doc.syntax() via accessor. 3 years ago
Blaž Hrastnik 59e6024186 Remove State from a few more signatures. 3 years ago
Blaž Hrastnik 51c15da3c3 Hold a reference to executor on the Editor type. 3 years ago
Blaž Hrastnik d8599f3a14 ui: Syntax highlight code inside markdown popups. 3 years ago
Blaž Hrastnik 143cfe13e0 minor: TODO comment cleanup 3 years ago
Blaž Hrastnik 081e0ae8ae syntax: highlight_iter always returns Ok() 3 years ago
Blaž Hrastnik 71f899cb5b syntax: Highlight using ropes, avoiding dumping whole doc to string. 3 years ago
Blaž Hrastnik 80eca5c32f ui: Use parsed markdown contents to determine sizing. 3 years ago
Blaž Hrastnik f9b9bc04cc ui: Account for padding on markdown renderer. 3 years ago