CtrlLib: Fixed selection issue in DocEdit/LineEdit

git-svn-id: svn://ultimatepp.org/upp/trunk@12946 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-04-04 21:55:09 +00:00
parent c34cc4236a
commit 7020c8fafb
2 changed files with 9 additions and 6 deletions

View file

@ -240,9 +240,8 @@ void DocEdit::PlaceCaret(int64 newpos, bool select) {
newpos = GetLength32();
int z = GetLine(newpos);
if(select) {
if(anchor < 0) {
if(anchor < 0)
anchor = cursor;
}
RefreshLines(z, GetLine(cursor));
}
else

View file

@ -810,6 +810,7 @@ int TextCtrl::Insert0(int pos, const WString& txt) { // TODO: Do this with utf8
total += size;
SetSb();
Update();
ClearSelection();
PostInsert(inspos, txt);
return size;
}
@ -851,6 +852,7 @@ void TextCtrl::Remove0(int pos, int size) {
Refresh();
}
Update();
ClearSelection();
PostRemove(rmpos, rmsize);
SetSb();
}
@ -1010,10 +1012,12 @@ void TextCtrl::Redo() {
}
void TextCtrl::ClearSelection() {
anchor = -1;
Refresh();
SelectionChanged();
WhenSel();
if(anchor >= 0) {
anchor = -1;
Refresh();
SelectionChanged();
WhenSel();
}
}
void TextCtrl::SetSelection(int64 l, int64 h) {