eteran / nedit-ng

a Qt5 port of the NEdit using modern C++14
GNU General Public License v2.0
95 stars 26 forks source link

nedit-import should import text drawing styles from nedit.rc into theme.xml #35

Closed mmorandi closed 6 years ago

eteran commented 6 years ago

I didn't want nedit-ng to have an explicit X11 dependency just to read the old .rc file format (They used Xresources as the file format). So, when you build nedit-ng, it will also create nedit-import which will import basically everything except font information since that doesn't have an easy 1:1 mapping.

I think that this should cover your needs. Please re-open if this is not the case.

mmorandi commented 6 years ago

Consider the attached nedit.rc . nedit-import does not import the non-standard "Left Keyword", "Right Keyword" etc... text drawing styles (they should go into theme.xml, right? That file is not created by nedit-import, at least not for me).

As a result, the non-standard Mbdyn syntax highlighting rule is broken.

I do not think that this is the kind of "font information" you are referring to when you say that it cannot be easily mapped.

To be clear: it's not a big deal (one can always re-created them from scratch), but I still think this is a missing feature of nedit-import. nedit.rc.gz

eteran commented 6 years ago

I'll take a look at the file. Settings like that should definitely get transferred.

eteran commented 6 years ago

So... in the generated theme.xml, I see entries such as:

 <style name="Right Keyword" font="Bold" foreground="saddle brown"/>
 <style name="Math Keyword" font="Bold" foreground="SeaGreen"/>
 <style name="Left Keyword" font="Bold" foreground="black"/>

However, your file has revealed a different bug. My color code doesn't support colors in the format: rgb:e5/e5/e5.

I'll have to add that, which should make the tool work correctly. Give me a few minutes and I'll upload a patch for that. Hopefully, it'll resolve your issue as well.

eteran commented 6 years ago

just pushed a fix to make the two colors in your example that used rgb:hh/hh/hh syntax get converted correctly. Hopefully, that was the extent of the issue. Please re-open if the problem persists.

mmorandi commented 6 years ago

I had to dig it a little more, because you are seeing file theme.xml, why I was claiming it was not written at all.

It turns out that if the directory $HOME/.config/nedit-ng does not exist (and it likely does not exist the very first time one launches nedit-import) then file.open(QIODevice::WriteOnly) at import.cpp:247 fails, and the file theme.xml is not created.

Later on, Settings::savePreferences() is a little bit more robust, and creates the directory if it does not exist. If, at this point, I re-run nedit-import then theme.xml is created, as it should.

eteran commented 6 years ago

Ah, I will fix that! Thanks for the follow up.