mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-25 22:03:45 -06:00
RichEdit: PasteText added text normalization
git-svn-id: svn://ultimatepp.org/upp/trunk@13607 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
3bc93d8a61
commit
e892be548e
1 changed files with 13 additions and 3 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue