extern BufferList bufferlist;
extern LyXServer * lyxserver;
-extern bool selection_possible;
extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
return flag;
}
- // the default error message if we disable the command
- flag.message(N_("Command disabled"));
- if (!flag.enabled())
+ if (!flag.enabled()) {
+ if (flag.message().empty())
+ flag.message(N_("Command disabled"));
return flag;
+ }
// Check whether we need a buffer
if (!lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer) && !buf) {
default:
if (!cur.getStatus(cmd, flag))
- flag = view()->getStatus(cmd);
+ flag |= view()->getStatus(cmd);
}
if (!enable)
flag.enabled(false);
}
- //lyxerr << "LyXFunc::getStatus: got: " << flag.enabled() << endl;
+ // the default error message if we disable the command
+ if (!flag.enabled() && flag.message().empty())
+ flag.message(N_("Command disabled"));
+
return flag;
}
void LyXFunc::dispatch(FuncRequest const & cmd)
{
+ BOOST_ASSERT(view());
string const argument = cmd.argument;
kb_action const action = cmd.action;
// we have not done anything wrong yet.
errorstat = false;
dispatch_buffer.erase();
- selection_possible = false;
bool update = true;
update |= view()->cursor().result().update();
else
update |= view()->dispatch(cmd);
-
break;
}
}
// Redraw screen unless explicitly told otherwise.
// This also initializes the position cache for all insets
// in (at least partially) visible top-level paragraphs.
- if (update)
- view()->update();
-
- // fitCursor() needs valid inset position. The previous call to
- // update() makes sure we have such even for freshly created
- // insets.
- if (view()->fitCursor())
- view()->update();
+ view()->update(true, update);
+
// if we executed a mutating lfun, mark the buffer as dirty
if (getStatus(cmd).enabled()
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)