mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
Findadv: Polishing
1.) Do not remove '{}' unconditionally from \item parameter 2.) Do not output last empty entry
This commit is contained in:
parent
7db99672e6
commit
e487274ff4
@ -1784,12 +1784,18 @@ int LatexInfo::dispatch(ostringstream &os, int previousStart, KeyInfo &actual)
|
|||||||
// Discard extra parentheses '[]'
|
// Discard extra parentheses '[]'
|
||||||
if (interval.par[actual._dataEnd+1] == '[') {
|
if (interval.par[actual._dataEnd+1] == '[') {
|
||||||
int posdown = interval.findclosing(actual._dataEnd+2, interval.par.length(), '[', ']');
|
int posdown = interval.findclosing(actual._dataEnd+2, interval.par.length(), '[', ']');
|
||||||
processRegion(actual._dataEnd+2, posdown);
|
if ((interval.par[actual._dataEnd+2] == '{') &&
|
||||||
interval.addIntervall(actual._dataEnd+1, actual._dataEnd+2);
|
(interval.par[posdown-1] == '}')) {
|
||||||
interval.addIntervall(posdown, posdown+1);
|
interval.addIntervall(actual._dataEnd+1,actual._dataEnd+3);
|
||||||
|
interval.addIntervall(posdown-1, posdown+1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
interval.addIntervall(actual._dataEnd+1, actual._dataEnd+2);
|
||||||
|
interval.addIntervall(posdown, posdown+1);
|
||||||
|
}
|
||||||
int blk = interval.nextNotIgnored(actual._dataEnd+1);
|
int blk = interval.nextNotIgnored(actual._dataEnd+1);
|
||||||
if (blk > posdown) {
|
if (blk > posdown) {
|
||||||
// Discard space after empty item
|
// Discard spaces after empty item
|
||||||
int count;
|
int count;
|
||||||
for (count = 0; count < 10; count++) {
|
for (count = 0; count < 10; count++) {
|
||||||
if (interval.par[blk+count] != ' ')
|
if (interval.par[blk+count] != ' ')
|
||||||
@ -1968,7 +1974,9 @@ string splitOnKnownMacros(string par, bool isPatternString) {
|
|||||||
// Handle the remaining
|
// Handle the remaining
|
||||||
firstKey._dataStart = li.nextNotIgnored(firstKey._dataStart);
|
firstKey._dataStart = li.nextNotIgnored(firstKey._dataStart);
|
||||||
firstKey._dataEnd = par.length();
|
firstKey._dataEnd = par.length();
|
||||||
if (firstKey._dataStart < firstKey._dataEnd) {
|
// Check if ! empty
|
||||||
|
if ((firstKey._dataStart < firstKey._dataEnd) &&
|
||||||
|
(par[firstKey._dataStart] != '}')) {
|
||||||
if (firstKey._tokensize > 0)
|
if (firstKey._tokensize > 0)
|
||||||
li.setForDefaultLang(firstKey._tokensize);
|
li.setForDefaultLang(firstKey._tokensize);
|
||||||
(void) li.process(os, firstKey);
|
(void) li.process(os, firstKey);
|
||||||
@ -2476,7 +2484,7 @@ int findAdvFinalize(DocIterator & cur, MatchStringAdv const & match)
|
|||||||
int new_len;
|
int new_len;
|
||||||
// Greedy behaviour while matching regexps
|
// Greedy behaviour while matching regexps
|
||||||
bool examining = true;
|
bool examining = true;
|
||||||
int lastvalidlen = len;
|
int lastvalidlen = -1;
|
||||||
while (examining) {
|
while (examining) {
|
||||||
examining = false;
|
examining = false;
|
||||||
// Kornel: The loop is needed, since it looks like
|
// Kornel: The loop is needed, since it looks like
|
||||||
|
Loading…
Reference in New Issue
Block a user