Commit Graph

300 Commits (6a3f7f2c399f0b92cef97b0c85ebe976fd7cfcac)

Author SHA1 Message Date
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
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
Gokul Soumya f33aaba53f Add ui.selection to theme.toml
Enables changing the color of the selection which was previously
hard coded.
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
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
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 d54ae09d3b ESC should exit both completion and insert mode 3 years ago
Blaž Hrastnik 094203c74e Update deps, introduce the new tree-sitter lifetimes 3 years ago
Blaž Hrastnik fae2127a11 Drop cx.view_id, it was used before we had cx.current. 3 years ago
Blaž Hrastnik f0712479cb Define text color (mostly) in theme.toml. 3 years ago
Blaž Hrastnik 7c915dc065 Add the :new command, don't crash if saving without filename. 3 years ago
Blaž Hrastnik 355ad3cb82 Tokio migration. 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 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 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 e8298a398c Fix selection rendering, it would be off by 1 if reverse. 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 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 8098e9bdcd Allow setting a status message. 3 years ago
Blaž Hrastnik aefafc25cd Replace Mode::Goto with just using on_next_key. 3 years ago
Blaž Hrastnik 2a3910c1d9 wip: Async async. Delay response handling with a callback. 3 years ago
Blaž Hrastnik 8328fe926d Drop refcell use, make view simply ref doc.id. 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 cbcacb1063 Merge some imports. 3 years ago
Blaž Hrastnik f29f01858d Implement iter() and len() directly on Selection. 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 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 872d770753 ui: Restrain diagnostic sidebar w/h based on available area. 3 years ago
Blaž Hrastnik 87e3cd3df2 ui: Render diagnostic errors in sideline. 3 years ago
Blaž Hrastnik 1cf887dea9 Cleanup: use doc.selection() instead of doc.state.selection(). 3 years ago
Blaž Hrastnik 3445abf88e syntax: Hide the TSParser internally, borrowing when needed. 3 years ago
Blaž Hrastnik b7dd7310c4 syntax: Reuse parser instances. highlight_iter() no longer needs &mut. 3 years ago
Blaž Hrastnik 9dcfe25e4a Use diagnostic.severity to distinguish between error colors. 3 years ago
Blaž Hrastnik 62c991230f find-till (f) prototype, on_next_key mode implementation. 3 years ago
Blaž Hrastnik dd6db43013 ui: Adjust selection colors. 3 years ago
Blaž Hrastnik 513effd972 ui: unsafe theme_ref is no longer needed. 3 years ago
Blaž Hrastnik 8f4ff4c646 editor: We still want to be able to calculate cursor pos. 3 years ago
Blaž Hrastnik ec4dd0a176 Add a selection mode again. 3 years ago
Blaž Hrastnik 00808afe3c ui: Make editor more resilient about being shrunk too small. 3 years ago
Blaž Hrastnik 6336c1da20 view: Reposition cursors on tree resize. 3 years ago
Blaž Hrastnik 7162632eb7 lsp: Hover documentation draft. 3 years ago
Blaž Hrastnik 7da6bd6a71 commands: Simplify some code, only calling cx.doc() once. 3 years ago
Blaž Hrastnik c9dd1c930e treewide: &RopeSlice -> RopeSlice. It's Copy so no reason to pass by ref 3 years ago
Blaž Hrastnik 9cac44c7c0 minor changes 3 years ago
Blaž Hrastnik 8e1a59c140 ui: Redo selection rendering. 3 years ago
Blaž Hrastnik de5170dcda Parse input counts: 10w, etc. 3 years ago
Blaž Hrastnik 5e73f83efa Implement vertical split calculations. 3 years ago
Blaž Hrastnik d4b85ce18d popup: wip work on completion popups 3 years ago
Blaž Hrastnik a924ad2885 simplify. 3 years ago
Blaž Hrastnik c70080dd68 Work around rendering errors for positions offscreen. 3 years ago
Blaž Hrastnik a81b8f3e42 Fix statusline rendering, change colors on active view. 3 years ago
Blaž Hrastnik a014787ee8 Correctly position the real terminal cursor. 3 years ago
Blaž Hrastnik 446a7e5743 Don't render selections/cursors on views not in focus. 3 years ago
Blaž Hrastnik 448c1abba0 View tree implementation: render multiple split views.
Cursors are still a bit buggy and we should render in focus statusbar
differently than in the other pane.
3 years ago
Blaž Hrastnik 05c7fb98df Refactoring: move language_servers into Editor, proper load for doc. 3 years ago
Blaž Hrastnik 777a80917d Address clippy lints. 4 years ago
Blaž Hrastnik 2ab069bb3f lsp: Work on syncing the state with the language server. 4 years ago
Blaž Hrastnik 56f2193811 Retrieve completion options on ctrl-x. 4 years ago
Blaž Hrastnik d61b4854b8 Make sure to clear the whole screen with the background color. 4 years ago
Blaž Hrastnik 4749b39b88 . 4 years ago
Blaž Hrastnik 0b63e838e0 Port over Doc::relative_path. 4 years ago
Blaž Hrastnik 7dc24a25ba Move ui modules under a ui:: namespace. 4 years ago