//Encoding const * encoding = view()->cursor().getEncoding();
//encoded_last_key = keysym->getISOEncoded(encoding ? encoding->name() : "");
- size_t encoded_last_key = keysym->getUCSEncoded();
+ // FIXME: encoded_last_key shadows the member variable of the same
+ // name. Is that intended?
+ char_type encoded_last_key = keysym->getUCSEncoded();
// Do a one-deep top-level lookup for
// cancel and meta-fake keys. RVDK_PATCH_5
case LFUN_DIALOG_SHOW_NEW_INSET:
enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
+ if (cur.inset().lyxCode() == InsetBase::CAPTION_CODE) {
+ FuncStatus flag;
+ if (cur.inset().getStatus(cur, cmd, flag))
+ return flag;
+ }
break;
case LFUN_DIALOG_UPDATE: {
lyx_view_->message(str);
menuWrite(lyx_view_->buffer());
lyx_view_->message(str + _(" done."));
- } else
- writeAs(lyx_view_->buffer());
+ } else {
+ writeAs(lyx_view_->buffer());
+ }
updateFlags = Update::None;
break;
} else {
// case 1: print to a file
+ FileName const filename(makeAbsPath(target_name, path));
+ if (fs::exists(filename.toFilesystemEncoding())) {
+ docstring text = bformat(
+ _("The file %1$s already exists.\n\n"
+ "Do you want to over-write that file?"),
+ makeDisplayPath(filename.absFilename()));
+ if (Alert::prompt(_("Over-write file?"),
+ text, 0, 1, _("&Over-write"), _("&Cancel")) != 0) {
+ showPrintError(buffer->fileName());
+ break;
+ }
+ }
command += lyxrc.print_to_file
- + quoteName(makeAbsPath(target_name,
- path).toFilesystemEncoding())
+ + quoteName(filename.toFilesystemEncoding())
+ ' '
+ quoteName(dviname);
res = one.startscript(Systemcall::DontWait,
// --- buffers ----------------------------------------
case LFUN_BUFFER_SWITCH:
BOOST_ASSERT(lyx_view_);
- // update bookmark pit of the current buffer before switch
- for (size_t i = 0; i < LyX::ref().session().bookmarks().size(); ++i)
- gotoBookmark(i+1, false, false);
lyx_view_->setBuffer(theBufferList().getBuffer(argument));
break;
view()->setCursorFromRow(row);
- view()->center();
- // see BufferView::center()
+ updateFlags = Update::FitCursor;
break;
}
view()->cursor().dispatch(cmd);
updateFlags = view()->cursor().result().update();
if (!view()->cursor().result().dispatched())
- if (view()->dispatch(cmd))
- updateFlags = Update::Force | Update::FitCursor;
+ updateFlags = view()->dispatch(cmd);
break;
}
}
// if we executed a mutating lfun, mark the buffer as dirty
if (flag.enabled()
- && !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)
- && !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly))
+ && !lyxaction.funcHasFlag(action, LyXAction::NoBuffer)
+ && !lyxaction.funcHasFlag(action, LyXAction::ReadOnly))
view()->buffer()->markDirty();
if (view()->cursor().inTexted()) {