}
-void doInsertInset(LCursor & cur, LyXText * text,
+bool doInsertInset(LCursor & cur, LyXText * text,
FuncRequest const & cmd, bool edit, bool pastesel)
{
InsetBase * inset = createInset(&cur.bv(), cmd);
if (!inset)
- return;
+ return false;
recordUndo(cur);
bool gotsel = false;
if (gotsel && pastesel)
cur.bv().owner()->dispatch(FuncRequest(LFUN_PASTE));
+ return true;
}
{
//we don't call update(true, false) directly to save a metrics call
if (cur.bv().fitCursor())
- cur.bv().update(false, true);
+ cur.bv().update(Update::Force);
}
cur.clearSelection();
LyXFont const old_font = real_current_font;
-
+
// Prevents language turds in new lyxtexts under non-english
BufferParams const & bufparams = cur.buffer().params();
Language const * lang = cur.paragraph().getParLanguage(bufparams);
cur.resetAnchor();
moveCursor(cur, false);
- // real_current_font.number can change so we need to
- // update the minibuffer
- if (old_font != real_current_font)
+ needsUpdate = redoParagraph(cur.pit());
+ if (!needsUpdate) {
+ // update only this paragraph
+ cur.bv().update(Update::SinglePar | Update::Force);
+ }
+
bv->updateScrollbar();
break;
}
case LFUN_INSET_FOOTNOTE:
case LFUN_INSET_MARGINAL:
case LFUN_INSET_OPTARG:
- case LFUN_TABULAR_INSERT:
case LFUN_ENVIRONMENT_INSERT:
// Open the inset, and move the current selection
// inside it.
cur.posRight();
break;
+ case LFUN_TABULAR_INSERT:
+ // if there were no arguments, just open the dialog
+ if (doInsertInset(cur, this, cmd, false, true))
+ cur.posRight();
+ else
+ bv->owner()->getDialogs().show("tabularcreate");
+
+ break;
+
case LFUN_INSET_FLOAT:
- case LFUN_INSET_WIDE_FLOAT:
+ case LFUN_INSET_WIDE_FLOAT:
case LFUN_INSET_WRAP:
doInsertInset(cur, this, cmd, true, true);
cur.posRight();
case LFUN_APPENDIX:
flag.setOnOff(cur.paragraph().params().startOfAppendix());
+ return true;
+
+ case LFUN_INSERT_BIBITEM:
+ enable = (cur.paragraph().layout()->labeltype == LABEL_BIBLIO);
break;
#if 0
case LFUN_EMPH:
flag.setOnOff(font.emph() == LyXFont::ON);
- break;
+ return true;
case LFUN_NOUN:
flag.setOnOff(font.noun() == LyXFont::ON);
- break;
+ return true;
case LFUN_BOLD:
flag.setOnOff(font.series() == LyXFont::BOLD_SERIES);
- break;
+ return true;
case LFUN_SANS:
flag.setOnOff(font.family() == LyXFont::SANS_FAMILY);
- break;
+ return true;
case LFUN_ROMAN:
flag.setOnOff(font.family() == LyXFont::ROMAN_FAMILY);
- break;
+ return true;
case LFUN_CODE:
flag.setOnOff(font.family() == LyXFont::TYPEWRITER_FAMILY);
- break;
+ return true;
case LFUN_DELETE_WORD_FORWARD:
case LFUN_DELETE_WORD_BACKWARD:
case LFUN_INSERT_LABEL:
case LFUN_INSERT_NOTE:
case LFUN_INSERT_CHARSTYLE:
- case LFUN_INSERT_BIBITEM:
case LFUN_INSET_FLOAT:
case LFUN_INSET_FOOTNOTE:
case LFUN_INSET_MARGINAL: