[QScintilla] Find/replace with a lexer not working?

Alan Garny agarny at hellix.com
Wed Jul 23 15:09:18 BST 2014


Hi,

 

I use QScintilla in essentially two modes: with and without a lexer. In the
case where there is no lexer, QsciScintilla::replace() works as I would
expect (i.e. it replaces the selected with whatever text I want to replace
it with). However, if there is a lexer, then QsciScintilla::replace() just
doesn't work for me.

 

For example, say that I have the following text in an instance of
QScintilla:

 

---------

<math xmlns="http://www.w3.org/1998/Math/MathML">

    <apply>

                <eq/>

                <apply>

                    <diff/>

                    <bvar>

                                <ci>time</ci>

                    </bvar>

                    <ci>V</ci>

                </apply>

                <apply>

                    <divide/>

                    <apply>

                                <minus/>

                                <apply>

                                    <plus/>

                                    <ci>i_Na</ci>

                                    <ci>i_K</ci>

                                    <ci>i_Leak</ci>

                                </apply>

                    </apply>

                    <ci>Cm</ci>

                </apply>

    </apply>

</math>

---------

 

Now, say that I want to replace all occurrences of "apply" with "SOME_TEXT",
then I will get:

 

---------

<math xmlns="http://www.w3.org/1998/Math/MathML">

    <SOME_TEXT>

                <eq/>

                <SOME_TEXT>

                    <diff/>

                    <bvar>

                                <ci>time</ci>

                    </bvar>

                    <ci>V</ci>

                </SOME_TEXT>

                <SOME_TEXT>

                    <divide/>

                    <SOME_TEXT>

                                <minus/>

                                <SOME_TEXT>

                                    <plus/>

                                    <ci>i_Na</ci>

                                    <ci>i_K</ci>

                                    <ci>i_Leak</ci>

                                </SOME_TEXT>

                    </SOME_TEXT>

                    <ci>Cm</ci>

                </SOME_TEXT>

    </SOME_TEXT>

</math>

---------

 

Which is indeed what I would expect. However, if I do the same as above but
using an instance of QScintilla that has syntax highlighting, then I will
get:

 

---------

<math xmlns="http://www.w3.org/1998/Math/MathML">

    <>

                <eq/>

                <>

                    <diff/>

                    <bvar>

                                <ci>time</ci>

                    </bvar>

                    <ci>V</ci>

                </>

                <>

                    <divide/>

                    <>

                                <minus/>

                                <>

                                    <plus/>

                                    <ci>i_Na</ci>

                                    <ci>i_K</ci>

                                    <ci>i_Leak</ci>

                                </>

                    </>

                    <ci>Cm</ci>

                </>

    </>

SOME_TEXTSOME_TEXTSOME_TEXTSOME_TEXTSOME_TEXTSOME_TEXTSOME_TEXTSOME_TEXTSOME
_TEXTSOME_TEXT</math>

---------

 

Which is clearly not what I would expect.

 

So, is there anything special with find/replace and lexers that I should be
aware of?

 

Cheers, Alan.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/qscintilla/attachments/20140723/422c1a83/attachment.html>


More information about the QScintilla mailing list