On Tue, Dec 11, 2001 at 04:27:17PM +0100, Jean-Marc Lasgouttes wrote: > X-Authentication-Warning: lapinot.inria.fr: lasgoutt set sender to >[EMAIL PROTECTED] using -f > To: Martin Vermeer <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > Subject: Re: Patches waiting > From: Jean-Marc Lasgouttes <[EMAIL PROTECTED]> > Date: 11 Dec 2001 16:27:17 +0100 > In-Reply-To: <[EMAIL PROTECTED]> > User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 > > >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> But what then? As LGB pointed out, in some locales you expect > Martin> the accents like ^ " ' ` ~ etc to just work naturally as dead > Martin> keys, the way they are on your local keyboard. > > There are several ways to define X dead keys: > > - at xkb level > - at lyx devel (\kmod) > > If a user has setup its ^ key to be an accent key, then it should be > an accent key for LyX (also in math). Then one would have to do > ^+space to have a superscript. > > Otherwise, the ^ key is just a ^ key and it will never do accents (but > it will do superscripts). > > Martin> I repeat, what do you suggest? > > I think predictability and consistency with other platforms/program is > the most important. > > JMarc
Okay, I did it the way you suggest. Now we have asciicircum -> superscript dead-circumscript -> "hat" accent (if LyX handles dead keys, X does it already). Result: 1. If X is left to handle the dead keys, everything works fine. Superscript is obtained by typing "^ space", which apparently produces internally an asciicircum. Subscript "_" works. All accents ' ` ^ etc. come out naturally. 2. If LyX handles deadkeys, all accents work fine again, as does subscript. However, there seems to be no way to produce a superscript. "^ space" in math produces an empty box with a hat, and the cursor just to the right of it. This is as close as I can get it and working at least as well, and similarly, as pre-patch. Attached. Martin
Index: src/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/ChangeLog,v
retrieving revision 1.453
diff -u -p -r1.453 ChangeLog
--- src/ChangeLog 2001/12/11 11:40:09 1.453
+++ src/ChangeLog 2001/12/11 16:52:03
@@ -1,3 +1,14 @@
+2001-12-10 Martin Vermeer <[EMAIL PROTECTED]>
+
+ * commandtags.h:
+ * LyXAction.C:
+ * lyx_main.C:
+ * lyxfunc.C:
+ * mathed/formulabase.C:
+ * mathed/math_cursor.h
+ * mathed/math_cursor.C: make sub/superscript
+ into functions LFUN_SUB/SUPERSCRIPT.
+
2001-12-11 Dekel Tsur <[EMAIL PROTECTED]>
* lyxfont.C (GUIFamilyNames): Fix GUIFamilyNames array
Index: src/LyXAction.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/LyXAction.C,v
retrieving revision 1.104
diff -u -p -r1.104 LyXAction.C
--- src/LyXAction.C 2001/12/05 23:09:26 1.104
+++ src/LyXAction.C 2001/12/11 16:52:03
@@ -281,6 +281,8 @@ void LyXAction::init()
{ LFUN_GREEK_TOGGLE, "math-greek-toggle", "", Noop },
{ LFUN_INSERT_MATH, "math-insert",
N_("Insert math symbol"), Noop },
+ { LFUN_SUBSCRIPT, "math-subscript", "", Noop },
+ { LFUN_SUPERSCRIPT, "math-superscript", "", Noop },
{ LFUN_MATH_LIMITS, "math-limits", "", Noop },
{ LFUN_MATH_MACRO, "math-macro", "", Noop },
{ LFUN_MATH_MUTATE, "math-mutate", "", Noop },
Index: src/commandtags.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/commandtags.h,v
retrieving revision 1.80
diff -u -p -r1.80 commandtags.h
--- src/commandtags.h 2001/12/05 23:09:26 1.80
+++ src/commandtags.h 2001/12/11 16:52:03
@@ -94,6 +94,8 @@ enum kb_action {
LFUN_BREAKPARAGRAPHKEEPLAYOUT,
LFUN_QUOTE,
LFUN_CIRCUMFLEX,
+ LFUN_SUBSCRIPT,
+ LFUN_SUPERSCRIPT,
LFUN_GRAVE,
LFUN_ACUTE,
LFUN_TILDE,
Index: src/lyx_main.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyx_main.C,v
retrieving revision 1.97
diff -u -p -r1.97 lyx_main.C
--- src/lyx_main.C 2001/11/26 10:19:49 1.97
+++ src/lyx_main.C 2001/12/11 16:52:04
@@ -523,6 +523,10 @@ void LyX::defaultKeyBindings(kb_keymap
kbmap->bind("Delete", LFUN_DELETE);
kbmap->bind("BackSpace", LFUN_BACKSPACE);
+
+ // sub- and superscript -MV
+ kbmap->bind("~S-underscore", LFUN_SUBSCRIPT);
+ kbmap->bind("~S-asciicircum", LFUN_SUPERSCRIPT);
// kbmap->bindings to enable the use of the numeric keypad
// e.g. Num Lock set
Index: src/lyxfunc.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.271
diff -u -p -r1.271 lyxfunc.C
--- src/lyxfunc.C 2001/12/10 20:06:57 1.271
+++ src/lyxfunc.C 2001/12/11 16:52:05
@@ -573,6 +573,8 @@ 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;
@@ -1438,6 +1440,8 @@ 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!"));
}
Index: src/mathed/formulabase.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/mathed/formulabase.C,v
retrieving revision 1.109
diff -u -p -r1.109 formulabase.C
--- src/mathed/formulabase.C 2001/12/05 18:55:44 1.109
+++ src/mathed/formulabase.C 2001/12/11 16:52:07
@@ -556,7 +556,16 @@ InsetFormulaBase::localDispatch(BufferVi
updateLocal(bv, true);
break;
}
-
+
+ case LFUN_SUPERSCRIPT:
+ case LFUN_SUBSCRIPT:
+ {
+ bv->lockedInsetStoreUndo(Undo::EDIT);
+ mathcursor->script((action == LFUN_SUPERSCRIPT));
+ updateLocal(bv, true);
+ break;
+ }
+
case LFUN_MATH_DELIM:
{
lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n";
Index: src/mathed/math_cursor.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/mathed/math_cursor.C,v
retrieving revision 1.203
diff -u -p -r1.203 math_cursor.C
--- src/mathed/math_cursor.C 2001/12/11 11:33:42 1.203
+++ src/mathed/math_cursor.C 2001/12/11 16:52:08
@@ -1276,36 +1276,40 @@ bool MathCursor::interpret(string const
return true;
}
+bool MathCursor::script(bool up)
+{
+ macroModeClose();
+ lyxerr << "script 2: '" << up << "'\n";
+ selCut();
+ if (hasPrevAtom() && prevAtom()->asScriptInset()) {
+ prevAtom()->asScriptInset()->ensure(up);
+ pushRight(prevAtom());
+ idx() = up;
+ pos() = size();
+ } else if (hasNextAtom() && nextAtom()->asScriptInset()) {
+ nextAtom()->asScriptInset()->ensure(up);
+ pushLeft(nextAtom());
+ idx() = up;
+ pos() = 0;
+ } else {
+ plainInsert(MathAtom(new MathScriptInset(up)));
+ prevAtom()->asScriptInset()->ensure(up);
+ pushRight(prevAtom());
+ idx() = up;
+ pos() = 0;
+ }
+ selPaste();
+ dump("1");
+ return true;
+}
+
bool MathCursor::interpret(char c)
{
- //lyxerr << "interpret 2: '" << c << "'\n";
- if (c == '^' || c == '_') {
- macroModeClose();
- const bool up = (c == '^');
- selCut();
- if (hasPrevAtom() && prevAtom()->asScriptInset()) {
- prevAtom()->asScriptInset()->ensure(up);
- pushRight(prevAtom());
- idx() = up;
- pos() = size();
- } else if (hasNextAtom() && nextAtom()->asScriptInset()) {
- nextAtom()->asScriptInset()->ensure(up);
- pushLeft(nextAtom());
- idx() = up;
- pos() = 0;
- } else {
- plainInsert(MathAtom(new MathScriptInset(up)));
- prevAtom()->asScriptInset()->ensure(up);
- pushRight(prevAtom());
- idx() = up;
- pos() = 0;
- }
- selPaste();
- dump("1");
- return true;
- }
+ lyxerr << "interpret 2: '" << c << "'\n";
+
+ // Removed super/subscript handling from here to ::script -MV
// handle macroMode
if (inMacroMode()) {
Index: src/mathed/math_cursor.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/mathed/math_cursor.h,v
retrieving revision 1.87
diff -u -p -r1.87 math_cursor.h
--- src/mathed/math_cursor.h 2001/12/10 10:09:00 1.87
+++ src/mathed/math_cursor.h 2001/12/11 16:52:08
@@ -115,6 +115,8 @@ public:
/// size of current cell
size_type size() const;
///
+ bool script(bool);
+ ///
bool interpret(string const &);
///
bool interpret(char);
msg30312/pgp00000.pgp
Description: PGP signature
