Rendered at 21:37:53 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
kabir_daki 23 hours ago [-]
The hardest part of WYSIWYG editors is always cursor
positioning and selection across mixed content.
How did you handle that? Also curious if you considered
using a canvas-based renderer vs DOM — what made you
go with your current approach?
chrisecker 13 hours ago [-]
I came from the TeX-Approach where all layout elements are boxes which contain other boxes. This box-tree is a kind of DOM if you want. But the box-tree only represents the layout, not the data itself. For the data you usually have a separate object. In Word this used to be the piece table structure, now it is probably something else. I described my approach here, if you want to know how and why: https://codeberg.org/chrisecker/texeltree/src/branch/main/do...
chrisecker 15 hours ago [-]
Cursor positioning is simple. The layout is a tree of nested box. Each box knows the x,y-position of its children. There is also an index dimension which numbers possible cursor positions. A box lies from i1 to i2 in index space. You just iterate over all boxes holding cursor position i to find the cursor coordinate x,y. Selection is simple as well. It is defined by a start index s1 and end index s2. Some objects have a special selection, e.g. tables where you select a rectangular range of table cells.
chjail-11 1 days ago [-]
I adore anything that avoids using a browser. <3
vishnuharidas 1 days ago [-]
This took me down the nostalgic memory lane of the planet-source-code days. There were hundreds of such projects in Visual Basic, Delphi, C/C++/MFC etc., and text editors and paint clones were the most popular projects.
Georgelemental 23 hours ago [-]
> - Real WYSIWYG editing (no HTML layer, no embedded browser) with styles, images and tables.
> - Clean, simple file format (human-readable, diff-friendly, git-friendly, AI-friendly)
Very nice!
Unfortunately, the UI menus seem to be broken when using a dark-mode GTK theme (e.g. Adwaita Dark).
chrisecker 15 hours ago [-]
Yes, I can see what you mean: There are hand coded colors together with system colors. With the dark mode this gives white text on white background for the side panel. Thanks for mentioning.
emanuele-em 15 hours ago [-]
Tables and images are the part where every "just use a rope" answer falls apart, so going B-tree feels right. I tried building a minimal rich text editor last year and got stuck exactly at the point where tables stopped being attachable as metadata and needed to live in the structure itself, ended up shelving it. Good to see someone actually push through it.
mttpgn 1 days ago [-]
On MacOS, I'm seeing `ModuleNotFoundError: No module named 'miniword.core.utils'` whether I run `python3 -m miniword` from src/miniword/ or from src/miniword/miniword/.
chrisecker 1 days ago [-]
My mistake. Now it works (on linux).
mttpgn 23 hours ago [-]
Thanks, and I got the main window open now, but I'm getting a second error that doesn't look OS related. `Plugin error (txtfilter.py): No module named 'miniword.importexport'`
This is a famous "killer" feature from WordPerfect: the ability to view and edit the low-level formatting for a document. It's invaluable for fixing weird bugs.
However, it works only because WP uses the "text-stream" paradigm, where a document comprises a linear stream of text with formatting codes (Bold, Font, Hard Return, etc.) embedded directly at the point at which they're applied.
In contrast, Word uses the "nested containers" model (characters inside words, words inside paragraphs, paragraphs inside sections, etc.), where this feature can't be replicated.
I didn't look closely at your code, but just thought to mention this feature.
nomdep 21 hours ago [-]
I don't see why the "nested containers" model would prevent this feature to be replicated, it's just a tree of nodes. Not edit-this-as-plain-text-simple but almost.
analogpixel 1 days ago [-]
at this point, a WYSIWYG just seems like a huge step backwards from just using markdown. I love having access to my files in a standard text format this is super easy to parse, and not being locked into whatever weird format that WYSIWYG decides to store it in.
I still don't understand why people still use ~~Microsoft Word~~Copilot document writer , I think they have gotten into some weird mindset that their documents require all this weird unnecessary formatting to look "official"
httpsterio 1 days ago [-]
Markdown without formatting isn't usually the nicest to read imo. I actually appreciate a well laid out and formatted document myself.
Also wysiwyg doesn't mean it can't be back and forwards compatible with markdown, it might just mean that it's a markdown editor gui with a preview.
layer8 1 days ago [-]
It’s also not nice to write longer text in monospace. Or to have long URLs interrupt the text just because you want a hyperlink on some word. Or having to lay out tables by hand like ASCII art. Seeing *this* isn’t the same as seeing this. And you need custom editor software anyway to have affordances like TOC navigation.
shakna 21 hours ago [-]
Tables by hand, I hate. But I don't quite agree with the first sentiment. For longform prose, it isn't that unusual for people to work with all editing marks visible. Writing novels, I absolutely write using monospace, because it allows you to more concisely control large amounts of formatting easily.
yummybrainz 24 hours ago [-]
> long URLs interrupt the text just because you want a hyperlink
This annoyed me until I realized pandoc supports separating [the link text] from the link location.
[the link text]: </url/to/resource>
"`title` parameter of the <a> tag, if converted to HTML"
layer8 24 hours ago [-]
Yep, but (a) that isn’t portable Markdown, (b) your editor probably doesn’t support opening the link from the link text in that case, and (c) whenever you want to modify the link text you have to modify all occurrences. A word processor can handle that automatically for you. It can also offer completion (like tab completion) for references that you use repeatedly. It can show as a tooltip what a given link text links to. Conveniences like that is what computers are for, let’s not relapse to the stone age here.
loloquwowndueo 19 hours ago [-]
> at this point, a WYSIWYG just seems like a huge step backwards from just using markdown.
Not for a layperson. There’s a reason WYSIWYG word processors completely obliterated the previous “needs an explicit preview mode” generation ones.
ninalanyon 2 hours ago [-]
Most of the reason was corporate decisions. My wife was perfectly happy writing a novel in WordStar under CP/M on our Osborne. But in offices you have to use what you are given so when our company switched from WordPerfect to Microsoft Word that's what everyone had to learn to use.
sakesun 1 days ago [-]
Yes. These days, with plain text, pasrsers, Internet, mobile devices and LLM, we really get more than what we see. Only few case where paper print out is still more useful.
pjmlp 13 hours ago [-]
That is only for techies. WYSIWYG has won for a reason.
netbioserror 23 hours ago [-]
My prolific Typst use, along with quickly improving side-by-side editors like Typesetter, are rapidly diminishing (in my eyes) the reasons for WYSIWYG to be. Sure, normies need it, yadda yadda. Is it worth the staggering cost? The file format and GUI complexity?
analogpixel 6 hours ago [-]
> Is it worth the staggering cost? The file format and GUI complexity?
I was kind of also wondering something like this as I read about different countries switching to linux, and them needing overly complex office software because they are entrenched in the thinking that that need Microsoft office.
Why do you NEED an office clone, what is it in your job that requires anything more than simple text and formatting that something like markdown provides.
I always envy people that can use computers as tools (like scientists/math people) and not fancy distraction devices. Those people, from what I see, don't care about the os, what it looks like, etc... they just want to use the computer as a tool to help them solve problems.
on a third tangent from the point, once I was given a PDF of data to process (instead of just the csv) , because people don't understand computer formats, and try to use things that they think make them look "professional"
Very nice! Unfortunately, the UI menus seem to be broken when using a dark-mode GTK theme (e.g. Adwaita Dark).
This is a famous "killer" feature from WordPerfect: the ability to view and edit the low-level formatting for a document. It's invaluable for fixing weird bugs.
However, it works only because WP uses the "text-stream" paradigm, where a document comprises a linear stream of text with formatting codes (Bold, Font, Hard Return, etc.) embedded directly at the point at which they're applied.
In contrast, Word uses the "nested containers" model (characters inside words, words inside paragraphs, paragraphs inside sections, etc.), where this feature can't be replicated.
I didn't look closely at your code, but just thought to mention this feature.
I still don't understand why people still use ~~Microsoft Word~~Copilot document writer , I think they have gotten into some weird mindset that their documents require all this weird unnecessary formatting to look "official"
Also wysiwyg doesn't mean it can't be back and forwards compatible with markdown, it might just mean that it's a markdown editor gui with a preview.
This annoyed me until I realized pandoc supports separating [the link text] from the link location.
Not for a layperson. There’s a reason WYSIWYG word processors completely obliterated the previous “needs an explicit preview mode” generation ones.
I was kind of also wondering something like this as I read about different countries switching to linux, and them needing overly complex office software because they are entrenched in the thinking that that need Microsoft office.
Why do you NEED an office clone, what is it in your job that requires anything more than simple text and formatting that something like markdown provides.
I always envy people that can use computers as tools (like scientists/math people) and not fancy distraction devices. Those people, from what I see, don't care about the os, what it looks like, etc... they just want to use the computer as a tool to help them solve problems.
on a third tangent from the point, once I was given a PDF of data to process (instead of just the csv) , because people don't understand computer formats, and try to use things that they think make them look "professional"
https://en.wikipedia.org/wiki/Rope_(data_structure)
Curious about the choice of toolkit: what led you to wxPython?
Looks like you missed a file, though.
ModuleNotFoundError: No module named 'miniword.core.utils'
I don't see it in my local clone of your repo, nor the repo iteslf.
I'll give it a shot on my own Ubuntu laptop.
You should use cairocffi instead of pycairo:
You also need to install the Cairo DLL. The easiest way is to install the full GTK3 runtime from: https://github.com/tschoonj/gtk-for-windows-runtime-environm...You must add the directory containing libcairo-2.dll to your PATH environment variable. In my case, this is:
Note that MiniWord is not yet optimised for Windows. While it mostly works, the rendering quality is lower and startup is slow.