|
|
#151 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,274
Karma: 211540138
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I'm curious why when right-clicking in Code View and choosing to Mend and Prettify the current file, the cursor always moves to the opening body tag? To be clear: this happened in previous versions of Sigil as well (and I don't think it's a huge deal by any means). I just wondered if there's a reason behind it? |
|
|
|
|
|
|
#152 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,528
Karma: 6774048
Join Date: Nov 2009
Device: many
|
Mend and Prettify both are based on parsing the complete xhtml file into its gumbo DOM tree of nodes and then serializing it back to xhtml following specific rules. So as a guess only ... when you prettify, you can change lines and add or remove chars, etc, so any character offset stored before we prettify will typically be wrong so maybe we just store the line?
Or maybe we try storing a webpath and hope to get close upon return? Will have to check the code on that. |
|
|
|
|
|
#153 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,528
Karma: 6774048
Join Date: Nov 2009
Device: many
|
Okay, I took a closer look at the gitee code to do prettyrint after spending hours updating its use of QRegExp (which was removed for Qt6 but still in Qt5 compat) to use QRegularExpression and getting it to compile it became clear it basically punts and never condenses any text no matter what.
That is not something I consider an actual prettyprint tool. It is more like a lint tool of some sort. So imho it is not worth adding to Sigil either. So we are have only one user controllable PrettyPrint option, not two. So please give what is in master a try, and let me know if it does what you need. Thanks. |
|
|
|
|
|
#154 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,528
Karma: 6774048
Join Date: Nov 2009
Device: many
|
I am thinking of adding a safety check to our PrettyPrint which will walk all linked css files and internal xhtml style tags looking for the use of the white-space property with any value other than "normal" and refuse to prettyprint that file. FWIW, pre tags contents will properly not be condensed but not eveyone uses pre tags in their html.
Thoughts? Update: This safer prettprint approach has now been pushed to master. Last edited by KevinH; 04-08-2026 at 05:05 PM. |
|
|
|
|
|
#155 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,528
Karma: 6774048
Join Date: Nov 2009
Device: many
|
I have also revisited the prettyprint code from that gitee sigil-modified site. I was able to extract and fix it to properly condense text. I will add create a plugin version of it (once translated to python) for people to try out as an alternative to our built in gumbo based prettyprinting.
Last edited by KevinH; 04-08-2026 at 05:07 PM. |
|
|
|
|
|
#156 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 51,188
Karma: 179232776
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
For anyone interested in testing the new code, here's a link to my compile of the latest code from Sigil's Github repository: Sigil-2.7.6-Windows-x64-Setup.exe.
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Suggestions for Sigil Improvements or New Features | KevinH | Sigil | 241 | 03-02-2026 01:09 PM |
| Suggestions for Sigil Improvements or New Features | KevinH | Sigil | 168 | 11-18-2025 12:23 PM |
| Ideas for New Improvements or Features | KevinH | Sigil | 97 | 04-09-2025 09:45 AM |
| What Features or Tools does Sigil Still Need Yet? | KevinH | Sigil | 175 | 03-06-2021 09:11 PM |
| Improvements/bugs/features | dontcrash | KOReader | 10 | 10-23-2019 10:05 AM |