On 02/02/13 10:41, Pavel Sanda wrote:
Jean-Marc Lasgouttes wrote:
Here is another patch from our own Martin Vermeer improving support for
aligning on decimal point in tables. Unfortunately, since I do not use this
at all, I am not able to see whether this is an improvement for all use
cases.

Please comment.

JMarc


-------- Message original --------
Sujet: Re: Small LyX patch
Date : Fri, 01 Feb 2013 13:31:52 +0200
De : Martin Vermeer <martin.verm...@aalto.fi>
Répondre ? : martin.verm...@aalto.fi
Pour : Jean-Marc Lasgouttes <jean-marc.lasgout...@inria.fr>

On 29/01/13 15:33, Martin Vermeer wrote:
On 2013-01-29 11:22, Jean-Marc Lasgouttes wrote:
Le 29/01/2013 06:50, Martin Vermeer a écrit :
Talking about wish lists, here's another one: it's really nice that the
decimal alignment trick for tabular described in the literature in
implemented. However, it still doesn't cover a use case that I have run
into: aligning decimal numbers (like 123,45) with numbers without a
decimal comma (like 6789). The limitation is caused by two roles of the
decimal symbol being mixed up: 1) as an alignment marker, i.e.,
where to
put the inter-column marker &; and 2) as the decimal symbol to be
inserted, i.e., what goes into the @{,} in the tabular format string.
These two roles should be separated (and my use case would be
covered by
using <comma> and <empty>, respectively, and writing 123,,45 and 6789,)
This is beyond my knowledge...

JMarc
Sure... but someone wrote this code ;-)
That someone is IIRC Edwin.

Martin, when you made the mistake to appear here on list, could you have a look
at http://www.lyx.org/trac/ticket/7865 ?

Pavel


Sure Pavel, see attached.

Explanation: for some reason autocorrect() also appears in Cursor.cpp, and the occurrences in Backspace and Delete silently turn auto-correction off. So do the occurrences in Cursor Up and Cursor Down, but I have not been able to have this code triggered from mathed... so I just removed them.

I added code to InsetMathNest to turn autocorrection off for cursor up or down (e.g., in an array), from the philosophy that having autocorrection on should be a conscious choice, not something you get stuck in. (Of course pressing the spacebar always gets you out). I don't know whether or not this new feature is a good idea... take it or leave it. But now I think with this patch both the code and its behaviour will be a little more transparent.

...and I didn't remember my login details for lyx-devel :-)

Cheers

Martin


diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index 4469875..23db7bc 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -1525,8 +1525,6 @@ void Cursor::insert(MathData const & ar)
 
 bool Cursor::backspace()
 {
-	autocorrect() = false;
-
 	if (selection()) {
 		cap::eraseSelection(*this);
 		return true;
@@ -1577,7 +1575,6 @@ bool Cursor::backspace()
 
 bool Cursor::erase()
 {
-	autocorrect() = false;
 	if (inMacroMode())
 		return true;
 
@@ -1632,7 +1629,6 @@ bool Cursor::up()
 	if (disp_.dispatched())
 		return true;
 	setCursor(save);
-	autocorrect() = false;
 	return false;
 }
 
@@ -1646,7 +1642,6 @@ bool Cursor::down()
 	if (disp_.dispatched())
 		return true;
 	setCursor(save);
-	autocorrect() = false;
 	return false;
 }
 
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 86920e1..0b24a1d 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -706,6 +706,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
 			act == LFUN_UP_SELECT;
 		cur.selHandle(select);
 
+		// handle autocorrect:
+		cur.autocorrect() = false;
+		cur.message(_("Autocorrect Off ('!' to enter)"));
+
 		// go up/down
 		bool up = act == LFUN_UP || act == LFUN_UP_SELECT;
 		bool successful = cur.upDownInMath(up);

Reply via email to