* src/text3.C (dispatch): merge the SEL and non-SEL cursor movement

LFUNs; use LCursor::selHandle consistently (fixes bugs 2119 and
	2259, and also a crash related to with dEPM)



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@14437 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2006-07-13 07:47:33 +00:00
parent c15af9cc85
commit bea368b6ac
3 changed files with 42 additions and 124 deletions

View File

@ -1,3 +1,13 @@
2006-07-13 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text3.C (dispatch): merge the SEL and non-SEL cursor movement
LFUNs; use LCursor::selHandle consistently (fixes bugs 2119 and
2259, and also a crash related to with dEPM)
2006-07-12 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* version.C.in: set release date.
2006-07-07 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* rowpainter.h (rightMargin): reduce to 10 pixels, like the left

View File

@ -364,64 +364,39 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
break;
case LFUN_WORDRIGHT:
if (!cur.mark())
cur.clearSelection();
case LFUN_WORDRIGHTSEL:
cur.selHandle(cmd.action == LFUN_WORDRIGHTSEL);
if (isRTL(cur.paragraph()))
needsUpdate = cursorLeftOneWord(cur);
else
needsUpdate = cursorRightOneWord(cur);
finishChange(cur, false);
break;
case LFUN_WORDLEFT:
if (!cur.mark())
cur.clearSelection();
case LFUN_WORDLEFTSEL:
cur.selHandle(cmd.action == LFUN_WORDLEFTSEL);
if (isRTL(cur.paragraph()))
needsUpdate = cursorRightOneWord(cur);
else
needsUpdate = cursorLeftOneWord(cur);
finishChange(cur, false);
break;
case LFUN_BEGINNINGBUF:
if (cur.depth() == 1) {
if (!cur.mark())
cur.clearSelection();
needsUpdate = cursorTop(cur);
finishChange(cur, false);
} else {
cur.undispatched();
}
break;
case LFUN_BEGINNINGBUFSEL:
cur.selHandle(cmd.action == LFUN_BEGINNINGBUFSEL);
if (cur.depth() == 1) {
if (!cur.selection())
cur.resetAnchor();
needsUpdate = cursorTop(cur);
finishChange(cur, true);
} else {
cur.undispatched();
}
break;
case LFUN_ENDBUF:
if (cur.depth() == 1) {
if (!cur.mark())
cur.clearSelection();
needsUpdate = cursorBottom(cur);
finishChange(cur, false);
} else {
cur.undispatched();
}
break;
case LFUN_ENDBUFSEL:
cur.selHandle(cmd.action == LFUN_ENDBUFSEL);
if (cur.depth() == 1) {
if (!cur.selection())
cur.resetAnchor();
needsUpdate = cursorBottom(cur);
finishChange(cur, true);
} else {
cur.undispatched();
}
@ -489,96 +464,21 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
break;
case LFUN_UP_PARAGRAPH:
if (!cur.mark())
cur.clearSelection();
needsUpdate = cursorUpParagraph(cur);
finishChange(cur, false);
break;
case LFUN_UP_PARAGRAPHSEL:
if (!cur.selection())
cur.resetAnchor();
cursorUpParagraph(cur);
finishChange(cur, true);
cur.selHandle(cmd.action == LFUN_UP_PARAGRAPHSEL);
needsUpdate = cursorUpParagraph(cur);
break;
case LFUN_DOWN_PARAGRAPH:
if (!cur.mark())
cur.clearSelection();
needsUpdate = cursorDownParagraph(cur);
finishChange(cur, false);
break;
case LFUN_DOWN_PARAGRAPHSEL:
if (!cur.selection())
cur.resetAnchor();
cursorDownParagraph(cur);
finishChange(cur, true);
cur.selHandle(cmd.action == LFUN_DOWN_PARAGRAPHSEL);
needsUpdate = cursorDownParagraph(cur);
break;
case LFUN_PRIORSEL:
update(cur);
if (!cur.selection())
cur.resetAnchor();
needsUpdate = cursorPrevious(cur);
finishChange(cur, true);
break;
case LFUN_NEXTSEL:
update(cur);
if (!cur.selection())
cur.resetAnchor();
needsUpdate = cursorNext(cur);
finishChange(cur, true);
break;
case LFUN_HOMESEL:
update(cur);
if (!cur.selection())
cur.resetAnchor();
needsUpdate = cursorHome(cur);
finishChange(cur, true);
break;
case LFUN_ENDSEL:
update(cur);
if (!cur.selection())
cur.resetAnchor();
needsUpdate = cursorEnd(cur);
finishChange(cur, true);
break;
case LFUN_WORDRIGHTSEL:
if (!cur.selection())
cur.resetAnchor();
if (isRTL(cur.paragraph()))
cursorLeftOneWord(cur);
else
cursorRightOneWord(cur);
finishChange(cur, true);
break;
case LFUN_WORDLEFTSEL:
if (!cur.selection())
cur.resetAnchor();
if (isRTL(cur.paragraph()))
cursorRightOneWord(cur);
else
cursorLeftOneWord(cur);
finishChange(cur, true);
break;
case LFUN_WORDSEL: {
selectWord(cur, lyx::WHOLE_WORD);
finishChange(cur, true);
break;
}
case LFUN_PRIOR:
case LFUN_PRIORSEL:
update(cur);
if (!cur.mark())
cur.clearSelection();
finishChange(cur, false);
cur.selHandle(cmd.action == LFUN_PRIORSEL);
if (cur.pit() == 0 && cur.textRow().pos() == 0) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_UP);
@ -588,10 +488,9 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
break;
case LFUN_NEXT:
case LFUN_NEXTSEL:
update(cur);
if (!cur.mark())
cur.clearSelection();
finishChange(cur, false);
cur.selHandle(cmd.action == LFUN_NEXTSEL);
if (cur.pit() == cur.lastpit()
&& cur.textRow().endpos() == cur.lastpos()) {
cur.undispatched();
@ -602,19 +501,25 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
break;
case LFUN_HOME:
if (!cur.mark())
cur.clearSelection();
case LFUN_HOMESEL:
update(cur);
cur.selHandle(cmd.action == LFUN_HOMESEL);
needsUpdate = cursorHome(cur);
finishChange(cur, false);
break;
case LFUN_END:
if (!cur.mark())
cur.clearSelection();
case LFUN_ENDSEL:
update(cur);
cur.selHandle(cmd.action == LFUN_ENDSEL);
needsUpdate = cursorEnd(cur);
finishChange(cur, false);
break;
case LFUN_WORDSEL: {
selectWord(cur, lyx::WHOLE_WORD);
finishChange(cur, true);
break;
}
case LFUN_BREAKLINE: {
// Not allowed by LaTeX (labels or empty par)
if (cur.pos() > cur.paragraph().beginOfBody()) {

View File

@ -63,8 +63,8 @@ What's new
- Don't jump back to the previous cursor position when trying to click on
an inset (bug 2526).
- Automatically use fonts in the fonts/ subdirectory of the LyX support
directory on Windows.
- Fix several cursor movement functions when initiating a selection
(bugs 2119 and 2259, and a crash).
- Disable saving of bookmarks in mathed because it is not yet supported
and makes LyX crash (bug 2597).
@ -167,6 +167,9 @@ What's new
any of lyxrc.defaults, textclass.lst or packages.lst, it is re-run
before loading lyxrc.defaults and preferences.
- Automatically use fonts in the fonts/ subdirectory of the LyX support
directory on Windows.
- When compiling with --with-version-suffix on Windows, do not
rename the executable files.