}
-InsetOld::RESULT
-InsetText::moveRight(BufferView * bv, bool activate_inset, bool selecting)
+InsetOld::RESULT InsetText::moveRight(BufferView * bv)
{
if (text_.cursor.par()->isRightToLeftPar(bv->buffer()->params))
- return moveLeftIntern(bv, false, activate_inset, selecting);
+ return moveLeftIntern(bv, false, true, false);
else
- return moveRightIntern(bv, true, activate_inset, selecting);
+ return moveRightIntern(bv, true, true, false);
}
-InsetOld::RESULT
-InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting)
+InsetOld::RESULT InsetText::moveLeft(BufferView * bv)
{
if (text_.cursor.par()->isRightToLeftPar(bv->buffer()->params))
- return moveRightIntern(bv, true, activate_inset, selecting);
+ return moveRightIntern(bv, true, true, false);
else
- return moveLeftIntern(bv, false, activate_inset, selecting);
+ return moveLeftIntern(bv, false, true, false);
}
{
LyXText * lt = bv->getLyXText();
- if (selecting || lt->selection.mark()) {
+ //if (!lt->selection.set())
+ // lt->selection.cursor = lt->cursor;
+
+ if (selecting || lt->selection.mark())
lt->setSelection();
- if (lt->isInInset())
- bv->updateInset();
- }
- bv->update();
if (!lt->selection.set())
bv->haveSelection(false);
+ bv->update();
bv->switchKeyMap();
}
// check if the given co-ordinates are inside an inset at the
// given cursor, if one exists. If so, the inset is returned,
// and the co-ordinates are made relative. Otherwise, 0 is returned.
-InsetOld * checkInset(BufferView * /*bv*/, LyXText & text,
+ InsetOld * checkInset(BufferView * /*bv*/, LyXText & text,
LyXCursor const & cur, int & x, int & y)
{
lyx::pos_type const pos = cur.pos();
cursorRightOneWord();
else
cursorLeftOneWord();
- update();
finishChange(bv);
break;
case LFUN_BEGINNINGBUF:
if (!selection.mark())
bv->beforeChange(this);
- update();
cursorTop();
finishChange(bv);
break;
case LFUN_ENDBUF:
if (selection.mark())
bv->beforeChange(this);
- update();
cursorBottom();
finishChange(bv);
break;
case LFUN_RIGHTSEL:
- update();
+ if (!selection.set())
+ selection.cursor = cursor;
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorLeft(bv);
else
break;
case LFUN_LEFTSEL:
- update();
+ if (!selection.set())
+ selection.cursor = cursor;
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorRight(bv);
else
break;
case LFUN_UPSEL:
- update();
+ if (!selection.set())
+ selection.cursor = cursor;
cursorUp(true);
finishChange(bv, true);
break;
case LFUN_DOWNSEL:
- update();
+ if (!selection.set())
+ selection.cursor = cursor;
cursorDown(true);
finishChange(bv, true);
break;
case LFUN_UP_PARAGRAPHSEL:
- update();
+ if (!selection.set())
+ selection.cursor = cursor;
cursorUpParagraph();
finishChange(bv, true);
break;
case LFUN_DOWN_PARAGRAPHSEL:
- update();
+ if (!selection.set())
+ selection.cursor = cursor;
cursorDownParagraph();
finishChange(bv, true);
break;
case LFUN_PRIORSEL:
- update();
+ if (!selection.set())
+ selection.cursor = cursor;
cursorPrevious();
finishChange(bv, true);
break;
case LFUN_NEXTSEL:
- update();
+ if (!selection.set())
+ selection.cursor = cursor;
cursorNext();
finishChange(bv, true);
break;
case LFUN_HOMESEL:
- update();
+ if (!selection.set())
+ selection.cursor = cursor;
cursorHome();
finishChange(bv, true);
break;
case LFUN_ENDSEL:
- update();
+ if (!selection.set())
+ selection.cursor = cursor;
cursorEnd();
finishChange(bv, true);
break;
case LFUN_WORDRIGHTSEL:
- update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorLeftOneWord();
else
break;
case LFUN_WORDLEFTSEL:
- update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorRightOneWord();
else
break;
case LFUN_WORDSEL: {
- update();
LyXCursor cur1 = cursor;
LyXCursor cur2;
::getWord(cur1, cur2, lyx::WHOLE_WORD, ownerParagraphs());
bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params);
if (!selection.mark())
bv->beforeChange(this);
- update();
if (is_rtl)
cursorLeft(false);
if (cursor.pos() < cursor.par()->size()
bool const is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params);
if (!selection.mark())
bv->beforeChange(this);
- update();
LyXCursor const cur = cursor;
if (!is_rtl)
cursorLeft(false);
case LFUN_UP:
if (!selection.mark())
bv->beforeChange(this);
- bv->update();
cursorUp(false);
finishChange(bv);
break;
case LFUN_DOWN:
if (!selection.mark())
bv->beforeChange(this);
- bv->update();
cursorDown(false);
finishChange(bv);
break;
case LFUN_UP_PARAGRAPH:
if (!selection.mark())
bv->beforeChange(this);
- bv->update();
cursorUpParagraph();
finishChange(bv);
break;
case LFUN_DOWN_PARAGRAPH:
if (!selection.mark())
bv->beforeChange(this);
- bv->update();
cursorDownParagraph();
finishChange(bv, false);
break;
case LFUN_PRIOR:
if (!selection.mark())
bv->beforeChange(this);
- bv->update();
cursorPrevious();
finishChange(bv, false);
break;
case LFUN_NEXT:
if (!selection.mark())
bv->beforeChange(this);
- bv->update();
cursorNext();
finishChange(bv, false);
break;
case LFUN_HOME:
if (!selection.mark())
bv->beforeChange(this);
- update();
cursorHome();
finishChange(bv, false);
break;
case LFUN_END:
if (!selection.mark())
bv->beforeChange(this);
- update();
cursorEnd();
finishChange(bv, false);
break;
replaceSelection(bv->getLyXText());
insertInset(new InsetNewline);
- update();
setCursor(cursor.par(), cursor.pos());
moveCursorUpdate(bv, false);
break;
if (!selection.set()) {
Delete();
selection.cursor = cursor;
- update();
// It is possible to make it a lot faster still
// just comment out the line below...
} else {
cutSelection(true, false);
- update();
}
moveCursorUpdate(bv, false);
bv->owner()->view_state_changed();
if (bv->owner()->getIntl().getTransManager().backspace()) {
backspace();
selection.cursor = cursor;
- update();
// It is possible to make it a lot faster still
// just comment out the line below...
}
} else {
cutSelection(true, false);
- update();
}
bv->owner()->view_state_changed();
bv->switchKeyMap();
+ update();
break;
case LFUN_BACKSPACE_SKIP:
if (!selection.set()) {
LyXCursor cur = cursor;
if (cur.pos() == 0
- && !(cur.par()->params().spaceTop()
- == VSpace (VSpace::NONE))) {
+ && !(cur.par()->params().spaceTop() == VSpace(VSpace::NONE))) {
setParagraph(
cur.par()->params().lineTop(),
cur.par()->params().lineBottom(),
cur.par()->params().pagebreakTop(),
cur.par()->params().pagebreakBottom(),
- VSpace(VSpace::NONE), cur.par()->params().spaceBottom(),
+ VSpace(VSpace::NONE),
+ cur.par()->params().spaceBottom(),
cur.par()->params().spacing(),
cur.par()->params().align(),
cur.par()->params().labelWidthString(), 0);
case LFUN_SETMARK:
bv->beforeChange(this);
if (selection.mark()) {
- update();
cmd.message(N_("Mark removed"));
} else {
selection.mark(true);
- update();
cmd.message(N_("Mark set"));
}
selection.cursor = cursor;
+ update();
break;
case LFUN_UPCASE_WORD:
break;
case LFUN_LOWCASE_WORD:
- update();
changeCase(LyXText::text_lowercase);
if (inset_owner)
bv->updateInset();
break;
case LFUN_CAPITALIZE_WORD:
- update();
changeCase(LyXText::text_capitalization);
if (inset_owner)
bv->updateInset();
break;
case LFUN_TRANSPOSE_CHARS:
- update();
recordUndo(bv, Undo::ATOMIC, cursor.par());
if (transposeChars(cursor))
checkParagraph(cursor.par(), cursor.pos());
}
case LFUN_CUT:
- update();
cutSelection(true, true);
- update();
cmd.message(_("Cut"));
+ update();
break;
case LFUN_COPY:
case LFUN_BEGINNINGBUFSEL:
if (inset_owner)
return UNDISPATCHED;
- update();
cursorTop();
finishChange(bv, true);
+ update();
break;
case LFUN_ENDBUFSEL:
if (inset_owner)
return UNDISPATCHED;
- update();
cursorBottom();
finishChange(bv, true);
+ update();
break;
case LFUN_GETXY:
#include "textcursor.h"
-bool TextCursor::setSelection()
+void TextCursor::setSelection()
{
- bool const lsel = selection.set();
-
if (!selection.set()) {
- last_sel_cursor = selection.cursor;
selection.start = selection.cursor;
selection.end = selection.cursor;
}
selection.set(true);
- last_sel_cursor = cursor;
-
// and now the whole selection
-
if (selection.cursor.par() == cursor.par())
if (selection.cursor.pos() < cursor.pos()) {
selection.end = cursor;
// a selection with no contents is not a selection
if (selection.start.par() == selection.end.par() &&
selection.start.pos() == selection.end.pos())
+ {
selection.set(false);
-
- return lsel;
+ }
}
{
selection.set(false);
selection.mark(false);
- last_sel_cursor = selection.end = selection.start = selection.cursor = cursor;
+ selection.end = cursor;
+ selection.start = cursor;
+ selection.cursor = cursor;
}