Giter VIP home page Giter VIP logo

Comments (72)

pascalkuthe avatar pascalkuthe commented on August 21, 2024 109

GUI is not a big issue. and working on a terminal like Neovim is good enough. Snippet and tree view is the main feature the helix team should think about.

We are currently not really actively working on a GUI (none of the maintainers are involved in the recent discussion on this issue) but if we were that would be good too. You may care about those features more but that doesn't matter. Opensource isn't about you. It's about what people actually working on the project want to work on.

You have no authority to dictate what other people "should" spend their time on.

from helix.

gavlig avatar gavlig commented on August 21, 2024 86

Hi all! I have been working on a sort of unconventional GUI project for Helix for quite a while now and I think what i've managed to achieve with it might interest you. It's called Kodiki and it can be found here: https://github.com/gavlig/kodiki. It is built with Bevy Engine as main platform that handles rendering, input, windows etc while Helix works as a backend and tells Bevy what to render. It's not just a GUI, initial goal of the project was to replace VSCode in my workflow, so I added some functionality that felt missing, changed some hotkeys and made a few tweaks here and there, but it's still Helix and you'll notice it from first moments. Also all changes are listed and are easy to check in fork repo: https://github.com/gavlig/helix-editor

the changelist against vanilla Helix: gavlig@d437f99

The most relevant parts in regards of UI would be here
and here (you might need to expand editor.rs, github thinks it's too big)

Brief explanation: I modified rendering to output every surface as a separate entity to not overwrite what editor rendered and just handle all surfaces in Bevy using some placement hints made on Helix side (like draw me in top left corner etc)

It was also possible to not modify rendering at all and just use the main surface made for terminal but that would just make it Helix in 3d which wasn't enough.

In the future I think I might go a bit further and make it so that Helix outputs whole words (or clusters) instead of cells to avoid redundant parsing, but that might not even be necessary after all, performance is already at more than acceptable levels as it is currently.

Cheers!

Edit: Forgot to mention that i'm more than interested in merging in any or all of those changes of course, so if there is interest in bringing any of that in, please let me know!

from helix.

Kethku avatar Kethku commented on August 21, 2024 73

That makes good sense. One thing thats been on my list for a while is to split neovide into the neovim gui, and a front end renderer so that other apps could build their own rendering. Then you could integrate it as a crate without having to do all the painful font rendering and such. Let me know if something like that would be interesting for your use cases or not. In any case, if you end up going the skia route, I'm happy to help out if you run into problems. Awesome project

from helix.

maisonbleudeluca avatar maisonbleudeluca commented on August 21, 2024 63

Any new updates about this?

from helix.

hemedani avatar hemedani commented on August 21, 2024 53

GUI is not a big issue. and working on a terminal like Neovim is good enough.
Snippet and tree view is the main feature the helix team should think about.

from helix.

Kethku avatar Kethku commented on August 21, 2024 39

I'm looking into step 2 now that step 1 has merged. Let me first say back to you what I think I understand you to mean for how we might move the commands out of helix-term. Then I will propose a slightly different strategy with some benefits and drawbacks.

Gui as a component drawer

The solution here is to make the compositor a trait so that each frontend can implement it's own. The new trait would have methods like cx.compositor.popup() so that we can manipulate UI without directly referencing the types. But I'm not sure how to handle cases like these

So what I think you are suggesting is that each frontend would create a custom compositor type which implements the Compositor trait. This trait would have functions on it for each of the custom components that are implemented in the helix-term crate today. Your example is popup, but I'm guessing this would also require picker, prompt, spinner, menu etc.

Some pros for this approach:

  • Custom more native UI can be implemented for each of these effectively giving more control to the gui
  • The gui can implement surfaces however they like. Doesn't have to have everything on a strict grid
  • This is a relatively small change assuming all of the components can be implemented as functions

Some negatives that come to mind:

  • Adding new components requires implementing them in every front end (probably just term and gui, but who knows maybe multiple front ends are created)
  • Guis could be very different in feel from each other. Would configs work the same in all of them? Neovim has this problem because often a config that works great in one gui is a complete mess in another
  • Theres a relatively large implementation burden for the guis. Even though popup and prompt are basically just rendering text in a window of some sort, they would both have to be implemented in the front end

Gui as a render surface

If we look at Neovim's approach instead, it works by defining a basic set of rendering capabilities that the gui must provide and then implements components and such on top of those basic systems. At the simplest, a neovim gui renders a single grid of characters and all of the components and such are drawn by neovim on top of that. A quick and dirty gui can be built in a couple days if you target that system.

If however more gui extensions are implemented, the rendering becomes slightly more complicated. Rather than drawing a single grid, multiple grids can be defined and drawn to. This gives the gui some more freedom to effect the size and positioning of the rendered windows, but components are still done just using that basic framework. Popups are just smaller windows which render text into them. Floating terminals are implemented on floating windows with text just the same as a dialog box.

This also separates innovation in the editor from implementation in the gui. Components can be introduced without requiring them to be implemented in every front end.

Some benefits:

  • Guis are pretty simple. Basically they are just a rendering system which components can depend on to do their drawing
  • Guis don't need to be updated to add new components
  • Many guis can be created which benefit from upstream updates and changes. Can start to build an ecosystem if there is desire to

Some drawbacks:

  • Guis can only innovate so far as the interface allows. It would require some creativity to let guis do special rendering for a given type of component
    -- maybe this can be fixed by giving each rendered window a "purpose" flag which lets the gui special case a certain component
  • Pretty significantly different approach to the current architecture. Would maybe require some intermediate steps
  • Likely locks guis into a grid based interface. I personally feel this is nice because it simplifies design and such, but I can understand why others would prefer more flexibility.

Thoughts

This has been a bit ramble-y. I hope my point was at least somewhat understandable. I'm interested in your thoughts.

from helix.

archseer avatar archseer commented on August 21, 2024 39

I'm not interested in webview-like frameworks, currently experimenting with doing the rendering in femtovg / webgpu. I also evaluated piet but looks like it'll be a while before piet-gpu is ready.

from helix.

xbladesub avatar xbladesub commented on August 21, 2024 37

What is the current state? It would be very nice if someone created something like a roadmap of what needs to be implemented and what has already been implemented. I cannot start from scratch myself as I am quite new in rust.

from helix.

Kethku avatar Kethku commented on August 21, 2024 28

Before getting into GUI, like neovide I see an issue is that users may not be able to access terminal. Which will break some users workflow. I usually do edit and then ctrl-z to run some shell commands. If we only do a GUI for helix, what if users want to run commands? Do we want to provide like sort of rendering for terminal?

To be honest, a good terminal emulator inside of helix sounds wonderful. I personally rarely dip into a terminal emulator outside of the one contained within neovim. But I think thats a large can of worms that doesn't need to happen now. What I'm interested in helping with is just making sure the design of helix is conducive to gui front ends in the long run even if its not ready yet.

There is also another possibility, getting neovide to have helix backend? Not sure how hard is that but from current viewpoint, helix does not have anything, but yeah neovide currently seemed to only be drawing the same thing as terminal, in some places it would be good to have certain way of drawing which is not possible in terminal.

I'm definitely thinking about ways to make more full fledged guis using Neovide's rendering system. What I would LOVE is to split Neovide in half so that the rendering part is just a crate which provides channels for sending draw commands and receiving input/events from the window. Then the renderer would handle everything else. Integrating that crate with an editor backend would just require writing some glue.

Neovide isn't there yet because there are lots of neovim specific-isms that would need to be moved around, but I think it would be valuable to do because features built for one editor backend would likely be useful for others.

To be honest though its kinda a pipe dream at the moment. What I was thinking in the short run is to just recreate something like neovide's rendering system for helix specifically in order to get off the ground, and then think about unifying the two later if there is interest. That way I don't impose further constraints on this project that don't really benefit this project long term

from helix.

makepaddev avatar makepaddev commented on August 21, 2024 27

Hi, creator of makepad here. Makepad is heavily work in progress and we are building our UI designer+IDE on the stack right now. But i was curious what the reason of the downvotes is. Our fontrendering is currently being worked on for internationalisation. However we dont have RTL yet and the kit is pretty rough. However i'm pretty much building 'exactly' an IDE with a filetree, dockable tabs, and an advanced code editor UI so our stack is entirely optimised for your usecase. So in that sense if what we're building isn't solving your problems i'd be curious what those are.

from helix.

univerz avatar univerz commented on August 21, 2024 24

makepad (used as framework) looks promising. (makepad.dev)

from helix.

tqwewe avatar tqwewe commented on August 21, 2024 22

I'd love if the GUI could be a little more than just the text being rendered with smoother curves/animations like neovide.
Instead, it would be great to take some inspiration from Lapce, where there's a UI file tree, command pallet, etc. All of which can be accessed via the keyboard of course, but also be used with a mouse.

from helix.

wmstack avatar wmstack commented on August 21, 2024 22

Why not incorporate the Helix keymap into Zed? Zed is just about to overtake Helix in stars, and there seems to be some interest from people over on the other side. I think that Zed is too good of a candidate, it uses tree-sitter for syntax highlighting and is written in Rust.

zed-industries/zed#4642

from helix.

pickfire avatar pickfire commented on August 21, 2024 21

@Kethku If anyone were to take on GUI probably you are the one that is most familiar with it since you did neovide. My thought is that we may want it as a render surface but with custom components. It is useful in doom emacs where you can draw something not available in the terminal.

image

Like you can see on the left, green for new lines, yellow for modified line. And one more you can see is a single red dash for removed lines, I don't think we can easily render these in terminal.

Before getting into GUI, like neovide I see an issue is that users may not be able to access terminal. Which will break some users workflow. I usually do edit and then ctrl-z to run some shell commands. If we only do a GUI for helix, what if users want to run commands? Do we want to provide like sort of rendering for terminal?

There is also another possibility, getting neovide to have helix backend? Not sure how hard is that but from current viewpoint, helix does not have anything, but yeah neovide currently seemed to only be drawing the same thing as terminal, in some places it would be good to have certain way of drawing which is not possible in terminal.

from helix.

freqmod avatar freqmod commented on August 21, 2024 21

Hi. I have a half way stab at a gui over at https://github.com/freqmod/helicoid. (it is based on the neovim codebase, but i have updated Glutin, Winit etc.) Currently it is only a prototype looking into implementing a more flexible way at semi-remote drawing (like neovim), without the constrains of a grid based layout. I have written some more abut the intended architecture and design choices in the readme of that repo.

from helix.

eternaleye avatar eternaleye commented on August 21, 2024 19

Another argument against using a character grid for documents is that it rather rules out various forms of inlays - I've seen these used very well by e.g. Error Lens in VS Code, with the font set to be significantly smaller than the source text, making it immediately distinct to the user.

from helix.

pascalkuthe avatar pascalkuthe commented on August 21, 2024 19

Building a modal editor is a really large project on its own. The entire editor needs to be but around the editing model. It's not a simple set of keybindings.

Zed and helix are their invidual projects with orthogonal goals.

from helix.

dsseng avatar dsseng commented on August 21, 2024 18

Seems to be more heavyweight than necessary. Functionality required for Helix frontend can be implemented without any web technologies. Might still be a good thing for diversity of frontends and, possibly, as initial impl.

from helix.

Shotman avatar Shotman commented on August 21, 2024 17

Since helix is done in rust, would Tauri tauri-apps/tauri be a good candidate to offer a GUI ? Has it been looked at, dismissed ?

from helix.

huytd avatar huytd commented on August 21, 2024 16

Another prototype here, this one use a "pseudo GUI" approach, not interacting directly with Helix's rendering protocol.

The idea is to spawn a Helix process, capture its stdout, render it on a GUI screen, with some additional fancy stuff like rounded corner cursor, or the editing status badge. All keyboard input will be write directly to this process's stdin.

It's not the right way but it works :D You can see the code here https://github.com/huytd/helix-ui

PS: In the screenshot above is this POC editing its own source code 😂

from helix.

Seirdy avatar Seirdy commented on August 21, 2024 16

Whichever route Helix picks, I'd hope that accessibility is a factor. It's clear that the developers want to try something new by exploring something like wgpu, but widening the accessibility gap shouldn't be a price worth paying.

As this seems to be a Rust project, perhaps AccessKit or a toolkit using AccessKit might be worth keeping an eye on.

from helix.

CBenoit avatar CBenoit commented on August 21, 2024 15

I'll pin this issue because it seems to me it could use more visibility. We currently pin two issues out of the maximum of three, so I went ahead.

from helix.

elahn avatar elahn commented on August 21, 2024 12

Character grid rendering rules out elastic tabstops with modern proportional fonts, which I would dearly love to have in a full-featured code editor.

I would also love to collaborate on helix GUIs (native, WASM) for the editor in my "revision control for everyone" project, but proportional fonts are a must-have so character grid rendering would rule out using helix.

from helix.

archseer avatar archseer commented on August 21, 2024 10

I'm making some progress on #711 again.

The goal is to move all commands out of helix-term into helix-view (or helix-commands).

I tried moving the Compositor into helix-view then splitting Component into an abstract Component trait that handles input + Render trait that's frontend specific (then components + compositor would be generic, and each component would get a render implementation per frontend). That got rather messy though since there was no easy way for components owned by the compositor to be Component + my_frontend::Render without a ton of generics on all the commands.

Instead, I'm currently trying a different approach that uses an events return value on the command context. This would allow commands to signal intent without being too specific about the UI being used to handle it so each frontend could be flexible in dealing with these events.

I'm not sure how granular this should be yet:

UI events

picker(vec<symbols>, on_select_fn, etc.)
popup(id:lsp::doc, text)

vs

metadata events

lsp::symbols(vec<symbols>, on_select_fn, ...)
lsp::doc(text)

from helix.

Kethku avatar Kethku commented on August 21, 2024 9

The more I think about it, the more I am interested in trying out something like this. You mentioned that commands are currently located in the helix-term. Are you suggesting that they would need to be moved into helix-view in order for a gui crate to consume and produce them? Are you interested in a PR which attempts that kind of refactoring?

from helix.

gbaranski avatar gbaranski commented on August 21, 2024 9

helix-term commands.rs need to be moved into helix-view. The problem there is that the context depends on the compositor written for the TUI, and some commands directly manipulate it by pushing in new components.
The solution here is to make the compositor a trait so that each frontend can implement it's own. The new trait would have methods like cx.compositor.popup() so that we can manipulate UI without directly referencing the types. But I'm not sure how to handle cases like these

let contents = ui::Markdown::new(contents, editor.syn_loader.clone());
let mut popup = Popup::new(contents);
compositor.push(Box::new(popup));

This will solve #507, I'm currently working on this.

from helix.

archseer avatar archseer commented on August 21, 2024 8

Hey! The skulpin mention was specifically after I looked at neovide, it seemed like a good fit. @norcalli wanted to experiment on a new frontend as well.

I'm a bit apprehensive on exposing a GUI protocol, they're either too vague and the client needs to re-implement a lot of the handling, or they're very specific and every client ends up the same. I don't have a solid opinion yet so we'll see. Right now the idea is that helix-view would provide most of the logic, and a frontend would just be another crate wrapping everything with a UI -- that needs some work right now though because commands are currently sitting directly in helix-term.

from helix.

Krahos avatar Krahos commented on August 21, 2024 8

Is there any chance that Helix could use pop-os cosmic text editor as UI?
I would love to see some sort of integration between the 2 projects, if technically possible.

Edit: talking about the cosmic editor in particular because it's a new project, so it might be easier to share the effort.

from helix.

A-Walrus avatar A-Walrus commented on August 21, 2024 8

Something else I thought I'd mention is that a proper GUI should allow us to support RTL and bi-directional text. See #3413.

from helix.

nyabinary avatar nyabinary commented on August 21, 2024 7

I think Iced is the way to go considering the upcoming COSMIC Desktop (made in Rust btw) is using iced

from helix.

PotatoesFall avatar PotatoesFall commented on August 21, 2024 6

@tqwewe Speaking of Lapce, the folks over there would love to integrate helix into the editor : lapce/lapce#281

edit: nevermind, this is no longer the case

from helix.

herkhinah avatar herkhinah commented on August 21, 2024 5

a server-client model would be also useful for use-cases where you have two terminals open each running a helix but want to share the same session (e.g. multi monitor set-up).

from helix.

Kethku avatar Kethku commented on August 21, 2024 4

I was a bit undecided between the two approaches. While the neovim approach works, it leads to most frontends looking very similar. (For example, while I'm aware of Neovide and looked at it's source, I haven't actually used it yet because I didn't have enough reasons to switch.)

This is a very reasonable critique of Neovim's approach. To me the difference between the two depends almost entirely on if you want to maintain the canonical gui for helix or if you want there to be many different guis which use helix as the backend. If you imagine the main helix gui is basically the only one people will use, then I agree it makes a lot of sense to have component aware logic in the gui because it can tweak the experience to feel just right. There would still be reimplimentation of logic between the terminal and gui front ends, but hopefully that wouldn't be too bad.

However if you want to enable many different front ends, I think that strategy falls apart a bit because any time you want to tweak the behavior of a given component, you have to convince all the front ends to also update their implementations. Its harder to innovate like that.

I'm definitely biased given that neovim is what I've spent the most time with, but I think the vision of a gui api which can be implemented very simply as just a grid, but then augmented with optional extensions if the gui developer wants to customize a given type of behavior is beautiful. It means that if somebody wants to make a gui which is just simple tweaks off the terminal experience, they can pretty easily. And if they want to make something that completely reworks the user experience, thats possible too with a little more effort.

A middle ground

If you are interested in building an ecosystem where multiple groups can implement guis if they want to, then it seems to me that a great way to do this would be to implement the grid based approach. Basically move all the component logic into helix-view, and tern helix-term into a super thin rendering surface. Basically just cursor moves and text on a grid. Then each of the components could be implemented as extensions optionally. If the gui wants to customize the dialog box, theres a trait they can implement for their gui which takes over drawing of dialog boxes completely. And a different trait for taking over markdown renders etc etc etc

This solution would be very similar to neovim's extension model where guis can re implement the tabline or message rendering if they want to, but the difference is that helix's implementation would be implemented with components as the basis from the start. Rather than hacking in extensions for features editors would like, helix has the benefit of starting from scratch and thinking about components as first class extension points.


All that said, these are just some quick thoughts. I'm happy to help out whichever way you end up going.

from helix.

DoctorRyner avatar DoctorRyner commented on August 21, 2024 4

I'm not that thrilled for gui but I more do wait for plugins because rn I have to keep my own fork to add features from some abandoned merge requests like file tree, heh
CleanShot 2024-03-16 at 22 35 35@2x

from helix.

jokeyrhyme avatar jokeyrhyme commented on August 21, 2024 3

@subhasishdas159 most of your comment is off-topic for this particular issue, but you might want to take a look at:

from helix.

jokeyrhyme avatar jokeyrhyme commented on August 21, 2024 3

If wgpu isn't a must (i.e. support for only OpenGL is acceptable), modifying existing alacritty code ...

It's also possible to use alacritty's abstractions over terminal internals whilst rendering with wgpu, e.g. https://github.com/pop-os/cosmic-term

from helix.

pascalkuthe avatar pascalkuthe commented on August 21, 2024 3

I may be interested in looking into non-grid layout rendering, for example fo side by side diffing non-grid rendering can unlock some nice UI improvement. This would not directly affect the text rendering that would stay grid based just one column (or row) may be filled with non-grid aligned stuff.

I was mostly interested in using something low-level like vello (as opposed to something high level like xilem).

That said all this is really far away right now as helix needs large architectural changes before writing a GUI is even feasible/a good idea.

from helix.

goyalyashpal avatar goyalyashpal commented on August 21, 2024 2

If on windows, someone just need to launch helix editor directly from start menu in a terminal other than conhost, then following may help:

  1. can create a launcher shortcut (rt click in explorer > new > shortcut) and set the target location to wezterm-gui start hx or equivalent for ur terminal of choice, give it a suitable name like "Helix"
  2. navigate to either %APPDATA% (for per user) or %ProgramData% (for all users)
  3. then from there, go to Microsoft\Windows\Start Menu\Programs\
  4. place that shortcut there...

voilla!

from helix.

Caellian avatar Caellian commented on August 21, 2024 2

If wgpu isn't a must (i.e. support for only OpenGL is acceptable), modifying existing alacritty code could provide first-grade access to terminal rendering (for terminal access). I think it's a box based renderer so stuff like gitlens might require some additional work, but text rendering would have very good (and well tested) support.

Also, more of an subscription, but still noting this here for reference.

from helix.

mabasic avatar mabasic commented on August 21, 2024 2

After using Helix for a very long time, I really don't need a GUI at all. It is perfect just as it is.

from helix.

archseer avatar archseer commented on August 21, 2024 1

If we look at Neovim's approach instead, it works by defining a basic set of rendering capabilities that the gui must provide and then implements components and such on top of those basic systems. At the simplest, a neovim gui renders a single grid of characters and all of the components and such are drawn by neovim on top of that. A quick and dirty gui can be built in a couple days if you target that system.

I was a bit undecided between the two approaches. While the neovim approach works, it leads to most frontends looking very similar. (For example, while I'm aware of Neovide and looked at it's source, I haven't actually used it yet because I didn't have enough reasons to switch.)

A character grid is a good start but is limiting if we want to experiment with inline decorations (see the CodeMirror 6 examples). These might be variable sized or won't fit perfectly in the character grid. Another example would be rust-analyzer's clickable code action links that are embedded into the view.

We're also limited by the terminal in that it's hard to render 0 width multiple selections (cursors) so selections are always 1-width or more (see #362 for more context).

I'm not even sure if the component drawer approach is flexible enough, since we might want to use completely different component types on different frontends. I guess we could allow for frontends to provide their own sets of commands that would augment the defaults with different UI. Maybe it's okay for the frontends to share the same core/view but end up being slightly different (similar to scintilla, or codemirror embedding)

I've been keeping the built-in component list short: https://github.com/helix-editor/helix/tree/master/helix-term/src/ui

Feel free to join us on Matrix to discuss further! (https://matrix.to/#/#helix-community:matrix.org, make sure to join #helix-editor:matrix.org if you can't see it on the list)


Before getting into GUI, like neovide I see an issue is that users may not be able to access terminal. Which will break some users workflow. I usually do edit and then ctrl-z to run some shell commands. If we only do a GUI for helix, what if users want to run commands? Do we want to provide like sort of rendering for terminal?

We won't only be doing a GUI, a helix-term is still going to be the primary implementation. (Well, one of two, I'd like to have the skulpin implementation as "officially supported" too). Down the road we'd want to embed a terminal, but that's quite a bit of work.

from helix.

archseer avatar archseer commented on August 21, 2024 1

There's also a previous branch here that refactors more code into helix-view and starts work on a wgpu renderer: https://github.com/helix-editor/helix/commits/gui

from helix.

tqwewe avatar tqwewe commented on August 21, 2024 1

Having Lapce support Helix directly sounds so awesome! Would make a GUI be possible much sooner. But a custom GUI with iced specifically for Helix also sounds great 😍

from helix.

paulocoghi avatar paulocoghi commented on August 21, 2024 1

@gavlig it could be interesting if you talk with @makepaddev

from helix.

gabydd avatar gabydd commented on August 21, 2024 1

I have worked a bit on gpui(mostly Linux text rendering and input) and I don't think it's a great fit for helix, mainly it's a quite a large dependency and does a lot of things that we don't need for helix we mostly just need to render text and lines and get input events everything else we can probably handle ourselves. The next big thing is gpui isn't compatible with Tokio, they use smol and a custom executor for tasks which probably wouldn't mesh well with the event system. I don't have a definitive about what we should use and it may well be possible to use gpui with helix, but it's going to take some time to get the internals in place to add another rendering backend and by that time we can make a decision that fits well within helix's architecture and doesn't lock us in to a specific model.

from helix.

7ombie avatar 7ombie commented on August 21, 2024 1

Writing a pixel shader that simply renders a grid of monospaced characters (like a terminal emulator) is pretty trivial (though rendering the glyphs can get more involved, if you want to be as efficient and correct as possible), and it'd be faster (by doing less) than using GPUI. It's also easy to swap out one (platform-specific) renderer for another, as you're only passing the state (which character is in each cell, what colors to use etc) to the GPU.

Assuming the Helix frontend retained its character/tile-based graphics, I can't see any advantage in a UI library.

from helix.

tqwewe avatar tqwewe commented on August 21, 2024 1

I just want to clarify that Zed can be built on Linux, it's just not super stable yet and they don't provide binaries for it on their downloads page.
But I personally would absolutely love to use Zed but with Helix keybindings, would be a really awesome collaboration

from helix.

archseer avatar archseer commented on August 21, 2024

So there's a few sets of changes necessary:

  • helix-view needs to be refactored to have it's own generic key/style/color structs. #345 is a start but it depends on crossterm. Using generic structs would let us drop the crossterm dependency from helix-view.

  • helix-term commands.rs need to be moved into helix-view. The problem there is that the context depends on the compositor written for the TUI, and some commands directly manipulate it by pushing in new components.

    The solution here is to make the compositor a trait so that each frontend can implement it's own. The new trait would have methods like cx.compositor.popup() so that we can manipulate UI without directly referencing the types. But I'm not sure how to handle cases like these

    let contents = ui::Markdown::new(contents, editor.syn_loader.clone());
    let mut popup = Popup::new(contents);
    compositor.push(Box::new(popup));

  • There's a bit of lsp code in term/src/application.rs that would be better off shared somewhere.

With these changes helix-view would end up holding most of the code, and -term would simply be a tiny frontend implementing the compositor & components.

from helix.

archseer avatar archseer commented on August 21, 2024

Like you can see on the left, green for new lines, yellow for modified line. And one more you can see is a single red dash for removed lines, I don't think we can easily render these in terminal.

This is doable using box drawing characters (I imagine emacs is using the same thing). https://github.com/archseer/snowflake/blob/e616d7cb24d85cf6b17b77c3e0cb1ef6c4212414/profiles/develop/neovim/init.vim#L294-L299

from helix.

archseer avatar archseer commented on August 21, 2024

I'd also like to get @cessen's opinion here as well

from helix.

cessen avatar cessen commented on August 21, 2024

A character grid is a good start but is limiting if we want to experiment with inline decorations (see the CodeMirror 6 examples). These might be variable sized or won't fit perfectly in the character grid. Another example would be rust-analyzer's clickable code action links that are embedded into the view.

I think for the document text itself, we'll want to stick with a character grid.

The short justification is: it allows the editor back-end to control text layout. The architecture I'm imagining is basically: the back-end is given the grid dimensions, it computes where to place each element within that grid and passes that information to the front-end, and then the front-end renders the described grid (wherever and however it wants). This keeps the flow of data really simple, and especially avoids the front-end needing to send text layout information back to the back-end for things like cursor movement commands (...which also applies to off-screen text thanks to multiple cursors).

In other words, it lets us keep all of the core commands in Helix independent of the front-end. Conversely, if text layout is computed by the front-end (which I think would be more-or-less required if we forego a grid), then the back-end will have to query the front-end when executing any commands that involve text positioning.

So the grid would essentially act as a text layout API between the front-end and back-end, letting us keep as much code as possible compartmentalized in the back-end. (And as a bonus, that also avoids having to rewrite the layout code for each front-end.)

but is limiting if we want to experiment with inline decorations

I don't think it's quite as limiting as you might think. The back-end would control where things are placed on the grid, but the front-end decides how to render them. So, for example, an inline element could be rendered as a fancy, nice-looking button by the GUI front-end, as long as it fits in the grid area allocated to it by the back-end.

And the front end could provide a list of "size factors" for the various kinds of inline elements, so that the back-end can ensure to allocate enough grid spaces for each kind of element.

We're also limited by the terminal in that it's hard to render 0 width multiple selections (cursors) so selections are always 1-width or more (see #362 for more context).

I have some ideas about this, that I think will be easier to demonstrate with a prototype once I've completed work on #362. Although I realize that might not be especially convincing right now, ha ha.

from helix.

cessen avatar cessen commented on August 21, 2024

If we look at Neovim's approach instead, it works by defining a basic set of rendering capabilities that the gui must provide and then implements components and such on top of those basic systems. At the simplest, a neovim gui renders a single grid of characters and all of the components and such are drawn by neovim on top of that. A quick and dirty gui can be built in a couple days if you target that system.

After re-reading this, I realized I might want to clarify: I'm only talking about individual documents, not the entire GUI layout, when I'm discussing the character grid. As far as I'm concerned, the front-end can render everything else however it wants. I'm not totally sure how we would present an API for the remaining commands (e.g. file finder, etc.), but I'm not too worried about us being able to work it out.

from helix.

valignatev avatar valignatev commented on August 21, 2024

Like you can see on the left, green for new lines, yellow for modified line. And one more you can see is a single red dash for removed lines, I don't think we can easily render these in terminal.

This is doable using box drawing characters (I imagine emacs is using the same thing). https://github.com/archseer/snowflake/blob/e616d7cb24d85cf6b17b77c3e0cb1ef6c4212414/profiles/develop/neovim/init.vim#L294-L299

FWIW, emacs can actually draw bitmaps on its fringe and in modeline, it's not restricted to whatever unicode supports: https://www.gnu.org/software/emacs/manual/html_node/elisp/Fringe-Bitmaps.html

Of course, it only works in GUI mode. I'm really interested in a proper gui for the editor as well, but I don't have anything particularly productive to add to the discussion, mostly subscribing for the thread with this emacs remark :)

Of course it would be cool to have a gui that supports custom shaders and all that crazy stuff to fully utilize its hardware acceleration capabilities (if we take neovide as a mental base, I mean)

from helix.

Kethku avatar Kethku commented on August 21, 2024

If we look at Neovim's approach instead, it works by defining a basic set of rendering capabilities that the gui must provide and then implements components and such on top of those basic systems. At the simplest, a neovim gui renders a single grid of characters and all of the components and such are drawn by neovim on top of that. A quick and dirty gui can be built in a couple days if you target that system.

After re-reading this, I realized I might want to clarify: I'm only talking about individual documents, not the entire GUI layout, when I'm discussing the character grid. As far as I'm concerned, the front-end can render everything else however it wants. I'm not totally sure how we would present an API for the remaining commands (e.g. file finder, etc.), but I'm not too worried about us being able to work it out.

Just wanting to elaborate a bit. I'm not super attached to one option or another, but including in the the drawing api some concept of window/control layout has two main advantages in my mind

  1. The terminal and gui act more similarly. If the window positions are defined in terms of a base grid/position in other windows for things like popups, then people won't have as much adjustment if they want to try the gui.
  2. It allows for progressive implementation of a gui. This may be a non goal, but I think its valuable that Neovim lets you create a functional gui in just a couple days by just implementing the basic grid rendering. Then a given front end could progressively add features by taking over more and more of the process. I think thats a pretty cool and efficient aspect of their gui extension model.

But I do think its a decision to be made and pushes more of the logic into the editor core than may be preferable. And it does limit what a gui can customize somewhat, so I could see value in both options.

from helix.

dsseng avatar dsseng commented on August 21, 2024

To get started with designing client-server model and splitting out UI it might be convenient to make a simple web-based GUI for browser, as a temporary GUI without harder to do stuff like GPU rendering. Then a proper GUI can be made based on well-developed and debugged concepts, but natively implemented using wgpu or higher level toolkits like iced and kas.

Overall, this seems like a really dependent on #312. GUI should work through network easily, while backing server keeps track of changes, language features etc. Plugins might also be available both for server and client, depending on their actions. While working locally without inviting others for pair coding, backend might be communicating with GUI via stdio.

from helix.

kirawi avatar kirawi commented on August 21, 2024

The relationship between helix-term and helix-view needs to be refined so that only terminal-specific functionality is in helix-term. Afterwards, presumably it would be to implement a helix-view backend for neovide. It's not a high priority at the moment.

from helix.

archseer avatar archseer commented on August 21, 2024

What does this have to do with a gui?

from helix.

Omnikar avatar Omnikar commented on August 21, 2024

What does this have to do with a gui?

I'm confused, was the comment this was in response to deleted?

from helix.

TinyProbe avatar TinyProbe commented on August 21, 2024

I deleted my comment. cause seem to no relate to gui. I'm sorry.

from helix.

gibbz00 avatar gibbz00 commented on August 21, 2024

@pascalkuthe assign me this issue? Might have accidentally started working on it. I'll post a draft PR later today.

from helix.

pascalkuthe avatar pascalkuthe commented on August 21, 2024

@pascalkuthe assign me this issue? Might have accidentally started working on it. I'll post a draft PR later today.

I think this a little bit out of my league, I would leave it to @archseer to assign this. Implementing a GUI will require a lot of design work and large refactors of the codebase. Just post your P,R nobody will beat you to it

from helix.

Ktoks avatar Ktoks commented on August 21, 2024

Question is- on windows- how can we use it with WinSCP? 🤔

from helix.

ShalokShalom avatar ShalokShalom commented on August 21, 2024

Would a centered mode - and other view modes - be different to be implement, or can we use something like that:

#3239

from helix.

mabasic avatar mabasic commented on August 21, 2024

Haven't seen anyone mention this, but have you heard of onivim2?

https://github.com/onivim/oni2

It is/was a rescript based modal editor similar in looks to vscode, but it could be totaly operated with the keyboard.

Would it be possible to reuse this for the gui? Maybe a collaboration that would benefit both projects

from helix.

subhasishdas159 avatar subhasishdas159 commented on August 21, 2024

The things that's preventing me from switching to helix is

  1. No gitlens like extension
  2. No eslint/prettier etc
  3. Unfamiliar key binding

If a gui is available, if there are noce extensions for it and if there is a way to remap key bindings I'll happily move to helix fulltime.

Vscode extensions are really nice, it would be amazing if those extensions can how how be installed in helix. This instantly makes helix ecosystem amazing!!! I'd be happy yo contribute towards the project as well.

from helix.

nyabinary avatar nyabinary commented on August 21, 2024

@PotatoesFall We can make our own GUI with Iced maybe?

from helix.

andrejohansson avatar andrejohansson commented on August 21, 2024

Don´t know if you know and if it adds something, but the creators of zed.dev have open sourced their ui library gpui. Would that be of any interest?

from helix.

Krahos avatar Krahos commented on August 21, 2024

Don´t know if you know and if it adds something, but the creators of zed.dev have open sourced their ui library gpui. Would that be of any interest?

Zed seems very cool, remember that it's currently only for MacOS though.

from helix.

sambonbonne avatar sambonbonne commented on August 21, 2024

@wmstack Correct me if I'm wrong, Helix seems more "terminal-first" and Zed is GUI-only (if a GUI is added to Helix, I hope it will stay optional, it seems it will be the case). Plus, Zed is MacOS-only for now, not everyone use Apple devices.

from helix.

DoctorRyner avatar DoctorRyner commented on August 21, 2024

@wmstack helix isn't about keymaps at least for me, I remapped it to be similar to vim's (lol), for example movement doesn't do selection by default for me. It's just helix is what vim should have been. Fast, powerful and simple

from helix.

7ombie avatar 7ombie commented on August 21, 2024

My bindings are heavily customized as well. I just like how Helix works.

from helix.

noahfraiture avatar noahfraiture commented on August 21, 2024

I'm not that thrilled for gui but I more do wait for plugins because rn I have to keep my own fork to add features from some abandoned merge requests like file tree, heh CleanShot 2024-03-16 at 22 35 35@2x

Did merge plugin manager in steel to have that ?

from helix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.