9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] fgetrune() ?
Date: Fri,  7 Nov 2003 11:00:46 -0500	[thread overview]
Message-ID: <E1AI92U-000Hbx-D8@t40.swtch.com> (raw)
In-Reply-To: Your message of "Fri, 07 Nov 2003 17:59:43 +0100." <20031107165943.GA1096@shire>

> 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


  reply	other threads:[~2003-11-07 16:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-07 16:59 Alberto Cortés
2003-11-07 16:00 ` Russ Cox [this message]
2003-11-07 17:33   ` Alberto Cortés

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1AI92U-000Hbx-D8@t40.swtch.com \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).