From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: [9fans] fgetrune() ? In-Reply-To: Your message of "Fri, 07 Nov 2003 17:59:43 +0100." <20031107165943.GA1096@shire> From: "Russ Cox" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <67699.1068220846.1@t40.swtch.com> Message-Id: Date: Fri, 7 Nov 2003 11:00:46 -0500 Topicbox-Message-UUID: 81a53cd6-eacc-11e9-9e20-41e7f4b1d025 > I was looking for some function like fgetc(2), but i want it to work on > runes. Reading "man fgetc" i saw: > > BUGS > Stdio does not handle UTF or runes; use Bio instead. > > In bio(2) i found "Bgetrune(2)", but it does not do what i want, since > "Bgetrune(2)" does not give you the rune *as* it is typed or pasted from > mouse. > > So, what i am thinking wrong? Rio (the window system) doesn't send any of the typed characters until your press enter. This means that, for example, you can edit the line using the mouse if you make an early mistake that takes a while to notice. If you really want to get characters as they are typed, you need to put the console in raw mode, by writing "rawon" to /dev/consctl and then keeping the file descriptor for /dev/consctl open. I believe that then Bgetrune will give you runes as they come in. However, you will be in charge of echoing them to standard output. Russ