mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-28 06:49:43 +00:00
Fix LFUN_MARK_TOGGLE, which actually did set the mark in stead of toggling it, remove some duplicated code (clearSelection() already calls resetAnchor()), and do some cosmetics.
(Is LFUN_MARK_TOGGLE actually used by anyone ?) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29127 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2f7260d3b4
commit
b9aa501051
@ -1108,7 +1108,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
|||||||
docstring label = cmd.argument();
|
docstring label = cmd.argument();
|
||||||
if (label.empty()) {
|
if (label.empty()) {
|
||||||
InsetRef * inset =
|
InsetRef * inset =
|
||||||
getInsetByCode<InsetRef>(d->cursor_, REF_CODE);
|
getInsetByCode<InsetRef>(cur, REF_CODE);
|
||||||
if (inset) {
|
if (inset) {
|
||||||
label = inset->getParam("reference");
|
label = inset->getParam("reference");
|
||||||
// persistent=false: use temp_bookmark
|
// persistent=false: use temp_bookmark
|
||||||
@ -1232,23 +1232,23 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_ALL_CHANGES_ACCEPT:
|
case LFUN_ALL_CHANGES_ACCEPT:
|
||||||
// select complete document
|
// select complete document
|
||||||
d->cursor_.reset(buffer_.inset());
|
cur.reset(buffer_.inset());
|
||||||
d->cursor_.selHandle(true);
|
cur.selHandle(true);
|
||||||
buffer_.text().cursorBottom(d->cursor_);
|
buffer_.text().cursorBottom(cur);
|
||||||
// accept everything in a single step to support atomic undo
|
// accept everything in a single step to support atomic undo
|
||||||
buffer_.text().acceptOrRejectChanges(d->cursor_, Text::ACCEPT);
|
buffer_.text().acceptOrRejectChanges(cur, Text::ACCEPT);
|
||||||
// FIXME: Move this LFUN to Buffer so that we don't have to do this:
|
// FIXME: Move this LFUN to Buffer so that we don't have to do this:
|
||||||
processUpdateFlags(Update::Force | Update::FitCursor);
|
processUpdateFlags(Update::Force | Update::FitCursor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_ALL_CHANGES_REJECT:
|
case LFUN_ALL_CHANGES_REJECT:
|
||||||
// select complete document
|
// select complete document
|
||||||
d->cursor_.reset(buffer_.inset());
|
cur.reset(buffer_.inset());
|
||||||
d->cursor_.selHandle(true);
|
cur.selHandle(true);
|
||||||
buffer_.text().cursorBottom(d->cursor_);
|
buffer_.text().cursorBottom(cur);
|
||||||
// reject everything in a single step to support atomic undo
|
// reject everything in a single step to support atomic undo
|
||||||
// Note: reject does not work recursively; the user may have to repeat the operation
|
// Note: reject does not work recursively; the user may have to repeat the operation
|
||||||
buffer_.text().acceptOrRejectChanges(d->cursor_, Text::REJECT);
|
buffer_.text().acceptOrRejectChanges(cur, Text::REJECT);
|
||||||
// FIXME: Move this LFUN to Buffer so that we don't have to do this:
|
// FIXME: Move this LFUN to Buffer so that we don't have to do this:
|
||||||
processUpdateFlags(Update::Force | Update::FitCursor);
|
processUpdateFlags(Update::Force | Update::FitCursor);
|
||||||
break;
|
break;
|
||||||
@ -1291,19 +1291,17 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_MARK_OFF:
|
case LFUN_MARK_OFF:
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
cur.resetAnchor();
|
|
||||||
cur.message(from_utf8(N_("Mark off")));
|
cur.message(from_utf8(N_("Mark off")));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_MARK_ON:
|
case LFUN_MARK_ON:
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
cur.setMark(true);
|
cur.setMark(true);
|
||||||
cur.resetAnchor();
|
|
||||||
cur.message(from_utf8(N_("Mark on")));
|
cur.message(from_utf8(N_("Mark on")));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_MARK_TOGGLE:
|
case LFUN_MARK_TOGGLE:
|
||||||
cur.clearSelection();
|
cur.setSelection(false);
|
||||||
if (cur.mark()) {
|
if (cur.mark()) {
|
||||||
cur.setMark(false);
|
cur.setMark(false);
|
||||||
cur.message(from_utf8(N_("Mark removed")));
|
cur.message(from_utf8(N_("Mark removed")));
|
||||||
@ -1311,7 +1309,6 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
|||||||
cur.setMark(true);
|
cur.setMark(true);
|
||||||
cur.message(from_utf8(N_("Mark set")));
|
cur.message(from_utf8(N_("Mark set")));
|
||||||
}
|
}
|
||||||
cur.resetAnchor();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_SCREEN_SHOW_CURSOR:
|
case LFUN_SCREEN_SHOW_CURSOR:
|
||||||
@ -1323,7 +1320,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BIBTEX_DATABASE_ADD: {
|
case LFUN_BIBTEX_DATABASE_ADD: {
|
||||||
Cursor tmpcur = d->cursor_;
|
Cursor tmpcur = cur;
|
||||||
findInset(tmpcur, BIBTEX_CODE, false);
|
findInset(tmpcur, BIBTEX_CODE, false);
|
||||||
InsetBibtex * inset = getInsetByCode<InsetBibtex>(tmpcur,
|
InsetBibtex * inset = getInsetByCode<InsetBibtex>(tmpcur,
|
||||||
BIBTEX_CODE);
|
BIBTEX_CODE);
|
||||||
@ -1335,7 +1332,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_BIBTEX_DATABASE_DEL: {
|
case LFUN_BIBTEX_DATABASE_DEL: {
|
||||||
Cursor tmpcur = d->cursor_;
|
Cursor tmpcur = cur;
|
||||||
findInset(tmpcur, BIBTEX_CODE, false);
|
findInset(tmpcur, BIBTEX_CODE, false);
|
||||||
InsetBibtex * inset = getInsetByCode<InsetBibtex>(tmpcur,
|
InsetBibtex * inset = getInsetByCode<InsetBibtex>(tmpcur,
|
||||||
BIBTEX_CODE);
|
BIBTEX_CODE);
|
||||||
|
Loading…
Reference in New Issue
Block a user