Re: [PATCH] mathed cut crashes (1960, 1981)

2005-09-19 Thread Andre Poenitz
On Fri, Sep 16, 2005 at 12:46:12PM +0200, Juergen Spitzmueller wrote:
 Martin,
 what is this fix for bug 1981 supposed to do?
   case LFUN_CUT:
 + cur.pos() = 0; // Prevent stale position = size crash
   cutSelection(cur, true, true);
   cur.message(_(Cut));
   break;
 
 It is the cause of a rather silly behaviour: when you cut a selected string 
 from a math nestinset, not only the selection, but also everything preceeding 
 it will be cut.
 
 IMO (and I'm pretty sure) the correct fix is to use cur.normalize() instead, 
 which fixes the cursor position if it is outside the size() range. I have 
 tested that it fixes both bug 1981 and bug 1960, which seem to share the 
 cause.
 
 Can this go in?

It's the proper fix.

Andre'


Re: [PATCH] mathed cut crashes (1960, 1981)

2005-09-19 Thread Juergen Spitzmueller
Andre Poenitz wrote:
  Can this go in?

 It's the proper fix.

OK then?

Jürgen


Re: [PATCH] mathed cut crashes (1960, 1981)

2005-09-19 Thread Jean-Marc Lasgouttes
 Andre == Andre Poenitz [EMAIL PROTECTED] writes:

Andre It's the proper fix.

Thanks. Juergen, feel free to apply it.

JMarc


Re: [PATCH] mathed cut crashes (1960, 1981)

2005-09-19 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:
 Thanks. Juergen, feel free to apply it.

Done so. Thanks.

Jürgen


Re: [PATCH] mathed cut crashes (1960, 1981)

2005-09-19 Thread Andre Poenitz
On Fri, Sep 16, 2005 at 12:46:12PM +0200, Juergen Spitzmueller wrote:
> Martin,
> what is this fix for bug 1981 supposed to do?
>   case LFUN_CUT:
> + cur.pos() = 0; // Prevent stale position >= size crash
>   cutSelection(cur, true, true);
>   cur.message(_("Cut"));
>   break;
> 
> It is the cause of a rather silly behaviour: when you cut a selected string 
> from a math nestinset, not only the selection, but also everything preceeding 
> it will be cut.
> 
> IMO (and I'm pretty sure) the correct fix is to use cur.normalize() instead, 
> which fixes the cursor position if it is outside the size() range. I have 
> tested that it fixes both bug 1981 and bug 1960, which seem to share the 
> cause.
> 
> Can this go in?

It's the proper fix.

Andre'


Re: [PATCH] mathed cut crashes (1960, 1981)

2005-09-19 Thread Juergen Spitzmueller
Andre Poenitz wrote:
> > Can this go in?
>
> It's the proper fix.

OK then?

Jürgen


Re: [PATCH] mathed cut crashes (1960, 1981)

2005-09-19 Thread Jean-Marc Lasgouttes
> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes:

Andre> It's the proper fix.

Thanks. Juergen, feel free to apply it.

JMarc


Re: [PATCH] mathed cut crashes (1960, 1981)

2005-09-19 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:
> Thanks. Juergen, feel free to apply it.

Done so. Thanks.

Jürgen


[PATCH] mathed cut crashes (1960, 1981)

2005-09-16 Thread Juergen Spitzmueller
Martin,
what is this fix for bug 1981 supposed to do?
case LFUN_CUT:
+   cur.pos() = 0; // Prevent stale position = size crash
cutSelection(cur, true, true);
cur.message(_(Cut));
break;

It is the cause of a rather silly behaviour: when you cut a selected string 
from a math nestinset, not only the selection, but also everything preceeding 
it will be cut.

IMO (and I'm pretty sure) the correct fix is to use cur.normalize() instead, 
which fixes the cursor position if it is outside the size() range. I have 
tested that it fixes both bug 1981 and bug 1960, which seem to share the 
cause.

Can this go in?

Jürgen
Index: math_nestinset.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v
retrieving revision 1.166
diff -u -r1.166 math_nestinset.C
--- math_nestinset.C	19 Aug 2005 12:57:47 -	1.166
+++ math_nestinset.C	16 Sep 2005 10:39:01 -
@@ -423,9 +423,10 @@
 	}
 
 	case LFUN_CUT:
-		cur.pos() = 0; // Prevent stale position = size crash
 		cutSelection(cur, true, true);
 		cur.message(_(Cut));
+		// Prevent stale position = size crash
+		cur.normalize();
 		break;
 
 	case LFUN_COPY:


Re: [PATCH] mathed cut crashes (1960, 1981)

2005-09-16 Thread Martin Vermeer
On Fri, 2005-09-16 at 12:46 +0200, Juergen Spitzmueller wrote:
 Martin,
 what is this fix for bug 1981 supposed to do?
   case LFUN_CUT:
 + cur.pos() = 0; // Prevent stale position = size crash
   cutSelection(cur, true, true);
   cur.message(_(Cut));
   break;
 
 It is the cause of a rather silly behaviour: when you cut a selected string 
 from a math nestinset, not only the selection, but also everything preceeding 
 it will be cut.
 
 IMO (and I'm pretty sure) the correct fix is to use cur.normalize() instead, 
 which fixes the cursor position if it is outside the size() range. I have 
 tested that it fixes both bug 1981 and bug 1960, which seem to share the 
 cause.
 
 Can this go in?
 
 Jürgen

OK, this looks better.

- Martin


signature.asc
Description: This is a digitally signed message part


[PATCH] mathed cut crashes (1960, 1981)

2005-09-16 Thread Juergen Spitzmueller
Martin,
what is this fix for bug 1981 supposed to do?
case LFUN_CUT:
+   cur.pos() = 0; // Prevent stale position >= size crash
cutSelection(cur, true, true);
cur.message(_("Cut"));
break;

It is the cause of a rather silly behaviour: when you cut a selected string 
from a math nestinset, not only the selection, but also everything preceeding 
it will be cut.

IMO (and I'm pretty sure) the correct fix is to use cur.normalize() instead, 
which fixes the cursor position if it is outside the size() range. I have 
tested that it fixes both bug 1981 and bug 1960, which seem to share the 
cause.

Can this go in?

Jürgen
Index: math_nestinset.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v
retrieving revision 1.166
diff -u -r1.166 math_nestinset.C
--- math_nestinset.C	19 Aug 2005 12:57:47 -	1.166
+++ math_nestinset.C	16 Sep 2005 10:39:01 -
@@ -423,9 +423,10 @@
 	}
 
 	case LFUN_CUT:
-		cur.pos() = 0; // Prevent stale position >= size crash
 		cutSelection(cur, true, true);
 		cur.message(_("Cut"));
+		// Prevent stale position >= size crash
+		cur.normalize();
 		break;
 
 	case LFUN_COPY:


Re: [PATCH] mathed cut crashes (1960, 1981)

2005-09-16 Thread Martin Vermeer
On Fri, 2005-09-16 at 12:46 +0200, Juergen Spitzmueller wrote:
> Martin,
> what is this fix for bug 1981 supposed to do?
>   case LFUN_CUT:
> + cur.pos() = 0; // Prevent stale position >= size crash
>   cutSelection(cur, true, true);
>   cur.message(_("Cut"));
>   break;
> 
> It is the cause of a rather silly behaviour: when you cut a selected string 
> from a math nestinset, not only the selection, but also everything preceeding 
> it will be cut.
> 
> IMO (and I'm pretty sure) the correct fix is to use cur.normalize() instead, 
> which fixes the cursor position if it is outside the size() range. I have 
> tested that it fixes both bug 1981 and bug 1960, which seem to share the 
> cause.
> 
> Can this go in?
> 
> Jürgen

OK, this looks better.

- Martin


signature.asc
Description: This is a digitally signed message part