Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #59751
| From | Alex <alex@rivadpm.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: The Forth console and cursor management |
| Date | 2017-05-23 15:45 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <og1ho5$qbd$1@dont-email.me> (permalink) |
| References | <og17st$lfa$1@dont-email.me> <2017May23.144823@mips.complang.tuwien.ac.at> |
On 5/23/2017 13:48, Anton Ertl wrote: > 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. Yup. Been there, done that, got the scars. (To correct myself, it's actually the echo mode to stdout that causes the cursor movement when "enter" is processed). It really is a mahoosive pain handling raw mode. You loose command line editing & history and have to provide it yourself, and then there's the irritant of UTF-8 support & glyph widths, along with scrolling regions and other nonsense. I've looked at pdcurses (doesn't work as advertised on windows 10, problems with refresh()), ConEmu (use VT100 sequences, not quite sure how to use it properly) and even Windows 10 native VT100 (same issues as ConEmu and just like raw mode with the added pain of ESC sequences). > >> 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. > Good point. -- Alex
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