Patch for ticket #6848

2010-08-21 Thread Punyashloka Biswal
Dear LyX developers,

This is my first patch for LyX. Please let me know if this works.

Punya
Index: src/LyX.cpp
===
--- src/LyX.cpp	(revision 35181)
+++ src/LyX.cpp	(working copy)
@@ -464,7 +464,7 @@
 		return EXIT_FAILURE;
 
 	// Remaining arguments are assumed to be files to load.
-	for (int argi = argc - 1; argi = 1; --argi)
+	for (int argi = 1; argi = argc - 1; ++argi)
 		pimpl_-files_to_load_.push_back(os::utf8_argv(argi));
 
 	if (first_start) {


Re: Typing in LyX extremely slow / produced high X server load

2010-08-21 Thread Guenter Milde
On 2010-08-20, Rainer Dorsch wrote:
 Am Freitag, 20. August 2010 schrieb Paul Johnson:
 On Fri, Aug 20, 2010 at 12:09 PM, Rainer Dorsch rdor...@web.de wrote:

  I noticed that typing in LyX sometimes becomes incredibly slow (it
  takes approximately 1s per character). top shows in these cases a
  very high Xserver load:

 I think LyX was a victim not the root cause, I found in my Xorg.0.log file:

 [mi] EQ overflowing. The server is probably stuck in an infinite loop.

...

 Not sure what is causing that, but that does not look goodI
 disabled kwin effects (KDE4) now, hoping that this removes enough
 stress from the X server that I do not see the EQ overflowing often
 anymore.

I once had a similar problem due to bad interaction with the clipboard
manager. Do you use klipboard? What happens if you disable it?

Just a guess...

Günter



Re: Patch for ticket #6848

2010-08-21 Thread Jürgen Spitzmüller
Punyashloka Biswal wrote:
 This is my first patch for LyX. Please let me know if this works.

Hi Punya,

it did not test it, but it looks logical. One nitpick:

Index: src/LyX.cpp
===
--- src/LyX.cpp (revision 35181)
+++ src/LyX.cpp (working copy)
@@ -464,7 +464,7 @@
return EXIT_FAILURE;
 
// Remaining arguments are assumed to be files to load.
-   for (int argi = argc - 1; argi = 1; --argi)
+   for (int argi = 1; argi = argc - 1; ++argi)

why not

+   for (int argi = 1; argi  argc; ++argi)

Welcome on board,
Jürgen


Re: Patch for ticket #6848

2010-08-21 Thread Punyashloka Biswal
Based on independent suggestions from Stephan Witt and Juergen
Spitzmueller, here's an updated patch.

Punya


6848.patch
Description: Binary data


Re: Patch for ticket #6848

2010-08-21 Thread Stephan Witt
Am 21.08.2010 um 15:36 schrieb Punyashloka Biswal:

 Yes, it works. But I'll propose a slightly simpler version.
 
 Agreed, that's better. Should I resend your version to the mailing
 list and/or attach it to the ticket?

I've commit it, thanks.
As Jürgen said, welcome.

 Also, I'm curious: do you know why was the loop written backwards in
 the first place?

No, I tried to find a related change of that loop in the history...
... but it seems like no change happened here. 

So I guess, in the past the push operation was accompanied with a pop and the 
reverse order was correct.
Now it has changed somehow to a queue like thing and the reversed order got 
false, as a side effect.
(Somehow here means, I have no time to verify how that happened...)

Stephan

[PATCH] #1839, ctrl+arrows don't move to the next/prev table cell

2010-08-21 Thread Punyashloka Biswal
I followed Richard Heck's suggestions on the ticket and made the small
changes in InsetTabular::doDispatch() that were necessary. In
addition, I had to modify Text::dispatch() because in some cases it
didn't undispatch() when trying to move past the beginning or end of a
paragraph.

Punya
Index: src/insets/InsetTabular.cpp
===
--- src/insets/InsetTabular.cpp	(revision 35182)
+++ src/insets/InsetTabular.cpp	(working copy)
@@ -3773,7 +3773,15 @@
 	case LFUN_CHAR_RIGHT_SELECT:
 	case LFUN_CHAR_RIGHT:
 	case LFUN_CHAR_LEFT_SELECT:
-	case LFUN_CHAR_LEFT: {
+	case LFUN_CHAR_LEFT:
+	case LFUN_WORD_FORWARD_SELECT:
+	case LFUN_WORD_FORWARD:
+	case LFUN_WORD_BACKWARD_SELECT:
+	case LFUN_WORD_BACKWARD:
+case LFUN_WORD_LEFT_SELECT:
+case LFUN_WORD_LEFT:
+case LFUN_WORD_RIGHT_SELECT:
+case LFUN_WORD_RIGHT: {
 		// determine whether we move to next or previous cell, where to enter 
 		// the new cell from, and which command to finish (i.e., exit the
 		// inset) with:
@@ -3782,12 +3790,16 @@
 		FuncCode finish_lfun;
 
 		if (act == LFUN_CHAR_FORWARD 
-|| act == LFUN_CHAR_FORWARD_SELECT) {
+|| act == LFUN_CHAR_FORWARD_SELECT
+|| act == LFUN_WORD_FORWARD
+|| act == LFUN_WORD_FORWARD_SELECT) {
 			next_cell = true;
 			finish_lfun = LFUN_FINISHED_FORWARD;
 		}
 		else if (act == LFUN_CHAR_BACKWARD
-|| act == LFUN_CHAR_BACKWARD_SELECT) {
+|| act == LFUN_CHAR_BACKWARD_SELECT
+|| act == LFUN_WORD_BACKWARD
+|| act == LFUN_WORD_BACKWARD_SELECT) {
 			next_cell = false;
 			finish_lfun = LFUN_FINISHED_BACKWARD;
 		}
@@ -3795,7 +3807,9 @@
 		// table's direction.
 		else {
 			bool const right = act == LFUN_CHAR_RIGHT
-|| act == LFUN_CHAR_RIGHT_SELECT;
+|| act == LFUN_CHAR_RIGHT_SELECT
+|| act == LFUN_WORD_RIGHT
+|| act == LFUN_WORD_RIGHT_SELECT;
 			next_cell = isRightToLeft(cur) != right;
 			
 			if (lyxrc.visual_cursor)
@@ -3807,7 +3821,11 @@
 		bool const select = act == LFUN_CHAR_FORWARD_SELECT ||
 		act == LFUN_CHAR_BACKWARD_SELECT ||
 		act == LFUN_CHAR_RIGHT_SELECT ||
-		act == LFUN_CHAR_LEFT_SELECT;
+		act == LFUN_CHAR_LEFT_SELECT ||
+		act == LFUN_WORD_FORWARD_SELECT ||
+		act == LFUN_WORD_BACKWARD_SELECT ||
+		act == LFUN_WORD_RIGHT_SELECT ||
+		act == LFUN_WORD_LEFT_SELECT;
 
 		// If we have a multicell selection or we're 
 		// not doing some LFUN_*_SELECT thing anyway...
Index: src/Text3.cpp
===
--- src/Text3.cpp	(revision 35182)
+++ src/Text3.cpp	(working copy)
@@ -819,6 +819,11 @@
 	case LFUN_WORD_FORWARD_SELECT:
 		needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_FORWARD_SELECT);
 		needsUpdate |= cursorForwardOneWord(cur);
+if (!needsUpdate  oldTopSlice == cur.top()
+		 cur.boundary() == oldBoundary) {
+	cur.undispatched();
+	cmd = FuncRequest(LFUN_FINISHED_FORWARD);
+}
 		break;
 
 	case LFUN_WORD_LEFT:
@@ -848,6 +853,11 @@
 	case LFUN_WORD_BACKWARD_SELECT:
 		needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_BACKWARD_SELECT);
 		needsUpdate |= cursorBackwardOneWord(cur);
+if (!needsUpdate  oldTopSlice == cur.top()
+		 cur.boundary() == oldBoundary) {
+	cur.undispatched();
+	cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
+}
 		break;
 
 	case LFUN_WORD_SELECT: {


Re: [PATCH] #1839, ctrl+arrows don't move to the next/prev table cell

2010-08-21 Thread Stephan Witt
Am 21.08.2010 um 21:32 schrieb Punyashloka Biswal:

 I followed Richard Heck's suggestions on the ticket and made the small
 changes in InsetTabular::doDispatch() that were necessary. In
 addition, I had to modify Text::dispatch() because in some cases it
 didn't undispatch() when trying to move past the beginning or end of a
 paragraph.
 

Ok, I applied the patch locally, tested it and it seems to cure the symptom.
I'll wait for others to comment, but surely there is a style problem in your 
patch.
Some lines of new code are indented with spaces. I think tabs should be used 
here.

Stephan

Re: [PATCH] #1839, ctrl+arrows don't move to the next/prev table cell

2010-08-21 Thread Punyashloka Biswal
 I'll wait for others to comment, but surely there is a style problem in your 
 patch.
 Some lines of new code are indented with spaces. I think tabs should be used 
 here.

Sorry about that. I've replaced the offending spaces with tabs now.

Punya
Index: src/insets/InsetTabular.cpp
===
--- src/insets/InsetTabular.cpp	(revision 35182)
+++ src/insets/InsetTabular.cpp	(working copy)
@@ -3773,7 +3773,15 @@
 	case LFUN_CHAR_RIGHT_SELECT:
 	case LFUN_CHAR_RIGHT:
 	case LFUN_CHAR_LEFT_SELECT:
-	case LFUN_CHAR_LEFT: {
+	case LFUN_CHAR_LEFT:
+	case LFUN_WORD_FORWARD_SELECT:
+	case LFUN_WORD_FORWARD:
+	case LFUN_WORD_BACKWARD_SELECT:
+	case LFUN_WORD_BACKWARD:
+	case LFUN_WORD_LEFT_SELECT:
+	case LFUN_WORD_LEFT:
+	case LFUN_WORD_RIGHT_SELECT:
+	case LFUN_WORD_RIGHT: {
 		// determine whether we move to next or previous cell, where to enter 
 		// the new cell from, and which command to finish (i.e., exit the
 		// inset) with:
@@ -3782,12 +3790,16 @@
 		FuncCode finish_lfun;
 
 		if (act == LFUN_CHAR_FORWARD 
-|| act == LFUN_CHAR_FORWARD_SELECT) {
+|| act == LFUN_CHAR_FORWARD_SELECT
+|| act == LFUN_WORD_FORWARD
+|| act == LFUN_WORD_FORWARD_SELECT) {
 			next_cell = true;
 			finish_lfun = LFUN_FINISHED_FORWARD;
 		}
 		else if (act == LFUN_CHAR_BACKWARD
-|| act == LFUN_CHAR_BACKWARD_SELECT) {
+|| act == LFUN_CHAR_BACKWARD_SELECT
+|| act == LFUN_WORD_BACKWARD
+|| act == LFUN_WORD_BACKWARD_SELECT) {
 			next_cell = false;
 			finish_lfun = LFUN_FINISHED_BACKWARD;
 		}
@@ -3795,7 +3807,9 @@
 		// table's direction.
 		else {
 			bool const right = act == LFUN_CHAR_RIGHT
-|| act == LFUN_CHAR_RIGHT_SELECT;
+|| act == LFUN_CHAR_RIGHT_SELECT
+|| act == LFUN_WORD_RIGHT
+|| act == LFUN_WORD_RIGHT_SELECT;
 			next_cell = isRightToLeft(cur) != right;
 			
 			if (lyxrc.visual_cursor)
@@ -3807,7 +3821,11 @@
 		bool const select = act == LFUN_CHAR_FORWARD_SELECT ||
 		act == LFUN_CHAR_BACKWARD_SELECT ||
 		act == LFUN_CHAR_RIGHT_SELECT ||
-		act == LFUN_CHAR_LEFT_SELECT;
+		act == LFUN_CHAR_LEFT_SELECT ||
+		act == LFUN_WORD_FORWARD_SELECT ||
+		act == LFUN_WORD_BACKWARD_SELECT ||
+		act == LFUN_WORD_RIGHT_SELECT ||
+		act == LFUN_WORD_LEFT_SELECT;
 
 		// If we have a multicell selection or we're 
 		// not doing some LFUN_*_SELECT thing anyway...
Index: src/Text3.cpp
===
--- src/Text3.cpp	(revision 35182)
+++ src/Text3.cpp	(working copy)
@@ -819,6 +819,11 @@
 	case LFUN_WORD_FORWARD_SELECT:
 		needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_FORWARD_SELECT);
 		needsUpdate |= cursorForwardOneWord(cur);
+		if (!needsUpdate  oldTopSlice == cur.top()
+ cur.boundary() == oldBoundary) {
+			cur.undispatched();
+			cmd = FuncRequest(LFUN_FINISHED_FORWARD);
+		}
 		break;
 
 	case LFUN_WORD_LEFT:
@@ -848,6 +853,11 @@
 	case LFUN_WORD_BACKWARD_SELECT:
 		needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_BACKWARD_SELECT);
 		needsUpdate |= cursorBackwardOneWord(cur);
+		if (!needsUpdate  oldTopSlice == cur.top()
+ cur.boundary() == oldBoundary) {
+			cur.undispatched();
+			cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
+		}
 		break;
 
 	case LFUN_WORD_SELECT: {


Patch for ticket #6848

2010-08-21 Thread Punyashloka Biswal
Dear LyX developers,

This is my first patch for LyX. Please let me know if this works.

Punya
Index: src/LyX.cpp
===
--- src/LyX.cpp	(revision 35181)
+++ src/LyX.cpp	(working copy)
@@ -464,7 +464,7 @@
 		return EXIT_FAILURE;
 
 	// Remaining arguments are assumed to be files to load.
-	for (int argi = argc - 1; argi >= 1; --argi)
+	for (int argi = 1; argi <= argc - 1; ++argi)
 		pimpl_->files_to_load_.push_back(os::utf8_argv(argi));
 
 	if (first_start) {


Re: Typing in LyX extremely slow / produced high X server load

2010-08-21 Thread Guenter Milde
On 2010-08-20, Rainer Dorsch wrote:
> Am Freitag, 20. August 2010 schrieb Paul Johnson:
>> On Fri, Aug 20, 2010 at 12:09 PM, Rainer Dorsch  wrote:

>> > I noticed that typing in LyX sometimes becomes incredibly slow (it
>> > takes approximately 1s per character). top shows in these cases a
>> > very high Xserver load:

> I think LyX was a victim not the root cause, I found in my Xorg.0.log file:

> [mi] EQ overflowing. The server is probably stuck in an infinite loop.

...

> Not sure what is causing that, but that does not look goodI
> disabled kwin effects (KDE4) now, hoping that this removes enough
> stress from the X server that I do not see the EQ overflowing often
> anymore.

I once had a similar problem due to bad interaction with the clipboard
manager. Do you use klipboard? What happens if you disable it?

Just a guess...

Günter



Re: Patch for ticket #6848

2010-08-21 Thread Jürgen Spitzmüller
Punyashloka Biswal wrote:
> This is my first patch for LyX. Please let me know if this works.

Hi Punya,

it did not test it, but it looks logical. One nitpick:

Index: src/LyX.cpp
===
--- src/LyX.cpp (revision 35181)
+++ src/LyX.cpp (working copy)
@@ -464,7 +464,7 @@
return EXIT_FAILURE;
 
// Remaining arguments are assumed to be files to load.
-   for (int argi = argc - 1; argi >= 1; --argi)
+   for (int argi = 1; argi <= argc - 1; ++argi)

why not

+   for (int argi = 1; argi < argc; ++argi)

Welcome on board,
Jürgen


Re: Patch for ticket #6848

2010-08-21 Thread Punyashloka Biswal
Based on independent suggestions from Stephan Witt and Juergen
Spitzmueller, here's an updated patch.

Punya


6848.patch
Description: Binary data


Re: Patch for ticket #6848

2010-08-21 Thread Stephan Witt
Am 21.08.2010 um 15:36 schrieb Punyashloka Biswal:

>> Yes, it works. But I'll propose a slightly simpler version.
> 
> Agreed, that's better. Should I resend your version to the mailing
> list and/or attach it to the ticket?

I've commit it, thanks.
As Jürgen said, welcome.

> Also, I'm curious: do you know why was the loop written "backwards" in
> the first place?

No, I tried to find a related change of that loop in the history...
... but it seems like no change happened here. 

So I guess, in the past the push operation was accompanied with a pop and the 
reverse order was correct.
Now it has changed somehow to a queue like thing and the reversed order got 
false, as a side effect.
(Somehow here means, I have no time to verify how that happened...)

Stephan

[PATCH] #1839, ctrl+arrows don't move to the next/prev table cell

2010-08-21 Thread Punyashloka Biswal
I followed Richard Heck's suggestions on the ticket and made the small
changes in InsetTabular::doDispatch() that were necessary. In
addition, I had to modify Text::dispatch() because in some cases it
didn't undispatch() when trying to move past the beginning or end of a
paragraph.

Punya
Index: src/insets/InsetTabular.cpp
===
--- src/insets/InsetTabular.cpp	(revision 35182)
+++ src/insets/InsetTabular.cpp	(working copy)
@@ -3773,7 +3773,15 @@
 	case LFUN_CHAR_RIGHT_SELECT:
 	case LFUN_CHAR_RIGHT:
 	case LFUN_CHAR_LEFT_SELECT:
-	case LFUN_CHAR_LEFT: {
+	case LFUN_CHAR_LEFT:
+	case LFUN_WORD_FORWARD_SELECT:
+	case LFUN_WORD_FORWARD:
+	case LFUN_WORD_BACKWARD_SELECT:
+	case LFUN_WORD_BACKWARD:
+case LFUN_WORD_LEFT_SELECT:
+case LFUN_WORD_LEFT:
+case LFUN_WORD_RIGHT_SELECT:
+case LFUN_WORD_RIGHT: {
 		// determine whether we move to next or previous cell, where to enter 
 		// the new cell from, and which command to "finish" (i.e., exit the
 		// inset) with:
@@ -3782,12 +3790,16 @@
 		FuncCode finish_lfun;
 
 		if (act == LFUN_CHAR_FORWARD 
-|| act == LFUN_CHAR_FORWARD_SELECT) {
+|| act == LFUN_CHAR_FORWARD_SELECT
+|| act == LFUN_WORD_FORWARD
+|| act == LFUN_WORD_FORWARD_SELECT) {
 			next_cell = true;
 			finish_lfun = LFUN_FINISHED_FORWARD;
 		}
 		else if (act == LFUN_CHAR_BACKWARD
-|| act == LFUN_CHAR_BACKWARD_SELECT) {
+|| act == LFUN_CHAR_BACKWARD_SELECT
+|| act == LFUN_WORD_BACKWARD
+|| act == LFUN_WORD_BACKWARD_SELECT) {
 			next_cell = false;
 			finish_lfun = LFUN_FINISHED_BACKWARD;
 		}
@@ -3795,7 +3807,9 @@
 		// table's direction.
 		else {
 			bool const right = act == LFUN_CHAR_RIGHT
-|| act == LFUN_CHAR_RIGHT_SELECT;
+|| act == LFUN_CHAR_RIGHT_SELECT
+|| act == LFUN_WORD_RIGHT
+|| act == LFUN_WORD_RIGHT_SELECT;
 			next_cell = isRightToLeft(cur) != right;
 			
 			if (lyxrc.visual_cursor)
@@ -3807,7 +3821,11 @@
 		bool const select = act == LFUN_CHAR_FORWARD_SELECT ||
 		act == LFUN_CHAR_BACKWARD_SELECT ||
 		act == LFUN_CHAR_RIGHT_SELECT ||
-		act == LFUN_CHAR_LEFT_SELECT;
+		act == LFUN_CHAR_LEFT_SELECT ||
+		act == LFUN_WORD_FORWARD_SELECT ||
+		act == LFUN_WORD_BACKWARD_SELECT ||
+		act == LFUN_WORD_RIGHT_SELECT ||
+		act == LFUN_WORD_LEFT_SELECT;
 
 		// If we have a multicell selection or we're 
 		// not doing some LFUN_*_SELECT thing anyway...
Index: src/Text3.cpp
===
--- src/Text3.cpp	(revision 35182)
+++ src/Text3.cpp	(working copy)
@@ -819,6 +819,11 @@
 	case LFUN_WORD_FORWARD_SELECT:
 		needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_FORWARD_SELECT);
 		needsUpdate |= cursorForwardOneWord(cur);
+if (!needsUpdate && oldTopSlice == cur.top()
+		&& cur.boundary() == oldBoundary) {
+	cur.undispatched();
+	cmd = FuncRequest(LFUN_FINISHED_FORWARD);
+}
 		break;
 
 	case LFUN_WORD_LEFT:
@@ -848,6 +853,11 @@
 	case LFUN_WORD_BACKWARD_SELECT:
 		needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_BACKWARD_SELECT);
 		needsUpdate |= cursorBackwardOneWord(cur);
+if (!needsUpdate && oldTopSlice == cur.top()
+		&& cur.boundary() == oldBoundary) {
+	cur.undispatched();
+	cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
+}
 		break;
 
 	case LFUN_WORD_SELECT: {


Re: [PATCH] #1839, ctrl+arrows don't move to the next/prev table cell

2010-08-21 Thread Stephan Witt
Am 21.08.2010 um 21:32 schrieb Punyashloka Biswal:

> I followed Richard Heck's suggestions on the ticket and made the small
> changes in InsetTabular::doDispatch() that were necessary. In
> addition, I had to modify Text::dispatch() because in some cases it
> didn't undispatch() when trying to move past the beginning or end of a
> paragraph.
> 

Ok, I applied the patch locally, tested it and it seems to cure the symptom.
I'll wait for others to comment, but surely there is a style problem in your 
patch.
Some lines of new code are indented with spaces. I think tabs should be used 
here.

Stephan

Re: [PATCH] #1839, ctrl+arrows don't move to the next/prev table cell

2010-08-21 Thread Punyashloka Biswal
> I'll wait for others to comment, but surely there is a style problem in your 
> patch.
> Some lines of new code are indented with spaces. I think tabs should be used 
> here.

Sorry about that. I've replaced the offending spaces with tabs now.

Punya
Index: src/insets/InsetTabular.cpp
===
--- src/insets/InsetTabular.cpp	(revision 35182)
+++ src/insets/InsetTabular.cpp	(working copy)
@@ -3773,7 +3773,15 @@
 	case LFUN_CHAR_RIGHT_SELECT:
 	case LFUN_CHAR_RIGHT:
 	case LFUN_CHAR_LEFT_SELECT:
-	case LFUN_CHAR_LEFT: {
+	case LFUN_CHAR_LEFT:
+	case LFUN_WORD_FORWARD_SELECT:
+	case LFUN_WORD_FORWARD:
+	case LFUN_WORD_BACKWARD_SELECT:
+	case LFUN_WORD_BACKWARD:
+	case LFUN_WORD_LEFT_SELECT:
+	case LFUN_WORD_LEFT:
+	case LFUN_WORD_RIGHT_SELECT:
+	case LFUN_WORD_RIGHT: {
 		// determine whether we move to next or previous cell, where to enter 
 		// the new cell from, and which command to "finish" (i.e., exit the
 		// inset) with:
@@ -3782,12 +3790,16 @@
 		FuncCode finish_lfun;
 
 		if (act == LFUN_CHAR_FORWARD 
-|| act == LFUN_CHAR_FORWARD_SELECT) {
+|| act == LFUN_CHAR_FORWARD_SELECT
+|| act == LFUN_WORD_FORWARD
+|| act == LFUN_WORD_FORWARD_SELECT) {
 			next_cell = true;
 			finish_lfun = LFUN_FINISHED_FORWARD;
 		}
 		else if (act == LFUN_CHAR_BACKWARD
-|| act == LFUN_CHAR_BACKWARD_SELECT) {
+|| act == LFUN_CHAR_BACKWARD_SELECT
+|| act == LFUN_WORD_BACKWARD
+|| act == LFUN_WORD_BACKWARD_SELECT) {
 			next_cell = false;
 			finish_lfun = LFUN_FINISHED_BACKWARD;
 		}
@@ -3795,7 +3807,9 @@
 		// table's direction.
 		else {
 			bool const right = act == LFUN_CHAR_RIGHT
-|| act == LFUN_CHAR_RIGHT_SELECT;
+|| act == LFUN_CHAR_RIGHT_SELECT
+|| act == LFUN_WORD_RIGHT
+|| act == LFUN_WORD_RIGHT_SELECT;
 			next_cell = isRightToLeft(cur) != right;
 			
 			if (lyxrc.visual_cursor)
@@ -3807,7 +3821,11 @@
 		bool const select = act == LFUN_CHAR_FORWARD_SELECT ||
 		act == LFUN_CHAR_BACKWARD_SELECT ||
 		act == LFUN_CHAR_RIGHT_SELECT ||
-		act == LFUN_CHAR_LEFT_SELECT;
+		act == LFUN_CHAR_LEFT_SELECT ||
+		act == LFUN_WORD_FORWARD_SELECT ||
+		act == LFUN_WORD_BACKWARD_SELECT ||
+		act == LFUN_WORD_RIGHT_SELECT ||
+		act == LFUN_WORD_LEFT_SELECT;
 
 		// If we have a multicell selection or we're 
 		// not doing some LFUN_*_SELECT thing anyway...
Index: src/Text3.cpp
===
--- src/Text3.cpp	(revision 35182)
+++ src/Text3.cpp	(working copy)
@@ -819,6 +819,11 @@
 	case LFUN_WORD_FORWARD_SELECT:
 		needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_FORWARD_SELECT);
 		needsUpdate |= cursorForwardOneWord(cur);
+		if (!needsUpdate && oldTopSlice == cur.top()
+&& cur.boundary() == oldBoundary) {
+			cur.undispatched();
+			cmd = FuncRequest(LFUN_FINISHED_FORWARD);
+		}
 		break;
 
 	case LFUN_WORD_LEFT:
@@ -848,6 +853,11 @@
 	case LFUN_WORD_BACKWARD_SELECT:
 		needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_BACKWARD_SELECT);
 		needsUpdate |= cursorBackwardOneWord(cur);
+		if (!needsUpdate && oldTopSlice == cur.top()
+&& cur.boundary() == oldBoundary) {
+			cur.undispatched();
+			cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
+		}
 		break;
 
 	case LFUN_WORD_SELECT: {