Hello,
*** I just did (more or less) the "2" option : I changed
LyXText::CursorRightOneWord()
to
LyXText::CursorRightOneWord( bool skip_punctuation_too = true )
In yesterday's mail, I wrote "0" instead of "true"; the correct
default value is "true".
*** I have implemented the following "New" behavior of M-right
("\" shows the successive cursor positions) :
"Hello, world"
Old \ \ \
New \ \ \ \
Bis \ \ \
"Hello, world"
Old \ \
New \ \ \
Bis \ \
If you like, I can also implement the "Bis" behavior, which is
probably more like what one wants (that's also what emacs does).
***
> the current word). It seems to me that the few uses of
> CursorRightOneWord in the code would not be hurt by this change.
Checking it would take some time and thought.
***
> PS: until we decide what to do, I will not apply your
> word-delete-forward patch.
Good. The new patch is very small, and makes the old one useless
(I've removed it from the code).
Should I go for the "Bis" behavior, or just stay with "New"?
Cheers,
Etienne
Here's the patch for "New" (it's made by diff -b, so indentation is
not always correct, but it's more readable). First chunk just corrects
a typo.
======================================================================
--- text.C.orig Mon Jan 11 19:59:34 1999
+++ text.C Tue Jan 19 11:43:47 1999
@@ -2531,10 +2531,10 @@
/* the cursor set functions have a special mechanism. When they
* realize, that you left an empty paragraph, they will delete it.
-* They also delet the corresponding row */
+* They also delete the corresponding row */
-void LyXText::CursorRightOneWord()
+void LyXText::CursorRightOneWord( bool skip_punct )
{
// treat floats, HFills and Insets as words
LyXCursor tmpcursor = cursor;
@@ -2556,6 +2556,7 @@
tmpcursor.pos++;
steps++;
}
+ if( skip_punct || steps == 0 )
while (tmpcursor.pos < tmpcursor.par->Last()
&& (tmpcursor.par->IsSeparator(tmpcursor.pos)
|| tmpcursor.par->IsKomma(tmpcursor.pos)
@@ -2815,7 +2816,7 @@
SetCursorIntern(cursor.par, cursor.pos);
selection = True; // to avoid deletion
- CursorRightOneWord();
+ CursorRightOneWord( false );
sel_cursor = cursor;
cursor = tmpcursor;
SetSelection();
--- lyxtext.h.orig Tue Jan 19 09:06:06 1999
+++ lyxtext.h Tue Jan 19 09:44:01 1999
@@ -237,7 +237,7 @@
///
void CursorLeftOneWord();
///
- void CursorRightOneWord();
+ void CursorRightOneWord( bool = true );
///
void CursorUpParagraph();
///
--- lyxfunc.C.orig Tue Dec 29 14:38:51 1998
+++ lyxfunc.C Tue Jan 19 11:07:22 1999
@@ -1395,7 +1395,7 @@
if(!owner->currentBuffer()->text->mark_set)
BeforeChange();
owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorRightOneWord();
+ owner->currentBuffer()->text->CursorRightOneWord(false);
owner->currentBuffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
@@ -1515,7 +1515,7 @@
case LFUN_WORDRIGHTSEL:
owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorRightOneWord();
+ owner->currentBuffer()->text->CursorRightOneWord(false);
owner->currentBuffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
======================================================================