fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
24.59k stars 1.37k forks source link

Support an editable variant of TextGrid #2618

Open drognisep opened 2 years ago

drognisep commented 2 years ago

Is your feature request related to a problem? Please describe:

I would really like to embed a code editor into a Fyne app. The closest match to the features expected of such a widget is the TextGrid, but it's read-only with no selection model.

Is it possible to construct a solution with the existing API?

Talking with @andydotxyz it seems like it could be possible with one of two approaches:

  1. Use the rich text support coming in 2.2-ish to support things like syntax highlighting, but (AFAIK) rich text doesn't support things like line numbers, tab width, addressable row/column, etc.
  2. Do the work of making an editable derivative like EditableTextGrid. It sounds like the initial approach would be copying a lot of code from Entry over to the derivative.

Describe the solution you'd like to see:

I think it's too much to ask for an IntelliJ code editor window, so here's a summary of features outside of just editing that would satisfy my use case or allow me to build additional features around it like working with feedback from a language server.

Personally, I think TextGrid is closer to what I would like to see than the rich text widget. However, it sounds like some thought would need to go into collecting text handling like input, selection, shortcuts, and mouse clicks into an abstraction over the widget handling those sorts of gestures.

I think that Entry is really great for its designed use, which is providing a consistent look and feel for general purpose text entry. With the creation of the rich text widget Fyne is graduating from general purpose I/O to purpose built widgets that provide a ton of value. I think that an editable TextGrid would add tremendous value to your users by allowing them to build the software that builds other things, and it could also be very useful in Defyne for giving people a familiar experience.

layxyer commented 2 years ago

I also need this function, and the experience of similar functions is not very good now