Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #59747
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: The Forth console and cursor management |
| Date | 2017-05-23 12:48 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2017May23.144823@mips.complang.tuwien.ac.at> (permalink) |
| References | <og17st$lfa$1@dont-email.me> |
Alex <alex@rivadpm.com> writes:
>
><quote>
>6.1.0695 ACCEPT
>
>Because external system hardware and software may perform the ACCEPT
>function, when a line terminator is received the action of the cursor,
>and therefore the display, is implementation-defined. It is recommended
>that *the cursor remain immediately following the entered text* after a
>line terminator is received.
></quote>
>
>Which is very elegant, but unfortunately with a standard Windows console
>an absolute swine to implement. Using file reads through stdin, Windows
>treats the enter key as a CR LF, and moves the cursor appropriately.
Under Unix you have to switch the terminal to raw mode to get decent
behaviour. Googling for "Windows console raw mode" brought up this:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683462%28v=vs.85%29.aspx
This tells you to disable Line input mode, Processed input mode, Echo
input mode and Processed output mode to get the console into raw mode.
> A
>quick straw poll:
>
>Does your favourite Forth do this (the > and < are meta chars to
>indicate input and output, the underscore is the cursor caret)
>
> >1 2 3 .s
> <[3] 1 2 3 ok[3]
> <_
>
>
>or this?
>
> >1 2 3 .s [3] 1 2 3 ok[3]
> <_
1 2 3 .s <3> 1 2 3 ok
I don't think that the other output would be particularly revealing,
because the .S may contain a CR itself.
Better tests are:
key .
(and then press "a" without "enter"). On Gforth, SwiftForth, and VFX
this gives:
key . 97 ok
Once you have a properly working KEY (which requires raw mode), you
can build an ACCEPT on top of that.
The alternative indicated in the text above is if you cannot get a
raw-mode terminal. Then KEY and KEY? won't work properly, and ACCEPT
will just process the complete line provided by the cooked-mode
terminal.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2017: http://www.euroforth.org/ef17/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
The Forth console and cursor management Alex <alex@rivadpm.com> - 2017-05-23 12:57 +0100
Re: The Forth console and cursor management Raimond Dragomir <raimond.dragomir@gmail.com> - 2017-05-23 05:18 -0700
Re: The Forth console and cursor management anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-23 12:48 +0000
Re: The Forth console and cursor management Alex <alex@rivadpm.com> - 2017-05-23 15:45 +0100
Re: The Forth console and cursor management albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-23 20:48 +0200
Re: The Forth console and cursor management anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-24 10:16 +0000
Re: The Forth console and cursor management minforth@arcor.de - 2017-05-23 06:22 -0700
Re: The Forth console and cursor management Mark Wills <markwills1970@gmail.com> - 2017-05-23 06:27 -0700
Re: The Forth console and cursor management minforth@arcor.de - 2017-05-23 06:44 -0700
Re: The Forth console and cursor management rickman <gnuarm@gmail.com> - 2017-05-23 11:50 -0400
Re: The Forth console and cursor management Matthias Trute <matthias.trute@gmail.com> - 2017-05-23 09:20 -0700
Re: The Forth console and cursor management rickman <gnuarm@gmail.com> - 2017-05-23 17:46 -0400
Re: The Forth console and cursor management peter.m.falth@gmail.com - 2017-05-23 12:12 -0700
Re: The Forth console and cursor management Rob Sciuk <rob@controlq.com> - 2017-05-26 12:44 -0400
csiph-web