Commit Graph

212 Commits (7e330697e194bf7a32b59ac3adefbde308c1995c)

Author SHA1 Message Date
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
Robin 44cc0d8eb0
add alternate file (#223)
* add alternate file

inspired by vim ctrl-6/kak ga commands. the alternate file is kept per view

* apply feedback from #223

* rename to last_accessed

* add ga doc

* add fail message for ga
2021-06-12 21:21:06 +09:00
Wojciech Kępka 098806ce2a
lsp: Display LSP progress messages (#216) 2021-06-11 12:42:16 +09:00
Ivan Tham 7cc13fefe9 Derive debug without feature
Note that this also removed those `finish_non_exhaustive()`.
2021-06-10 22:00:08 +09:00
notoria 1a3a924634 Implement Debug for data structure as a feature 2021-06-10 22:00:08 +09:00
Zheming Li ae51065213 Support go to line 1 2021-06-08 17:27:21 +09:00
Egor Karavaev 960bc9f134 Don't panic on LSP not starting 2021-06-08 10:02:41 +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
Wojciech Kępka 14f511da93 Create document if it doesn't exist on save 2021-06-06 17:28:09 +08:00
Blaž Hrastnik 06d8d3f55f Try to detect language when document file path is set
Fixes #91
2021-06-04 11:03:40 +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 2100f5a2c0 Address clippy lint. 2021-05-17 23:01:45 +09:00
Blaž Hrastnik 8f6f329057 If switching to a previously open buffer in the same view, keep it's old offset 2021-05-17 16:36:13 +09:00
Blaž Hrastnik c0a8b81487 Only send the document close event if we're closing the underlying buffer 2021-05-07 14:52:47 +09:00
Blaž Hrastnik c20813690f View::new is infallible, so is editor.switch/new_file. 2021-05-07 14:45:49 +09:00
Blaž Hrastnik f2c79e245b Allow switching views back to scratch buffers. 2021-05-07 14:36:37 +09:00
Blaž Hrastnik 418ee17b86 Canonicalize the path on open to avoid duplicates. 2021-05-07 14:30:23 +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 fd4fd12fa3 clippy lint 2021-05-06 17:20:00 +09:00
Blaž Hrastnik d00414f81a Start moving more LSP calls into callbacks/futures without capturing self 2021-05-06 15:08:59 +09:00
Blaž Hrastnik 355ad3cb82 Tokio migration. 2021-05-06 13:56:34 +09:00
Blaž Hrastnik bc4e54c0c4 Load config files from ~/.config/helix, fallback to defaults. 2021-04-07 23:56:20 +09:00
Blaž Hrastnik 91462af546 Allow starting hx without a file. A new blank file will be created. 2021-04-06 19:02:22 +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
Blaž Hrastnik 6c4093c946 Weave through view_id references so that views into one file have independent selects. 2021-03-31 17:17:01 +09:00
Blaž Hrastnik c1f2a14453 view: document.rs cleanup 2021-03-29 15:22:43 +09:00
Blaž Hrastnik a65395d94b Load theme from toml file. 2021-03-25 16:42:14 +09:00
Blaž Hrastnik 8657c57cf2 Trivial jumplist implementation. 2021-03-24 18:01:26 +09:00
Blaž Hrastnik 4b176caded Reset first_line when changing files. 2021-03-24 16:56:29 +09:00
Blaž Hrastnik 8a0ab447ec editor.open can now either replace the current view or open in a split. 2021-03-24 14:28:26 +09:00
Blaž Hrastnik b24cdd1295 Derive a separate ViewId type. 2021-03-24 14:03:20 +09:00
Blaž Hrastnik 8328fe926d Drop refcell use, make view simply ref doc.id. 2021-03-23 18:14:35 +09:00
Blaž Hrastnik bf95ee27aa Store Document on the Editor type, make View reference it. 2021-03-22 13:53:43 +09:00
Blaž Hrastnik cbcacb1063 Merge some imports. 2021-03-22 12:40:07 +09:00
Blaž Hrastnik 8ba1e15d29 Expose doc.syntax() via accessor. 2021-03-18 14:53:29 +09:00
Blaž Hrastnik 51c15da3c3 Hold a reference to executor on the Editor type. 2021-03-16 23:14:51 +09:00
Blaž Hrastnik e3ec5e31ec Fix goto code before merging. 2021-03-16 23:05:43 +09:00
Jan Hrastnik eadad13efa preparing for gd merge 2021-03-16 23:03:29 +09:00
Jan Hrastnik 4e461bea2f editor.open now checks if view already exists 2021-03-16 23:03:29 +09:00
Blaž Hrastnik 54a7e893b7 lsp: Wire up didClose notification on editor.close. 2021-03-16 16:27:12 +09:00
Blaž Hrastnik eca2a73ad0 lsp: Pass through language_id on didOpenTextDocument. 2021-03-16 16:13:41 +09:00
Blaž Hrastnik dd91090a1a Implement keep_selections (filter selections on regex). 2021-03-15 17:09:18 +09:00
Blaž Hrastnik bb87b08fc9 Configure language servers via LanguageConfiguration. 2021-03-14 17:14:34 +09:00
Blaž Hrastnik 8f4ff4c646 editor: We still want to be able to calculate cursor pos. 2021-03-02 15:44:09 +09:00
Blaž Hrastnik 8289bd1cb0 minor, fix clippy lint 2021-02-25 16:52:32 +09:00
Blaž Hrastnik 01907b3497 commands: Implement count for a few more commands. 2021-02-25 16:49:30 +09:00
Blaž Hrastnik 9132c6a591 Make some Document fields read-only. 2021-02-21 19:47:21 +09:00
Blaž Hrastnik 7da6bd6a71 commands: Simplify some code, only calling cx.doc() once. 2021-02-21 19:04:31 +09:00
Blaž Hrastnik 7877647cf0 Allow closing individual views. 2021-02-19 17:46:43 +09:00
Blaž Hrastnik de5170dcda Parse input counts: 10w, etc. 2021-02-09 16:39:17 +09:00
Blaž Hrastnik 5e73f83efa Implement vertical split calculations. 2021-02-09 15:59:42 +09:00
Blaž Hrastnik 8f0ddf9632 Address clippy warnings. 2021-02-05 11:43:16 +09:00
Blaž Hrastnik 446a7e5743 Don't render selections/cursors on views not in focus. 2021-02-04 16:49:55 +09:00
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.
2021-02-03 19:36:54 +09:00
Blaž Hrastnik 05c7fb98df Refactoring: move language_servers into Editor, proper load for doc. 2021-01-21 16:55:46 +09:00
Blaž Hrastnik eff6fac9ec clippy lint 2020-12-03 13:10:35 +09:00
Blaž Hrastnik b39849dde1 Refactor: Document type as a wrapper around barebones State. 2020-12-03 13:10:35 +09:00
Blaž Hrastnik 64b5b23315 Move theme from view to editor, support multiple views in editor. 2020-12-03 13:07:55 +09:00
Blaž Hrastnik b2b3083a62 Support multiple open views. 2020-12-03 13:04:42 +09:00
Blaž Hrastnik 49b4cdb566 Refactor command calling. 2020-10-16 14:37:12 +09:00
Blaž Hrastnik 49cc6c1924 Refactor Editor into Application and Editor/Workspace. 2020-10-16 12:30:46 +09:00