Hello,

> > 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.

Apparently, not skipping punctuation after the word does not pose
problems anywhere, so I think CursorRightOneWord can go back to its
old definition (so much less to patch). 




> *** 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        \      \


  I have appended a patch (against pre7) for the "Bis" behavior. I
prefer "Bis" over "New". 


  Cheers,


  Etienne

======================================================================
--- text.C.orig Mon Jan 11 19:59:34 1999
+++ text.C      Tue Jan 19 16:45:55 1999
@@ -2531,7 +2531,14 @@
 
 /* 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 */
+
+// A character that's not a separator, comma, etc is in a word.
+#define WORDCHAR(x) (!( (x).par->IsSeparator((x).pos) \
+                       || (x).par->IsKomma((x).pos)  \
+                       || (x).par->IsHfill((x).pos)  \
+                       || (x).par->IsFloat((x).pos)  \
+                       || (x).par->IsInset((x).pos)))
 
 
 void LyXText::CursorRightOneWord()
@@ -2546,29 +2553,20 @@
                        tmpcursor.pos = 0;
        } else {
                int steps = 0;
+
+               // Skip through initial nonword stuff.
                while (tmpcursor.pos < tmpcursor.par->Last()
-                      && !tmpcursor.par->IsSeparator(tmpcursor.pos)
-                      && !tmpcursor.par->IsKomma(tmpcursor.pos)
-                      && !tmpcursor.par->IsHfill(tmpcursor.pos)
-                      && !tmpcursor.par->IsFloat(tmpcursor.pos)
-                      && !tmpcursor.par->IsInset(tmpcursor.pos))
+                 && ! WORDCHAR(tmpcursor) )
                {
                        tmpcursor.pos++;
                        steps++;
                }
+               // Advance through word.
                while (tmpcursor.pos < tmpcursor.par->Last()
-                      && (tmpcursor.par->IsSeparator(tmpcursor.pos)
-                          || tmpcursor.par->IsKomma(tmpcursor.pos)
-                          || tmpcursor.par->IsHfill(tmpcursor.pos)
-                          || tmpcursor.par->IsFloat(tmpcursor.pos)
-                          || tmpcursor.par->IsInset(tmpcursor.pos)))
+                 && WORDCHAR(tmpcursor) )
                {
-                       if ((tmpcursor.par->IsInset(tmpcursor.pos)
-                            || tmpcursor.par->IsFloat(tmpcursor.pos)
-                            || tmpcursor.par->IsHfill(tmpcursor.pos))
-                           && steps)
-                               break;
                        tmpcursor.pos++;
+                       steps++;
                }
        }
        SetCursor(tmpcursor.par, tmpcursor.pos);
======================================================================

Reply via email to