-----BEGIN PGP SIGNED MESSAGE-----

On Donnerstag, 12. Dezember 2002 16:57, John Levon wrote:
> On Thu, Dec 12, 2002 at 04:24:45PM +0100, Kornel Benko wrote:
> > Yes, but I had to modify it. An d that is not part of this patch.
> >
> > 1.) void QLyXKeySym::set(QKeyEvent * ev) rewritten
>
> This is to add something not supported yet, i.e. non-latin1

No this is not correct. Only 1 line of this patch is non-latin-1 relevant.
(unicode of non-latin1 char == 0 (in my QT3.0.5-Version))

> > 2.) string QLyXKeySym::getSymbolName() const
>
> what does this bit do again ?

avoids crash on lyxerr output stream

> can you send me a patch that fixes *bugs* only, without the latin2 stuff

        Kornel

- -- 
Kornel Benko
[EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQCVAwUBPfi+wbewfbDGmeqhAQEvIAP+JTzStfEIuTkfZbZDkHrz+epc4joaLE7f
DU2lqwEAFsHKnS7VFrOGZyckREmvnN6x1fCytf5brz+81gcl/uW/31i7nWmfCe4h
n7nDKhIo3YBQPmOK+wueFwEwrTSbWVB9qtnFHuYZE/bF3hmciyjS6foIj9qIY3hP
MZR/jXGl4Uk=
=K6Gq
-----END PGP SIGNATURE-----
Index: QLyXKeySym.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/QLyXKeySym.C,v
retrieving revision 1.12
diff -u -r1.12 QLyXKeySym.C
--- QLyXKeySym.C	2002/12/12 13:46:06	1.12
+++ QLyXKeySym.C	2002/12/12 16:44:01
@@ -32,9 +32,38 @@
 
 void QLyXKeySym::set(QKeyEvent * ev)
 {
-	key_ = ev->key();
-	text_ = ev->text();
+    key_ = ev->key();
+    {
+	QString s = ev->text();
+	lyxerr[Debug::KEY] << " unicode of key is";
+	if ( !s.isNull()) {
+	    for (int i = 0; i < s.length(); ++i) {
+		QChar const a = s.ref(i);
+		lyxerr[Debug::KEY] << " " << a.unicode();
+	    }
+	    if (!s.isEmpty()) {
+		lyxerr[Debug::KEY] << " ascii == " << ev->ascii();
+	    }
+	    if ((s.length() == 1) && ( key_ == Qt::Key_unknown)) {
+		if ((int) s.ref(0) == 0) {
+		    // This is the case for !latin-1 stuff
+		    // it is the only line which is !latin1() relevant
+		    s = ev->ascii();
+		}
+		key_ = 0;
+	    }
+	}
+	text_ = s;
+	lyxerr[Debug::KEY] << endl;
+    }
+    if ( !text_.isNull()) {
 	lyxerr[Debug::KEY] << "Setting key to " << key_ << ", " <<  text_.latin1() << endl;
+    }
+    else {
+	// sometimes is ((test_.length() > 0) && test_.isNull())
+	// in that case text_.latin1() destroyed the lyxerr output stream 
+	lyxerr[Debug::KEY] << "Setting key to " << key_ << ", <none>" << endl;
+    }
 }
 
 
@@ -68,8 +97,14 @@
 
 	if (sym.empty()) {
 		lyxerr[Debug::KEY] << "sym empty in getSymbolName()" << endl;
-		if (!text_.isEmpty())
-			sym = text_.latin1();
+		if (!text_.isEmpty()) {
+		    sym = text_.latin1();
+		}
+		else {
+		    // in case of text_.isNull()
+		    // I observed crash (Segmentation violation)
+		    sym = "none";
+		}
 	}
 	lyxerr[Debug::KEY] << "getSymbolName() -> " << sym << endl;
 	return sym;

Reply via email to