RichEdit: PasteText added text normalization

git-svn-id: svn://ultimatepp.org/upp/trunk@13607 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-09-16 20:53:22 +00:00
parent 3bc93d8a61
commit e892be548e

View file

@ -301,9 +301,19 @@ void RichEdit::PasteText(const RichText& text)
SetModify();
modified = true;
RemoveSelection();
Insert(cursor, text, false);
ReadStyles();
Move(cursor + text.GetLength(), false);
int n = text.GetPartCount() - 1;
if(!text.IsPara(0) || !text.IsPara(n)) { // inserted section must start/end with para
RichText pp = clone(text);
pp.Normalize();
Insert(cursor, pp, false);
ReadStyles();
Move(cursor + pp.GetLength(), false);
}
else {
Insert(cursor, text, false);
ReadStyles();
Move(cursor + text.GetLength(), false);
}
}
struct ToParaIterator : RichText::Iterator {