From b9aa5010516cbd7f29a72a77aa31581568aeb3c8 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 6 Apr 2009 18:25:23 +0000 Subject: [PATCH] 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 --- src/BufferView.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index ca641a76bc..59166bd73f 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1108,7 +1108,7 @@ bool BufferView::dispatch(FuncRequest const & cmd) docstring label = cmd.argument(); if (label.empty()) { InsetRef * inset = - getInsetByCode(d->cursor_, REF_CODE); + getInsetByCode(cur, REF_CODE); if (inset) { label = inset->getParam("reference"); // persistent=false: use temp_bookmark @@ -1232,23 +1232,23 @@ bool BufferView::dispatch(FuncRequest const & cmd) case LFUN_ALL_CHANGES_ACCEPT: // select complete document - d->cursor_.reset(buffer_.inset()); - d->cursor_.selHandle(true); - buffer_.text().cursorBottom(d->cursor_); + cur.reset(buffer_.inset()); + cur.selHandle(true); + buffer_.text().cursorBottom(cur); // 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: processUpdateFlags(Update::Force | Update::FitCursor); break; case LFUN_ALL_CHANGES_REJECT: // select complete document - d->cursor_.reset(buffer_.inset()); - d->cursor_.selHandle(true); - buffer_.text().cursorBottom(d->cursor_); + cur.reset(buffer_.inset()); + cur.selHandle(true); + buffer_.text().cursorBottom(cur); // reject everything in a single step to support atomic undo // 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: processUpdateFlags(Update::Force | Update::FitCursor); break; @@ -1291,19 +1291,17 @@ bool BufferView::dispatch(FuncRequest const & cmd) case LFUN_MARK_OFF: cur.clearSelection(); - cur.resetAnchor(); cur.message(from_utf8(N_("Mark off"))); break; case LFUN_MARK_ON: cur.clearSelection(); cur.setMark(true); - cur.resetAnchor(); cur.message(from_utf8(N_("Mark on"))); break; case LFUN_MARK_TOGGLE: - cur.clearSelection(); + cur.setSelection(false); if (cur.mark()) { cur.setMark(false); cur.message(from_utf8(N_("Mark removed"))); @@ -1311,7 +1309,6 @@ bool BufferView::dispatch(FuncRequest const & cmd) cur.setMark(true); cur.message(from_utf8(N_("Mark set"))); } - cur.resetAnchor(); break; case LFUN_SCREEN_SHOW_CURSOR: @@ -1323,7 +1320,7 @@ bool BufferView::dispatch(FuncRequest const & cmd) break; case LFUN_BIBTEX_DATABASE_ADD: { - Cursor tmpcur = d->cursor_; + Cursor tmpcur = cur; findInset(tmpcur, BIBTEX_CODE, false); InsetBibtex * inset = getInsetByCode(tmpcur, BIBTEX_CODE); @@ -1335,7 +1332,7 @@ bool BufferView::dispatch(FuncRequest const & cmd) } case LFUN_BIBTEX_DATABASE_DEL: { - Cursor tmpcur = d->cursor_; + Cursor tmpcur = cur; findInset(tmpcur, BIBTEX_CODE, false); InsetBibtex * inset = getInsetByCode(tmpcur, BIBTEX_CODE); -- 2.39.2