Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 10-22-2018, 06:15 PM   #16
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 3,101
Karma: 1931746
Join Date: Nov 2009
Device: many
I will give that a try tomorrow with just the clips file to see what happens.
KevinH is offline   Reply With Quote
Old 10-22-2018, 06:48 PM   #17
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 11,272
Karma: 10572868
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by DiapDealer View Post
Preference continuity on upgrades just isn't something they've ever had to worry about in the past.
That 'ever' doesn't ring true. I've lost keyboard shortcut assignments when I've upgraded. One was F7 for Spellcheck - I've forgotten what grabbed it - might have been Well Formed Check. And that's not the only one I've lost. IIRC it results in two items having the same shortcut.

I can't recall whether I lost them in the most recent upgrade.

Curious - is there some place can I see default keyboard shortcut settings? Apart from to doing a Preferences Reset.

BR

Last edited by BetterRed; 10-22-2018 at 06:54 PM.
BetterRed is offline   Reply With Quote
Old 10-22-2018, 08:29 PM   #18
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 19,170
Karma: 99356142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by BetterRed View Post
That 'ever' doesn't ring true.
Sorry, but it certainly rings true to me. I can count on one finger the number of people I've heard reporting lost preferences when doing a normal upgrade. And besides ... it's irrelevant to my point of wanting to avoid it at all costs.
DiapDealer is offline   Reply With Quote
Old 10-22-2018, 08:57 PM   #19
BKh
Connoisseur
BKh can extract oil from cheeseBKh can extract oil from cheeseBKh can extract oil from cheeseBKh can extract oil from cheeseBKh can extract oil from cheeseBKh can extract oil from cheeseBKh can extract oil from cheeseBKh can extract oil from cheese
 
Posts: 91
Karma: 1000
Join Date: Mar 2011
Device: Kindle
Just wanted to say how grateful I am that you are looking into this.
BKh is offline   Reply With Quote
Old 10-23-2018, 04:22 AM   #20
Vroni
Junior Member
Vroni began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2018
Device: Tolino/PRS 650/Tablet
Is there a special reason why the saved searches do not remember options and mode or am i doing something wrong? Sometimes i miss especially the options DotAll Minimal Match and Warp in the saved search.
Vroni is offline   Reply With Quote
Old 10-23-2018, 08:29 AM   #21
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 19,170
Karma: 99356142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Vroni View Post
Is there a special reason why the saved searches do not remember options and mode or am i doing something wrong? Sometimes i miss especially the options DotAll Minimal Match and Warp in the saved search.
You're not missing anything. Those settings just aren't part of Sigil's Saved Searches feature. As seen in the Saved Searches dialog. There's a Name (including Group names), the Find criteria, and the Replace criteria.
DiapDealer is offline   Reply With Quote
Old 10-23-2018, 10:03 AM   #22
Vroni
Junior Member
Vroni began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2018
Device: Tolino/PRS 650/Tablet
Of course i miss the possibility of having different searches being marked as greedy / non greedy or dotall or nondotall

But it is like it is, and i'm not doing anything wrong.
Vroni is offline   Reply With Quote
Old 10-23-2018, 10:51 AM   #23
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 3,101
Karma: 1931746
Join Date: Nov 2009
Device: many
Okay, using Doitsu's example, I manually edited the sigil_searches.ini file and added a 34th entry and changed the final line size to be 34

Here is a snippet of my new sigil_searches.ini file:

Code:
34\Find=Krishna
34\Name=Krishna
34\Replace=K\x1e5b\x1e63\x1e47\x61
4\Find="&(nbsp|#160);(</p>)"
4\Name=Example Searches/Remove Non-Breaking Spaces/Trailing space
4\Replace=\\2
5\Find="(<p[^>]*>)&(nbsp|#160);"
5\Name=Example Searches/Remove Non-Breaking Spaces/Leading space
5\Replace=\\1
6\Find=\x2002
6\Name=Example Searches/Convert Characters to Entities/ensp
6\Replace="&ensp;"
7\Find=\x2003
7\Name=Example Searches/Convert Characters to Entities/emsp
7\Replace="&emsp;"
8\Find=\x2009
8\Name=Example Searches/Convert Characters to Entities/thin space
8\Replace="&thinsp;"
9\Find=\xad
9\Name=Example Searches/Convert Characters to Entities/shy
9\Replace="­"
size=34
Next I edited Sigil/src/MiscEditors/SearchEditorModel.cpp and added a call to use setIniCodec immediately after creating the settings instance as follows:

Code:
void SearchEditorModel::LoadData(const QString &filename, QStandardItem *item)
{
    SettingsStore *settings;

    if (filename.isEmpty()) {
        settings = new SettingsStore(m_SettingsPath);
    } else {
        settings = new SettingsStore(filename);
    }

    settings->setIniCodec("UTF-8");

    int size = settings->beginReadArray(SETTINGS_GROUP);
Then I rebuilt Sigil and fired it up and added the following line to my html file:
Code:
<p> this is a test: Krishna</p>
Next I went to Tools->Saved Searches and chose Krishna and ran the find and replace on it and received the correct result:

Kṛṣṇa

So, at least for Saved Searches Find and Replace, setting the ini Codec to utf-8 did the right thing. I am not sure how that would work with general "clips" so we will need to check it as well.
KevinH is offline   Reply With Quote
Old 10-23-2018, 10:56 AM   #24
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 19,170
Karma: 99356142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Vroni View Post
Of course i miss the possibility of having different searches being marked as greedy / non greedy or dotall or nondotall

But it is like it is, and i'm not doing anything wrong.
Also remember that most of those options: dotall, un/greedy can be specified (or reversed) in the regular expression itself. I always leave the the checkbox gui options in the same exact same state, and use the expression itself to set greed/lazy multi-line, case insensitivity, etc..., for each particular search.

Also note that if you always leave "All Files" selected you can override/force search to operate only on the current file by holding the Ctrl key down while clicking on the action.

I never uncheck "wrap," myself *shrug*
DiapDealer is offline   Reply With Quote
Old 10-23-2018, 11:03 AM   #25
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 19,170
Karma: 99356142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by KevinH View Post
Next I went to Tools->Saved Searches and chose Krishna and ran the find and replace on it and received the correct result:

Kṛṣṇa

So, at least for Saved Searches Find and Replace, setting the ini Codec to utf-8 did the right thing. I am not sure how that would work with general "clips" so we will need to check it as well.
What's it do to the saved searches ini file itself when making changes to Saved Searches? Will it keep existing hex as hex and new utf-8 as utf-8 in a mixed mode, or will the hex encoded entries be changed to utf-8 when saved with the new ini-encoding? I can live with the former, but the latter would be great!
DiapDealer is offline   Reply With Quote
Old 10-23-2018, 11:09 AM   #26
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 3,101
Karma: 1931746
Join Date: Nov 2009
Device: many
Next I edited sigil_clips.ini and changed the 22nd entry to:

Code:
22\Name=Krishna
22\Text=K\x1e5b\x1e63\x1e47\x61
Then edited Sigil/src/MiscEditors/ClipEditorModel.cpp and added the call to set the ini codec to utf-8:

Code:
void ClipEditorModel::LoadData(const QString &filename, QStandardItem *item)
{
    SettingsStore *settings;

    if (filename.isEmpty()) {
	settings = new SettingsStore(m_SettingsPath);
    } else {
        settings = new SettingsStore(filename);
    }

    settings->setIniCodec("UTF-8");

    int size = settings->beginReadArray(SETTINGS_GROUP);
Then fired up Sigil and opened the Clips view window and selected Krishna and it properly pasted in:

Kṛṣṇa

And then I used the clips editor to create and save a new Krishna2 clip and exited out of Sigil and went and looked at the sigil_clips.ini file and saw the following:

Code:
22\Name=Krishna
22\Text=K\x1e5b\x1e63\x1e47\x61
23\Name=Krishna2
23\Text=K\x1e5b\x1e63\x1e47\x61
So setting the codec of the ini file to utf-8 was NOT enough to get it to save the ini file as a utf-8 encoded file.

So so all of this testing may be in vain. I will take a closer look at the code that loads data and saves data in these models to see if I can see what is going on.

KevinH
KevinH is offline   Reply With Quote
Old 10-23-2018, 11:29 AM   #27
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 3,101
Karma: 1931746
Join Date: Nov 2009
Device: many
Ahh! So I missed adding a call to setIniCodec in the SaveData() routine in ClipEditorModel.cpp whcih when I added it and recompiled then open and saved the clips, I now see the following in sigil-clips.ini

Code:
20\Name=Example Clips/Miscellaneous/lowercase
20\Text=\\L\\1\\E
21\Name=Example Clips/Miscellaneous/Titlecase
21\Text=\\u\\1
22\Name=Krishna
22\Text=Kṛṣṇa
23\Name=Krishna2
23\Text=Kṛṣṇa
So it looks like it works just fine if we use setIniCodec to utf-8 both in LoadData() and SaveData() immedately after the SettingsStore object in created. It nicely groks hex escapes on input but saves them as utf-8.

So it appears we can easily convert clips and searches ini files to use utf-8 with no consequences at least if the users do not downgrade Sigil after the change.

What do you think?

KevinH
KevinH is offline   Reply With Quote
Old 10-23-2018, 11:36 AM   #28
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 3,101
Karma: 1931746
Join Date: Nov 2009
Device: many
BTW, you have to make the same change to add setIniCodec to utf-8 in the SaveData() routine in Sigil/src/MiscEditors/SearchEditorModel.cpp to get things to work properly in Find and Replace ini files too.

Of course, if we decide to make this change, we can always just change Sigil/src/Misc/SettingsStore.cpp and add the call to setIniCodec in the constructor to make sure all instances of SettingsStore properly set the ini codec, that way we will not miss anyplace, and we do not have to hunt to find everyplace where SettingsStore is used.

Thoughts?

KevinH
KevinH is offline   Reply With Quote
Old 10-23-2018, 12:13 PM   #29
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 3,101
Karma: 1931746
Join Date: Nov 2009
Device: many
In case anyone wants to test this in their own current build of Sigil just to verify it does not mess anything up for them:

1. Make backup copies of all your sigil related ini files in your Sigil Preferences folder

You can use the Go To Sigil Preferences Location button or use your file explorer:
Code:
    For Example: on a Mac they can be found here:
        /Users/YOURUSERID/Library/Application Support/sigil-ebook/sigil
            sigil.ini
            sigil_index.ini
            sigil_clips.ini
            sigil_searches.ini
2. Make the following changes to Sigil/src/Misc/SettingsStore.cpp
Code:
--- src/Misc/SettingsStore.cpp~	2017-12-05 09:01:06.000000000 -0500
+++ src/Misc/SettingsStore.cpp	2018-10-23 10:59:11.000000000 -0400
@@ -100,11 +100,13 @@
 SettingsStore::SettingsStore()
     : QSettings(Utility::DefinePrefsDir() + "/sigil.ini", QSettings::IniFormat)
 {
+     setIniCodec("UTF-8");
 }
 
 SettingsStore::SettingsStore(QString filename)
     : QSettings(filename, QSettings::IniFormat)
 {
+     setIniCodec("UTF-8");
 }
 
 QString SettingsStore::uiLanguage()
Then rebuild and launch Sigil. Sigil should now safely convert all of your ini files to use utf-8 format.

Then test everything and report back if any clips, preferences, saved searches, etc cause you any issues.

Please note - this is a one-way change to your ini files to make them more readable and editable by humans. Once you are done testing, if you want to revert back to the official build and then you will need to put back your sigil related ini files from your backups **before** firing up the older version of Sigil.

Last edited by KevinH; 10-23-2018 at 12:28 PM.
KevinH is offline   Reply With Quote
Old 10-23-2018, 07:39 PM   #30
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 19,170
Karma: 99356142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by KevinH View Post
BTW, you have to make the same change to add setIniCodec to utf-8 in the SaveData() routine in Sigil/src/MiscEditors/SearchEditorModel.cpp to get things to work properly in Find and Replace ini files too.

Of course, if we decide to make this change, we can always just change Sigil/src/Misc/SettingsStore.cpp and add the call to setIniCodec in the constructor to make sure all instances of SettingsStore properly set the ini codec, that way we will not miss anyplace, and we do not have to hunt to find everyplace where SettingsStore is used.

Thoughts?

KevinH
Unless we can envision a situation where individual config files might need to be something other than utf-8, I like the idea of the latter, one-size-fits-all approach, myself.

I'll try to do some testing on Linux and Windows soon.
DiapDealer is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saved searches abecedarian Sigil 5 04-14-2017 07:48 PM
Saved searches : suggestions Bertrand Editor 0 05-09-2014 06:58 AM
Saved searches: right pane roger64 Editor 2 04-07-2014 10:40 PM
Where are searches saved? travger Calibre 2 08-26-2012 02:37 PM
Saved Searches - Using Hierarchy nynaevelan Library Management 10 03-28-2011 11:45 PM


All times are GMT -4. The time now is 12:39 AM.


MobileRead.com is a privately owned, operated and funded community.