Consider CT in dash mechanism (#13062)

This commit is contained in:
Juergen Spitzmueller 2024-05-11 13:07:32 +02:00
parent 6b3ced7c07
commit fe4f0dbf0b

View File

@ -1127,12 +1127,15 @@ void Text::insertChar(Cursor & cur, char_type c)
if (!cur.paragraph().isPassThru() && owner_->lyxCode() != IPA_CODE && if (!cur.paragraph().isPassThru() && owner_->lyxCode() != IPA_CODE &&
cur.real_current_font.fontInfo().family() != TYPEWRITER_FAMILY && cur.real_current_font.fontInfo().family() != TYPEWRITER_FAMILY &&
c == '-' && pos > 0) { c == '-' && pos > 0) {
if (par.getChar(pos - 1) == '-') { pos_type prev_pos = pos - 1;
while (prev_pos > 0 && par.isDeleted(prev_pos))
--prev_pos;
if (!par.isDeleted(prev_pos) && par.getChar(prev_pos) == '-') {
// convert "--" to endash // convert "--" to endash
par.eraseChar(pos - 1, cur.buffer()->params().track_changes); par.eraseChar(prev_pos, cur.buffer()->params().track_changes);
c = 0x2013; c = 0x2013;
pos--; pos--;
} else if (par.getChar(pos - 1) == 0x2013) { } else if (!par.isDeleted(prev_pos) && par.getChar(prev_pos) == 0x2013) {
// convert "---" to emdash // convert "---" to emdash
par.eraseChar(pos - 1, cur.buffer()->params().track_changes); par.eraseChar(pos - 1, cur.buffer()->params().track_changes);
c = 0x2014; c = 0x2014;