return true;
}
+void setSelection(BufferView * bv, DocIterator const & from, DocIterator const & to)
+{
+ DocIterator end = to;
+
+ if (from.pit() != end.pit()) {
+ // there are multiple paragraphs in selection
+ Cursor & bvcur = bv->cursor();
+ bvcur.setCursor(from);
+ bvcur.clearSelection();
+ bvcur.selection(true);
+ bvcur.setCursor(end);
+ bvcur.selection(true);
+ } else {
+ // FIXME LFUN
+ // If we used a LFUN, dispatch would do all of this for us
+ int const size = end.pos() - from.pos();
+ bv->putSelectionAt(from, size, false);
+ }
+ bv->processUpdateFlags(Update::Force | Update::FitCursor);
+}
+
} // namespace
// restore original selection
if (had_selection) {
bv->cursor().resetAnchor();
- bv->setCursorSelectionTo(endcur);
+ setSelection(bv, startcur, endcur);
}
return false;
}
if (had_selection) {
endcur.fixIfBroken();
bv->cursor().resetAnchor();
- bv->setCursorSelectionTo(endcur);
+ setSelection(bv, startcur, endcur);
}
return num;