CTRL-U broken by OemToCharBuff?

Kazuhiro Fujieda fujieda@jaist.ac.jp
Mon Jul 10 14:27:00 GMT 2000


>>> On Sun, 9 Jul 2000 21:53:23 -0400
>>> Chris Faylor <cgf@cygnus.com> said:

> The new OemToCharBuff call translates a CTRL-U to 0xa7 for some reason.
> Kazuhiro, can you explain this? It causes me problems when I try
> to use CTRL-U to wipe out a line of text.

I can't observe this problem on my platforms (NT4 Sp6a and Win98).
I guess this is a bug of OemToCharBuff on Win2k.

I propose the following simple patch. There is no difference
between OEM and ANSI code pages among code points less than
0x80, so the following patch is enough to fix this problem.

ChangeLog:
2000-07-11  Kazuhiro Fujieda  <fujieda@jaist.ac.jp>

	* fhandler_console.cc (fhandler_console::read): Apply OemToCharBuff 
	only to code points larger than 0x7f in order to avoid a bug on Win2K.

Index: fhandler_console.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler_console.cc,v
retrieving revision 1.9
diff -u -p -r1.9 fhandler_console.cc
--- fhandler_console.cc	2000/07/04 02:26:20	1.9
+++ fhandler_console.cc	2000/07/10 20:50:26
@@ -190,7 +190,8 @@ fhandler_console::read (void *pv, size_t
 	}
       else if (!(input_rec.Event.KeyEvent.dwControlKeyState & LEFT_ALT_PRESSED))
 	{
-	  OemToCharBuff (&ich, &ich, 1);
+	  if ((unsigned char)ich > 0x7f)
+	    OemToCharBuff (&ich, &ich, 1);
 	  toadd = &ich;
 	}
       else

____
  | AIST      Kazuhiro Fujieda <fujieda@jaist.ac.jp>
  | HOKURIKU  School of Information Science
o_/ 1990      Japan Advanced Institute of Science and Technology


More information about the Cygwin-developers mailing list