Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INPUT/HIDE is not working #476

Closed
Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Closed

INPUT/HIDE is not working #476

Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Labels
Oldes.resolved Bugs/wishes with Oldes' fixes/features Type.bug

Comments

@Siskin-Bot
Copy link
Collaborator

Siskin-Bot commented Feb 15, 2020

Submitted by: Jerry

I can still see what I am typing.


Imported from: CureCode [ Version: alpha 31 Type: Bug Platform: All Category: Unspecified Reproduce: Always Fixed-in:none ]
Imported from: metaeducation#476

Comments:

Rebolbot commented on Jan 20, 2009:

Submitted by: BrianH

This might not get fixed in the Windows console - we might have to wait for the GUI console. However, chat could use this for passwords, so if it's doable we should.


Rebolbot commented on Aug 25, 2009:

Submitted by: manum

/hide disappear from input implementation, but it is used at ask source
>> source ask
ask: make function! [[
    "Ask the user for input."
    question [series!] "Prompt to user"
    /hide "mask input with *"
][
    prin question
    trim either hide [input/hide] [input]
]]

Hostilefork mentioned this issue on Nov 25, 2018:
INPUT has no refinement HIDE, hence ASK/HIDE will not work
Ask/hide ** Script error: input has no refinement called hide


Rebolbot added the Type.bug on Jan 12, 2016


Hostilefork commented on Nov 25, 2018:

When Rebol connects to a source of input like stdin, there is no (standard) way in C to suppress the input being echoed to the screen. So the /HIDE feature is simply not possible then.

The Windows console implementation of R3-Alpha uses a kind of "black box" which does line-based Unicode input, and handles things like cursoring around and deleting. Without using a lower level set of console APIs and taking responsibility for everything, it's extremely limited in what it can do. The line input doesn't let you even do things like intercept the escape key and respond to it--much less overwrite the visibility of characters. It can't intercept clipboard pastes and do any processing on the input either, which means if the clipboard lacks carriage returns and only newlines, the data gets smooshed:

https://stackoverflow.com/questions/52912349/intercept-clipboard-paste-event-in-console-application

When using the <termios.h> facilities in POSIX, there's more flexibility which could implement this feature. Unlike in the Windows build which just makes one function call to get a line, the termios build actually implements all of the logic for responding to key events and editing the line--in C. This is one of the things someone could figure out how to do, if there was a way established to pass the "/HIDE" flag to it. But again, you'd have to build with a "smart" console that did termios vs. stdin.

A Rebol GUI which interacts with the message pump and can draw anything it wants or get any keystroke it wants clearly has full control, and would have few barriers to implementing this.

What would be more ideal would be if the console:// device were made abstracted across POSIX and Windows console and the GUI to offer up individual key events. Then the line editing code in C from the termios build could become Rebol code and work across both platforms (or any platform that implemented console key eventing and I/O, including some kind of dialect for color changes and cursor movement...telling the program the width and height of the screen, etc.)


Oldes commented on Dec 1, 2018:

input/hide can be implemented using SetConsoleMode on Windows and tcsetattr on Posix.
http://forums.codeguru.com/showthread.php?466009-Reading-from-stdin-(without-echo)&p=1786376#post1786376

@hostilefork some kind of dialect <= there is such a dialect used for ages - ANSI escape sequences.. but I know that you don't like them.


Oldes added a commit to Oldes/Rebol3 that referenced this issue on Dec 1, 2018:
FEAT: implemented ASK/HIDE (which prevents echoing user input)


Oldes commented on Dec 1, 2018:

Problem with my above commit is, that not all POSIX terminals seems to support these 2 ASNI sequences. And of course, that it does not display asterix chars, but that can be considered as more secure, because it does not reveal information, how many chars has the secret something.


Oldes added a commit to Oldes/Rebol3 that referenced this issue on Jan 25, 2019:
FEAT: Windows: Console Virtual Terminal Sequences


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Oldes.resolved Bugs/wishes with Oldes' fixes/features Type.bug
Projects
None yet
Development

No branches or pull requests

2 participants