[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-devel
Subject:    Re: Question lyxfunc.C
From:       Martin Vermeer <martin.vermeer () hut ! fi>
Date:       2001-12-30 16:01:42
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


On Sun, Dec 30, 2001 at 12:14:51PM +0200, Martin Vermeer wrote:
...
 
> Just wondering if the string 
> 
> 	"This is only allowed in math mode!"
> 
> in lyxfunc.C ever gets printed. And if so, how.
> (And if not, why not.)
> 
> Martin

OK, I'm getting the picture now. (But my question stands: is this
ever reached?)
 
Attached a patch that allows ^ _ to be used *both* for super/sub script
(in mathed) *and* for inserting themselves (in text). Back to square one
you say? Perhaps. But now the output of these characters is hardcoded 
in lyxfunc.C, outside mathed. Still, it is hardcoded, though in a
perhaps more suitable location. 

Martin
-- 
Martin Vermeer  martin.vermeer@hut.fi
Helsinki University of Technology 
Department of Surveying
P.O. Box 1200, FIN-02015 HUT, Finland
:wq

["diff" (text/plain)]

Index: lyxfunc.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.275
diff -u -p -r1.275 lyxfunc.C
--- lyxfunc.C	2001/12/21 13:55:24	1.275
+++ lyxfunc.C	2001/12/30 15:40:03
@@ -559,8 +559,6 @@ func_status::value_type LyXFunc::getStat
 	case LFUN_MATH_LIMITS: 
 	case LFUN_MATH_NONUMBER: 
 	case LFUN_MATH_NUMBER:
-	case LFUN_SUBSCRIPT:
-	case LFUN_SUPERSCRIPT:
 		disable = !mathcursor;
 		break;
 
@@ -1436,12 +1434,18 @@ string const LyXFunc::dispatch(int ac,
 	case LFUN_MATH_NUMBER:
 	case LFUN_MATH_NONUMBER:
 	case LFUN_MATH_LIMITS:
-	case LFUN_SUBSCRIPT:
-	case LFUN_SUPERSCRIPT:
 	{
 		setErrorMessage(N_("This is only allowed in math mode!"));
 	}
 	break;
+
+	// passthrough hat and underscore outside mathed:
+	case LFUN_SUBSCRIPT:
+		dispatch(LFUN_SELFINSERT, "_");
+		break;
+	case LFUN_SUPERSCRIPT:
+		dispatch(LFUN_SELFINSERT, "^");
+		break;
 
 	case LFUN_MATH_PANEL:
 		owner->getDialogs()->showMathPanel();

[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic