if (!gotsel || !pastesel)
return true;
- pasteFromStack(cur, cur.buffer().errorList("Paste"), 0);
- cur.buffer().errors("Paste");
+ pasteFromStack(cur, cur.buffer()->errorList("Paste"), 0);
+ cur.buffer()->errors("Paste");
cur.clearSelection(); // bug 393
cur.finishUndo();
InsetText * insetText = dynamic_cast<InsetText *>(inset);
static void outline(OutlineOp mode, Cursor & cur)
{
- Buffer & buf = cur.buffer();
+ Buffer & buf = *cur.buffer();
pit_type & pit = cur.pit();
ParagraphList & pars = buf.text().paragraphs();
ParagraphList::iterator bgn = pars.begin();
recUndo(cur, pit, pit + 1);
cur.finishUndo();
swap(pars_[pit], pars_[pit + 1]);
- cur.buffer().updateLabels();
+ cur.buffer()->updateLabels();
needsUpdate = true;
++cur.pit();
break;
recUndo(cur, pit - 1, pit);
cur.finishUndo();
swap(pars_[pit], pars_[pit - 1]);
- cur.buffer().updateLabels();
+ cur.buffer()->updateLabels();
--cur.pit();
needsUpdate = true;
break;
par.params().startOfAppendix(start);
// we can set the refreshing parameters now
- cur.buffer().updateLabels();
+ cur.buffer()->updateLabels();
break;
}
break;
case LFUN_WORD_DELETE_BACKWARD:
- if (cur.selection()) {
+ if (cur.selection())
cutSelection(cur, true, false);
- } else
+ else
deleteWordBackward(cur);
finishChange(cur, false);
break;
case LFUN_LINE_DELETE:
- if (cur.selection()) {
+ if (cur.selection())
cutSelection(cur, true, false);
- } else
+ else
tm.deleteLineForward(cur);
finishChange(cur, false);
break;
case LFUN_BUFFER_BEGIN:
case LFUN_BUFFER_BEGIN_SELECT:
needsUpdate |= cur.selHandle(cmd.action == LFUN_BUFFER_BEGIN_SELECT);
- if (cur.depth() == 1) {
+ if (cur.depth() == 1)
needsUpdate |= cursorTop(cur);
- } else {
+ else
cur.undispatched();
- }
cur.updateFlags(Update::FitCursor);
break;
case LFUN_BUFFER_END:
case LFUN_BUFFER_END_SELECT:
needsUpdate |= cur.selHandle(cmd.action == LFUN_BUFFER_END_SELECT);
- if (cur.depth() == 1) {
+ if (cur.depth() == 1)
needsUpdate |= cursorBottom(cur);
- } else {
+ else
cur.undispatched();
- }
cur.updateFlags(Update::FitCursor);
break;
// stop/start the selection
bool select = cmd.action == LFUN_DOWN_SELECT ||
cmd.action == LFUN_UP_SELECT;
- cur.selHandle(select);
// move cursor up/down
bool up = cmd.action == LFUN_UP_SELECT || cmd.action == LFUN_UP;
- bool const successful = cur.upDownInText(up, needsUpdate);
- if (successful) {
- // redraw if you leave mathed (for the decorations)
+ bool const atFirstOrLastRow = cur.atFirstOrLastRow(up);
+
+ if (!atFirstOrLastRow) {
+ needsUpdate |= cur.selHandle(select);
+ cur.selHandle(select);
+ cur.upDownInText(up, needsUpdate);
needsUpdate |= cur.beforeDispatchCursor().inMathed();
- } else
+ } else {
+ // if the cursor cannot be moved up or down do not remove
+ // the selection right now, but wait for the next dispatch.
+ if (select)
+ needsUpdate |= cur.selHandle(select);
+ cur.upDownInText(up, needsUpdate);
cur.undispatched();
+ }
break;
}
break;
}
+ case LFUN_FONT_ITAL: {
+ Font font(ignore_font, ignore_language);
+ font.fontInfo().setShape(ITALIC_SHAPE);
+ toggleAndShow(cur, this, font);
+ break;
+ }
+
case LFUN_FONT_BOLD:
case LFUN_FONT_BOLDSYMBOL: {
Font font(ignore_font, ignore_language);
// Get word or selection
selectWordWhenUnderCursor(cur, WHOLE_WORD);
arg = cur.selectionAsString(false);
+ arg += " lang=" + from_ascii(cur.getFont().language()->lang());
}
}
bv->showDialog("thesaurus", to_utf8(arg));
case LFUN_OUTLINE_UP:
outline(OutlineUp, cur);
setCursor(cur, cur.pit(), 0);
- cur.buffer().updateLabels();
+ cur.buffer()->updateLabels();
needsUpdate = true;
break;
case LFUN_OUTLINE_DOWN:
outline(OutlineDown, cur);
setCursor(cur, cur.pit(), 0);
- cur.buffer().updateLabels();
+ cur.buffer()->updateLabels();
needsUpdate = true;
break;
case LFUN_OUTLINE_IN:
outline(OutlineIn, cur);
- cur.buffer().updateLabels();
+ cur.buffer()->updateLabels();
needsUpdate = true;
break;
case LFUN_OUTLINE_OUT:
outline(OutlineOut, cur);
- cur.buffer().updateLabels();
+ cur.buffer()->updateLabels();
needsUpdate = true;
break;
code = FLEX_CODE;
string s = cmd.getArg(0);
InsetLayout il =
- cur.buffer().params().documentClass().insetLayout(from_utf8(s));
+ cur.buffer()->params().documentClass().insetLayout(from_utf8(s));
if (il.lyxtype() != InsetLayout::CHARSTYLE &&
il.lyxtype() != InsetLayout::CUSTOM &&
il.lyxtype() != InsetLayout::ELEMENT &&
break;
case LFUN_BRANCH_INSERT:
code = BRANCH_CODE;
- if (cur.buffer().masterBuffer()->params().branchlist().empty())
+ if (cur.buffer()->masterBuffer()->params().branchlist().empty())
enable = false;
break;
case LFUN_LABEL_INSERT:
flag.setOnOff(fontinfo.emph() == FONT_ON);
break;
+ case LFUN_FONT_ITAL:
+ flag.setOnOff(fontinfo.shape() == ITALIC_SHAPE);
+ break;
+
case LFUN_FONT_NOUN:
flag.setOnOff(fontinfo.noun() == FONT_ON);
break;
case LFUN_INSET_DISSOLVE:
if (!cmd.argument().empty()) {
- InsetLayout const & il = cur.inset().getLayout(cur.buffer().params());
+ InsetLayout const & il = cur.inset().getLayout(cur.buffer()->params());
InsetLayout::InsetLyXType const type =
translateLyXType(to_utf8(cmd.argument()));
enable = cur.inset().lyxCode() == FLEX_CODE