Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Closed Thread
 
Thread Tools Search this Thread
Old 01-07-2012, 03:02 PM   #46
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,274
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Quote:
Originally Posted by Ahmad Samir View Post
Or just do it like Firefox and KWrite, when a search reaches the end of the document (page in Firefox) clicking "Next" again will make the search wrap, select the first match in the document and show a message indicating that:
- Firefox: "Reached end of Page, continued from top" on the FindBar
- KWrite: "Reached bottom, continued from top" on the status bar.
I've no objection against wrap-around - but I would want more than a status bar notice if it were used. Like Libre Office and I think Word, a dialog should pop up if wrap-around is used to avoid missing the status bar notice.

Last edited by meme; 01-07-2012 at 03:44 PM. Reason: fix type
meme is offline  
Old 01-07-2012, 03:38 PM   #47
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,057
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:
Originally Posted by meme View Post
I've no object against wrap-around - but I would want more than a status bar notice if it were used. Like Libre Office and I think Word, a dialog should pop up if wrap-around is used to avoid missing the status bar notice.
I could live with that
theducks is offline  
Advert
Old 01-07-2012, 04:01 PM   #48
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,274
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Quote:
Originally Posted by Ahmad Samir View Post
Or just do it like Firefox and KWrite, when a search reaches the end of the document (page in Firefox) clicking "Next" again will make the search wrap, select the first match in the document and show a message indicating that:
- Firefox: "Reached end of Page, continued from top" on the FindBar
- KWrite: "Reached bottom, continued from top" on the status bar.
Ah, overthinking it. Yes, wrap around with a dialog and always searching from cursor would work fine. Except Count which would always apply to the whole document or all files - which is reasonable.
meme is offline  
Old 01-07-2012, 04:13 PM   #49
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
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.
user_none is offline  
Old 01-07-2012, 05:45 PM   #50
WS64
WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.
 
WS64's Avatar
 
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
WS64 is offline  
Advert
Old 01-07-2012, 07:27 PM   #51
Serpentine
Evangelist
Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
Quote:
Originally Posted by meme View Post
As theducks said, some folks scare easily of CV, or rather, most users starting with Sigil will use BV. And I'm not sure why you would prevent its use there since it doesn't cause any additional issues and works fine.
I really, really can't see why someone who understands regex would want to use it in BV, I simply do not understand how someone who understands regex would then be scared off by using it in the code view. I understand that regex is unfriendly and that people who might be scared off by code and such require a nice way to search - and that is why I think that BV should be limited to the simple searches only (You might notice that I also asked for the case sensitive options to be returned).

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:
Originally Posted by meme View Post
Why is it best with regex not to use a cursor position? Maybe I'm just missing something.
Meh, the reasons are pretty minor, I guess its one of those things which I dislike since it's inefficient in both implementation and user interaction.

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.
Serpentine is offline  
Old 01-07-2012, 08:16 PM   #52
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
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.
user_none is offline  
Old 01-07-2012, 09:01 PM   #53
Jabby
Jr. - Junior Member
Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.
 
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
Jabby is offline  
Old 01-07-2012, 09:05 PM   #54
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by Jabby View Post
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.
Yes because regexes can be variable length. For example:

Code:
start ... stuff ... start ... stuff ... end ... stuff ... end
You can construct an expression to match everything between "start" and "end". Since there is a "start" and "end" nested inside of a "start" and "end" you will get one match if you start looking at the very beginning and a completely different match if you start looking between the first and second "start".
user_none is offline  
Old 01-08-2012, 11:29 AM   #55
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,057
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:
Originally Posted by Jabby View Post
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
My reason for a Count is to try and predetermine how many places I will affect.
Not how many I will effect in the end.
theducks is offline  
Old 01-08-2012, 02:24 PM   #56
Jabby
Jr. - Junior Member
Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.
 
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:
Originally Posted by theducks View Post
My reason for a Count is to try and predetermine how many places I will affect.
Not how many I will effect in the end.
My reason for a count is a sanity check. For instance: If I am making a regex change to chapter headings, I run a count to see if my regex expression count matches the number of chapter that I know I have. If it does not match, I do a one by one "find next" to see what steps I need to take to get the results I want.

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
Jabby is offline  
Old 01-08-2012, 02:40 PM   #57
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
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.
user_none is offline  
Old 01-08-2012, 03:41 PM   #58
Jabby
Jr. - Junior Member
Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.
 
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:
Originally Posted by user_none View Post
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.
I understand all that. What I don't understand is why you want to start from the cursor position. Is there a compelling reason to make the change? What are the benefits?

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
Jabby is offline  
Old 01-08-2012, 04:02 PM   #59
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,274
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Quote:
Originally Posted by Jabby View Post
I understand all that. What I don't understand is why you want to start from the cursor position. Is there a compelling reason to make the change? What are the benefits?

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.
Start what from the cursor position?

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.
meme is offline  
Old 01-08-2012, 04:27 PM   #60
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by meme View Post
Start what from the cursor position?
What is taken into account for searching.

Quote:
Originally Posted by meme View Post
It would be interesting to list exactly what the old Sigil did for F&R/Count and what the new code does
4.x and 3.x behave the same as the newly (not yet released) beta code. The currently released 5.x betas have a different behavior.


Quote:
Originally Posted by meme View Post
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.
Wrapping is currently not implemented.
user_none is offline  
Closed Thread


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 01:09 AM.


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