mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
In Paragraph::changeCase, correctly track the font of the changed characters (fix crash)
Fixes: #7943
This commit is contained in:
parent
2c88e6ab2f
commit
c06c1c3195
@ -3304,7 +3304,9 @@ void Paragraph::changeCase(BufferParams const & bparams, pos_type pos,
|
||||
// process sequences of modified characters; in change
|
||||
// tracking mode, this approach results in much better
|
||||
// usability than changing case on a char-by-char basis
|
||||
docstring changes;
|
||||
// We also need to track the current font, since font
|
||||
// changes within sequences can occur.
|
||||
vector<pair<char_type, Font> > changes;
|
||||
|
||||
bool const trackChanges = bparams.trackChanges;
|
||||
|
||||
@ -3338,7 +3340,7 @@ void Paragraph::changeCase(BufferParams const & bparams, pos_type pos,
|
||||
}
|
||||
|
||||
if (oldChar != newChar) {
|
||||
changes += newChar;
|
||||
changes.push_back(make_pair(newChar, getFontSettings(bparams, pos)));
|
||||
if (pos != right - 1)
|
||||
continue;
|
||||
// step behind the changing area
|
||||
@ -3347,9 +3349,8 @@ void Paragraph::changeCase(BufferParams const & bparams, pos_type pos,
|
||||
|
||||
int erasePos = pos - changes.size();
|
||||
for (size_t i = 0; i < changes.size(); i++) {
|
||||
insertChar(pos, changes[i],
|
||||
getFontSettings(bparams,
|
||||
erasePos),
|
||||
insertChar(pos, changes[i].first,
|
||||
changes[i].second,
|
||||
trackChanges);
|
||||
if (!eraseChar(erasePos, trackChanges)) {
|
||||
++erasePos;
|
||||
|
@ -96,6 +96,9 @@ What's new
|
||||
|
||||
- Fix crash when CheckTeX hits mathed (bug 8798).
|
||||
|
||||
- Fix crash when performing "Change Case" operation on a selection with font
|
||||
changes (bug 7943).
|
||||
|
||||
- Fix hang when selecting text (bug 8837).
|
||||
|
||||
- Fix assertion when entering a path into the import dialog (bug 7437).
|
||||
|
Loading…
Reference in New Issue
Block a user