- //lyxerr << "InsetCollapsable::localDispatch: "
- // << cmd.action << " '" << cmd.argument << "'\n";
- BufferView * bv = cmd.view();
- switch (cmd.action) {
- case LFUN_INSET_EDIT: {
- if (!cmd.argument.empty()) {
- UpdatableInset::localDispatch(cmd);
- if (collapsed_) {
- lyxerr << "branch collapsed_" << endl;
- collapsed_ = false;
- if (bv->lockInset(this)) {
- bv->updateInset();
- bv->buffer()->markDirty();
- inset.localDispatch(cmd);
- first_after_edit = true;
- }
- } else {
- lyxerr << "branch not collapsed_" << endl;
- if (bv->lockInset(this))
- inset.localDispatch(cmd);
- }
- return DISPATCHED;
- }
-
-#ifdef WITH_WARNINGS
-#warning Fix this properly in BufferView_pimpl::workAreaButtonRelease
-#endif
- if (cmd.button() == mouse_button::button3)
- return DISPATCHED;
-
- UpdatableInset::localDispatch(cmd);
-
- if (collapsed_) {
- collapsed_ = false;
- // set this only here as it should be recollapsed only if
- // it was already collapsed!
- first_after_edit = true;
- if (!bv->lockInset(this))
- return DISPATCHED;
- bv->updateInset();
- bv->buffer()->markDirty();
- inset.localDispatch(cmd);
- } else {
- FuncRequest cmd1 = cmd;
- if (!bv->lockInset(this))
- return DISPATCHED;
- if (cmd.y <= button_dim.y2) {
- cmd1.y = 0;
- } else {
- cmd1.y = ascent() + cmd.y - (height_collapsed() + inset.ascent());
- }
- inset.localDispatch(cmd);
- }
- return DISPATCHED;
- }
-
- case LFUN_MOUSE_PRESS:
- if (!collapsed_ && cmd.y > button_dim.y2)
- inset.localDispatch(adjustCommand(cmd));
- return DISPATCHED;
-
- case LFUN_MOUSE_MOTION:
- if (!collapsed_ && cmd.y > button_dim.y2)
- inset.localDispatch(adjustCommand(cmd));
- return DISPATCHED;
-
- case LFUN_MOUSE_RELEASE:
- lfunMouseRelease(cmd);
- return DISPATCHED;
-
- default:
- UpdatableInset::RESULT result = inset.localDispatch(cmd);
- if (result >= FINISHED)
- bv->unlockInset(this);
- first_after_edit = false;
- return result;
+ string la;
+ pos_type const max_length = 15;
+ pos_type const p_siz = inset.paragraphs().begin()->size();
+ pos_type const n = min(max_length, p_siz);
+ pos_type i = 0;
+ pos_type j = 0;
+ for( ; i < n && j < p_siz; ++j) {
+ if (inset.paragraphs().begin()->isInset(j))
+ continue;
+ la += inset.paragraphs().begin()->getChar(j);
+ ++i;