![]() |
#46 | |
Sigil developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,274
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
|
Quote:
Last edited by meme; 01-07-2012 at 03:44 PM. Reason: fix type |
|
![]() |
![]() |
#47 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,061
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
![]() |
![]() |
#48 | |
Sigil developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,274
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
|
Quote:
|
|
![]() |
![]() |
#49 |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
I've changed it to start a new search from the cursor position instead of using a cache with every match location. There won't be any difference in behavior in normal modes.
In Regex mode the difference is the start (or end) of the text is computed based upon where the cursor is located instead of the previous match if we searched for every non-overlapping match from the beginning of the document. This means the count of all occurrences won't necessary match the number of times find next will match. This is because one match could have multiple matches inside of it. Meme's example illustrates this. Due to the way regex's work I can't figure out how to do them in reverse for find backward. So find backward is the original method of start at the beginning of the document and move forward finding all non-overlapping matches until the cursor position is reached. The last match is then used. In Meme's example, if you put the cursor at the end of the document the larger matching block is selected instead of the smaller one that is closer to the end. This is because the smaller match is inside of the larger one which is matched first. |
![]() |
![]() |
#50 |
♫
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 661
Karma: 506380
Join Date: Aug 2010
Location: Germany
Device: Kobo Aura / PB Lux 2 / Bookeen Frontlight / Kobo Mini / Nook Color
|
I think this (or at least something similar) was mentioned already, but anyway:
When you have code like H<sub class="small">2</sub>O in your text and you change from BV to CV it changes the text to H <sub class="small">2</sub>O |
![]() |
![]() |
#51 | ||
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
|
Quote:
Consider doing a replacement in BV, what advantage do you have over doing it in CV? I cant think of any outside of the unlikely or low-frequency 'matching in tag/attributes'. Then let us take this to the other side, what do I gain by limiting regex to the code view? I will not frustratingly have clicked into a view, and after counting BV, matched nothing and incorrectly assumed that something is correct. BV matches do not preserve tags, the text matched, if used in replacement - will be stripped of formatting, in many cases this would be rather bad(think calibre's spammed spans). One less (and imho most likely very seldomly well used) use case to provision for (see this very bikeshed). Quote:
Most tools use a results cache, avoiding the whole cursor position issue, this also makes the whole model a lot easier to think about. The next result, if you have moved the cursor in-front of a match, is the same result as the previous match. If you swap document with the same cache, you are able to hop to the next result without needing to swap back to the document, figure out where the cursor was and then hopefully get the correct next match. An alternative would be to have a results list: far more friendly, useful and informative than having to flip through new matches sequentially, without moving around. |
||
![]() |
![]() |
#52 |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
@WS64, The rename with umlaut issue has been fixed. Turns out the stdio function in Windows cannot handle unicode characters. You have to use Microsofts special _wrename function for unicode support.
|
![]() |
![]() |
#53 |
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 586
Karma: 2000358
Join Date: Aug 2010
Location: Alabama
Device: Archos, Asus, HP, Lenovo, Nexus and Samsung tablets in 7,8 and 10"
|
Are you saying that if I set up a Regex expression and get a count and then use this expression to do a F&R I could get a different replace count depending on the cursor position. I would think that sort of thing should be avoided.
That's like saying that it OK to get a different sum from adding a column of numbers depending upon which row you start. If there is a compelling reason to start a search from the cursor position, I would suggest making it an option. Regards - John |
![]() |
![]() |
#54 | |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
Quote:
Code:
start ... stuff ... start ... stuff ... end ... stuff ... end |
|
![]() |
![]() |
#55 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,061
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Not how many I will effect ![]() |
|
![]() |
![]() |
#56 | |
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 586
Karma: 2000358
Join Date: Aug 2010
Location: Alabama
Device: Archos, Asus, HP, Lenovo, Nexus and Samsung tablets in 7,8 and 10"
|
Quote:
Wanting the "find" count to match the "replace" count is like wearing a belt and suspenders. With my bad eyes, a nervous mouse hand and a lack of regex experience, I am more than prone to error. I'lll bet that sometime, in the future, someone will report the non-matching counts as a bug. Any takers? ![]() Regards - John |
|
![]() |
![]() |
#57 |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
As long as you step through from the beginning of the document the search will match count. For the most part they will always match it all comes down to how the regex is constructed and if you start your find in the middle vs the beginning of the document.
|
![]() |
![]() |
#58 | |
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 586
Karma: 2000358
Join Date: Aug 2010
Location: Alabama
Device: Archos, Asus, HP, Lenovo, Nexus and Samsung tablets in 7,8 and 10"
|
Quote:
If you are saying that the F&R will no longer wrap then we have an entirely different kettle of fish. Then it becomes necessary to make it optional and give it a check box. Regards - John |
|
![]() |
![]() |
#59 | |
Sigil developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,274
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
|
Quote:
It would be interesting to list exactly what the old Sigil did for F&R/Count and what the new code does - with regard to cursor position/wrap around, etc. (does it wrap in the old version or just start from the start?) I'll have to install the old copy and compare it. I think the cases where count won't match will be limited to occasional regex's. But the possibility of always from cursor with option wrap for everything (despite my comment about count before) is something to keep in mind - but a checkbox might be needed to avoid having to ok it every time someone doesn't remember to go to the start of the document/files. Of course, if in practice the updated code works for almost everyone there might not be a need to change it. |
|
![]() |
![]() |
#60 | |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
What is taken into account for searching.
Quote:
Wrapping is currently not implemented. |
|
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
New Beta for BB? | FF2 | Amazon Kindle | 2 | 05-28-2011 10:21 AM |
BETA TESTER | The Terminator | Kobo Reader | 1 | 12-14-2010 10:23 PM |
Beta Beta Test of Major New Features | Starson17 | Calibre | 45 | 05-17-2010 10:55 AM |
0.6 out of beta? | Nate the great | Calibre | 3 | 07-17-2009 02:45 AM |