Code editor widget #1763
Replies: 1 comment 1 reply
-
You're correct that Toga doesn't have a code editing widget at present. We'd like to add one, but it's not on our immediate roadmap; our focus at present is on getting the core widget set in place. I haven't looked into Scintilla in particular, but it may be possible to use it; the fact that it seems to have separate builds for macOS, and GTK is a promising start. The windows code is win32, which isn't directly compatible (Toga uses Winforms), but might be usable. There are 3 major impediments that I can see:
These problems might be solvable; at least on the first point, a "desktop only" editor would be a big start. Another (more extreme) approach would be to use Scintilla as "inspiration", and reproduce the implementation in Python. That would make the code a lot more compatible with Toga; although there might be performance issues. And, of course, another option still would be to use a different widget as the starting point. I've come across a couple (https://github.com/coteditor/CotEditor https://github.com/Microsoft/monaco-editor https://ace.c9.io https://github.com/CodeEditApp/CodeEdit and more) over the years; but I haven't done a comprehensive audit to work out if any of them are viable as a starting point for a Toga code widget. At least 2 of these projects (Monaco and Ace) are web-based, so you get cross-platform (including mobile) for free; you just have to work out how to embed it in a web page. |
Beta Was this translation helpful? Give feedback.
-
It looks like Toga currently lacks a widget for building a code editor.
GTK has
GtkSourceView
, Cocoa hasNSTextView
, WinForms probably can useRichEditControl
. I haven't use any of these but I assume they all have different capabilities so that it would be hard to create a common interface for these.wxWidgets seems to use Scintilla on all platfroms: https://docs.wxwidgets.org/3.0/group__group__class__stc.html
Do you see any technical obstacles for bringing Scintilla into Toga? Or would it be better or easier to create a common interface over the native widgets? Another alternative?
Beta Was this translation helpful? Give feedback.
All reactions