10-22-2018, 05:15 PM | #16 |
Sigil Developer
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
|
I will give that a try tomorrow with just the clips file to see what happens.
|
10-22-2018, 05:48 PM | #17 | |
null operator (he/him)
Posts: 20,568
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
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 05:54 PM. |
|
Advert | |
|
10-22-2018, 07:29 PM | #18 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
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.
|
10-22-2018, 07:57 PM | #19 |
Zealot
Posts: 107
Karma: 1000
Join Date: Mar 2011
Device: Kindle
|
Just wanted to say how grateful I am that you are looking into this.
|
10-23-2018, 03:22 AM | #20 |
Banned
Posts: 168
Karma: 10010
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.
|
Advert | |
|
10-23-2018, 07:29 AM | #21 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
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.
|
10-23-2018, 09:03 AM | #22 |
Banned
Posts: 168
Karma: 10010
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. |
10-23-2018, 09:51 AM | #23 |
Sigil Developer
Posts: 7,644
Karma: 5433388
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=" " 7\Find=\x2003 7\Name=Example Searches/Convert Characters to Entities/emsp 7\Replace=" " 8\Find=\x2009 8\Name=Example Searches/Convert Characters to Entities/thin space 8\Replace=" " 9\Find=\xad 9\Name=Example Searches/Convert Characters to Entities/shy 9\Replace="" size=34 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); Code:
<p> this is a test: Krishna</p> 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. |
10-23-2018, 09:56 AM | #24 | |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
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* |
|
10-23-2018, 10:03 AM | #25 | |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
|
|
10-23-2018, 10:09 AM | #26 |
Sigil Developer
Posts: 7,644
Karma: 5433388
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 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); 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 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 |
10-23-2018, 10:29 AM | #27 |
Sigil Developer
Posts: 7,644
Karma: 5433388
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 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 |
10-23-2018, 10:36 AM | #28 |
Sigil Developer
Posts: 7,644
Karma: 5433388
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 |
10-23-2018, 11:13 AM | #29 |
Sigil Developer
Posts: 7,644
Karma: 5433388
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 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 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 11:28 AM. |
10-23-2018, 06:39 PM | #30 | |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I'll try to do some testing on Linux and Windows soon. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Saved searches | abecedarian | Sigil | 5 | 04-14-2017 06:48 PM |
Saved searches : suggestions | Bertrand | Editor | 0 | 05-09-2014 05:58 AM |
Saved searches: right pane | roger64 | Editor | 2 | 04-07-2014 09:40 PM |
Where are searches saved? | travger | Calibre | 2 | 08-26-2012 01:37 PM |
Saved Searches - Using Hierarchy | nynaevelan | Library Management | 10 | 03-28-2011 10:45 PM |