Am Sat, 09 Jan 2021 12:58:16 +0100 schrieb Jürgen Spitzmüller <sp...@lyx.org>:
> Am Freitag, dem 08.01.2021 um 11:39 +0100 schrieb Kornel Benko: > > I have problems to _use_ matched substrings in replace-mode. > > > > For instance given regular expression containing some groups, like > > '(xxxx)(zzzz)(yyyy)' > > and I want to change the found value to 'yyyyzzzzxxxx', so in regex I > > would write > > '\3\2\1' > > > > Now the selection contains '\3\2\1', this is selected (in > > lyxfind.cpp:findAdvReplace()) > > with > > cap::pasteParagraphList(cur, > > repl_buffer.paragraphs(), > > > > repl_buffer.params().documentClassPtr(), > > bv- > > > buffer().errorList("Paste")); > > LYXERR(Debug::FIND, "After pasteParagraphList() cur=" > > << cur << endl); > > sel_len = repl_buffer.paragraphs().begin()->size(); > > and then follows > > bv->putSelectionAt(DocIterator(cur), sel_len, !opt.forward); > > bv->processUpdateFlags(Update::Force); > > > > How can I modify the data prior to inserting into buffer ? > > The values of '\1', '\2', '\3' are known here, but are not used. > > I think you should write a function similar to changeFirstCase() that > iterates over repl_buffer and replaces the placeholder in all > paragraphs. Then the cap::pasteParagraphList() function in question > should insert the modified paragraph(s). > > I don't know how difficult such a function would be, though. > > Jürgen > Yes, I overseen the LASSERT(repl_buffer.readString(lyx), return 0) statement, so I was confused. I can handle it now, but there is one difficulty, I cannot resolve. The search-buffer and the replace-buffer contain not only strings, but also the font, colour, size, specs. ATM, the spec is used from the replace-buffer (only the char-cases are handled differently) We need a flag to know what should be done. Committed at 60980b0e. The replacement strings are '$$0', '$$1', ... , '$$6' Number 7, 8, 9 are reserved, because the algorithm eats 3 of them. Kornel Kornel
pgpKHIH0z1ZK4.pgp
Description: Digitale Signatur von OpenPGP
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel