Hi, attached is a patch that make phrase search work. I'm not 100% sure about the CharIterator::prev() change. CharIterator::next() returned \0 between words, prev() didn't. So something was wrong. I decided to go with current next() behaviour and made prev() return \0 as word separator too. Also the current implementation only works if one enters exactly one blank between words in the search dialog. Should we collapse multiple blanks into one automatically? Cheers, Johannes
Hi, Committed. On Tue, Apr 22, 2008 at 06:12:55PM +0200, Johannes Hofmann wrote:
Hi,
attached is a patch that make phrase search work. I'm not 100% sure about the CharIterator::prev() change. CharIterator::next() returned \0 between words, prev() didn't. So something was wrong. I decided to go with current next() behaviour and made prev() return \0 as word separator too.
It looks reasonable. BTW, while working on fixing the parsing of " " (a not yet committed work), I found that it's not clear how non-breaking whitespace is handled/represented. Currently we have a parser/dw mix that tries to render it "right" for HTML. The idea is to decide how to render inside the HTML parser and to use dw for that. Now there's some HTML logic built in dw, which would be good not to have (an idea we talked with Sebastian long ago). For instance dillo1 handles NBSP better in some cases and worse in others than dillo2. I think it'll have to wait until I find some time to dig into it...
Also the current implementation only works if one enters exactly one blank between words in the search dialog. Should we collapse multiple blanks into one automatically?
As a workaround, I don't see why not. BTW, the phrase search doesn't work with text wrapped by the PRE element. This probably is related to a whole sentence/line stored as a single dw word. -- Cheers Jorge.-
On Sat, Apr 26, 2008 at 01:10:46PM -0400, Jorge Arellano Cid wrote:
Hi,
Committed.
On Tue, Apr 22, 2008 at 06:12:55PM +0200, Johannes Hofmann wrote:
Hi,
attached is a patch that make phrase search work. I'm not 100% sure about the CharIterator::prev() change. CharIterator::next() returned \0 between words, prev() didn't. So something was wrong. I decided to go with current next() behaviour and made prev() return \0 as word separator too.
It looks reasonable.
BTW, while working on fixing the parsing of " " (a not yet committed work), I found that it's not clear how non-breaking whitespace is handled/represented. Currently we have a parser/dw mix that tries to render it "right" for HTML. The idea is to decide how to render inside the HTML parser and to use dw for that. Now there's some HTML logic built in dw, which would be good not to have (an idea we talked with Sebastian long ago).
For instance dillo1 handles NBSP better in some cases and worse in others than dillo2.
I think it'll have to wait until I find some time to dig into it...
Also the current implementation only works if one enters exactly one blank between words in the search dialog. Should we collapse multiple blanks into one automatically?
As a workaround, I don't see why not.
BTW, the phrase search doesn't work with text wrapped by the PRE element. This probably is related to a whole sentence/line stored as a single dw word.
Ah yes. I totally forgot about PRE. In normal text spaces are encoded using the "space" flag in Content. In PRE there is a separate Content object for each space. I think I will revert my change to CharIterator and make prev() work as next() originally did (i.e. not return any '\0'). Instead CharIterator will generate a ' ' if the space flag is set in a Content object. This way CharIterator will always create a stream of chars (no '\0's) with words in normal text separated by blanks. Then phrase search should work for PRE sections too. And it should even be possible to search for something like three blanks in a row within PRE sections. Patch will follow... Cheers, Johannes
participants (2)
-
jcid@dillo.org
-
Johannes.Hofmann@gmx.de