#include "TextMetrics.h"
#include "WordLangTuple.h"
+#include "frontends/alert.h"
#include "frontends/Application.h"
#include "frontends/Clipboard.h"
#include "frontends/Selection.h"
pit_type const newpit = distance(bgn, dest);
pit_type const len = distance(start, finish);
pit_type const deletepit = pit + len;
- buf.undo().recordUndo(cur, ATOMIC_UNDO, newpit, deletepit - 1);
+ buf.undo().recordUndo(cur, newpit, deletepit - 1);
pars.splice(dest, start, finish);
cur.pit() = newpit;
break;
}
// One such was found:
pit_type newpit = distance(bgn, dest);
- buf.undo().recordUndo(cur, ATOMIC_UNDO, pit, newpit - 1);
+ buf.undo().recordUndo(cur, pit, newpit - 1);
pit_type const len = distance(start, finish);
pars.splice(dest, start, finish);
cur.pit() = newpit - len;
case OutlineIn:
case OutlineOut: {
pit_type const len = distance(start, finish);
- buf.undo().recordUndo(cur, ATOMIC_UNDO, pit, pit + len - 1);
+ buf.undo().recordUndo(cur, pit, pit + len - 1);
for (; start != finish; ++start) {
toclevel = buf.text().getTocLevel(distance(bgn, start));
if (toclevel == Layout::NOT_IN_TOC)
case LFUN_PARAGRAPH_MOVE_DOWN: {
pit_type const pit = cur.pit();
- recUndo(cur, pit, pit + 1);
+ cur.recordUndo(pit, pit + 1);
cur.finishUndo();
pars_.swap(pit, pit + 1);
needsUpdate = true;
case LFUN_PARAGRAPH_MOVE_UP: {
pit_type const pit = cur.pit();
- recUndo(cur, pit - 1, pit);
+ cur.recordUndo(pit - 1, pit);
cur.finishUndo();
pars_.swap(pit, pit - 1);
--cur.pit();
// FIXME: this don't work for multipart document!
for (pit_type tmp = 0, end = pars_.size(); tmp != end; ++tmp) {
if (pars_[tmp].params().startOfAppendix()) {
- recUndo(cur, tmp);
+ cur.recordUndo(tmp, tmp);
pars_[tmp].params().startOfAppendix(false);
break;
}
break;
case LFUN_CHAR_FORWARD:
- case LFUN_CHAR_FORWARD_SELECT:
+ case LFUN_CHAR_FORWARD_SELECT: {
//LYXERR0(" LFUN_CHAR_FORWARD[SEL]:\n" << cur);
needsUpdate |= cur.selHandle(act == LFUN_CHAR_FORWARD_SELECT);
- needsUpdate |= cursorForward(cur);
+ bool const cur_moved = cursorForward(cur);
+ needsUpdate |= cur_moved;
- if (!needsUpdate && oldTopSlice == cur.top()
- && cur.boundary() == oldBoundary) {
+ if (!cur_moved && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
}
}
break;
+ }
case LFUN_CHAR_BACKWARD:
- case LFUN_CHAR_BACKWARD_SELECT:
+ case LFUN_CHAR_BACKWARD_SELECT: {
//lyxerr << "handle LFUN_CHAR_BACKWARD[_SELECT]:\n" << cur << endl;
needsUpdate |= cur.selHandle(act == LFUN_CHAR_BACKWARD_SELECT);
- needsUpdate |= cursorBackward(cur);
+ bool const cur_moved = cursorBackward(cur);
+ needsUpdate |= cur_moved;
- if (!needsUpdate && oldTopSlice == cur.top()
- && cur.boundary() == oldBoundary) {
+ if (!cur_moved && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
}
}
break;
+ }
case LFUN_CHAR_LEFT:
case LFUN_CHAR_LEFT_SELECT:
if (lyxrc.visual_cursor) {
needsUpdate |= cur.selHandle(act == LFUN_CHAR_LEFT_SELECT);
- needsUpdate |= cursorVisLeft(cur);
- if (!needsUpdate && oldTopSlice == cur.top()
- && cur.boundary() == oldBoundary) {
+ bool const cur_moved = cursorVisLeft(cur);
+ needsUpdate |= cur_moved;
+ if (!cur_moved && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_LEFT);
}
case LFUN_CHAR_RIGHT_SELECT:
if (lyxrc.visual_cursor) {
needsUpdate |= cur.selHandle(cmd.action() == LFUN_CHAR_RIGHT_SELECT);
- needsUpdate |= cursorVisRight(cur);
- if (!needsUpdate && oldTopSlice == cur.top()
- && cur.boundary() == oldBoundary) {
+ bool const cur_moved = cursorVisRight(cur);
+ needsUpdate |= cur_moved;
+ if (!cur_moved && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
}
case LFUN_WORD_RIGHT_SELECT:
if (lyxrc.visual_cursor) {
needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_RIGHT_SELECT);
- needsUpdate |= cursorVisRightOneWord(cur);
- if (!needsUpdate && oldTopSlice == cur.top()
- && cur.boundary() == oldBoundary) {
+ bool const cur_moved = cursorVisRightOneWord(cur);
+ needsUpdate |= cur_moved;
+ if (!cur_moved && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
}
break;
case LFUN_WORD_FORWARD:
- case LFUN_WORD_FORWARD_SELECT:
+ case LFUN_WORD_FORWARD_SELECT: {
needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_FORWARD_SELECT);
- needsUpdate |= cursorForwardOneWord(cur);
+ bool const cur_moved = cursorForwardOneWord(cur);
+ needsUpdate |= cur_moved;
- if (!needsUpdate && oldTopSlice == cur.top()
- && cur.boundary() == oldBoundary) {
+ if (!cur_moved && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
}
}
break;
+ }
case LFUN_WORD_LEFT:
case LFUN_WORD_LEFT_SELECT:
if (lyxrc.visual_cursor) {
needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_LEFT_SELECT);
- needsUpdate |= cursorVisLeftOneWord(cur);
- if (!needsUpdate && oldTopSlice == cur.top()
- && cur.boundary() == oldBoundary) {
+ bool const cur_moved = cursorVisLeftOneWord(cur);
+ needsUpdate |= cur_moved;
+ if (!cur_moved && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_LEFT);
}
break;
case LFUN_WORD_BACKWARD:
- case LFUN_WORD_BACKWARD_SELECT:
+ case LFUN_WORD_BACKWARD_SELECT: {
needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_BACKWARD_SELECT);
- needsUpdate |= cursorBackwardOneWord(cur);
+ bool const cur_moved = cursorBackwardOneWord(cur);
+ needsUpdate |= cur_moved;
- if (!needsUpdate && oldTopSlice == cur.top()
- && cur.boundary() == oldBoundary) {
+ if (!cur_moved && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
}
}
break;
+ }
case LFUN_WORD_SELECT: {
selectWord(cur, WHOLE_WORD);
else if (arg == "wmf")
type = Clipboard::WmfGraphicsType;
else
- // We used to assert, but couldn't the argument come from, say, the
- // minibuffer and just be mistyped?
+ // we also check in getStatus()
LYXERR0("Unrecognized graphics type: " << arg);
pasteClipboardGraphics(cur, bv->buffer().errorList("Paste"), type);
bv->buffer().errors("Paste");
cur.clearSelection(); // bug 393
cur.finishUndo();
+ bv->buffer().updatePreviews();
break;
}
arg += " lang=" + from_ascii(cur.getFont().language()->lang());
}
}
+ if (lyxrc.thesaurusdir_path.empty()) {
+ frontend::Alert::warning(_("Path to thesaurus directory not set!"),
+ _("The path to the thesaurus directory has not been specified.\n"
+ "The thesaurus is not functional.\n"
+ "Please refer to sec. 6.15.1 of the User's Guide for setup\n"
+ "instructions."));
+ }
bv->showDialog("thesaurus", to_utf8(arg));
break;
}
}
// unknown argument
+ LYXERR0("Unrecognized graphics type: " << arg);
+ // we don't want to assert if the user just mistyped the LFUN
+ LATTEST(cmd.origin() != FuncRequest::INTERNAL);
enable = false;
break;
}