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

Allow for Terminal Input to Be Echoed during Script Execution #2524

Open
thylordroot opened this issue May 26, 2019 · 0 comments
Open

Allow for Terminal Input to Be Echoed during Script Execution #2524

thylordroot opened this issue May 26, 2019 · 0 comments

Comments

@thylordroot
Copy link

This request calls for an enhancement to create an option for regurgitating what is typed into the terminal back into it. This method would make it simple to interactively acquire text input directly from the console. kOS already does this when it is consuming commands in interactive mode; however, such functionality cannot be seen in code such as the following naive implementation (I apologize for this being munged):

declare function term_getline { local char is Terminal:INPUT:GETCHAR(). local str is "". until char = Terminal:INPUT:ENTER { set str to str + char. } return str. }

Currently, there are three workarounds to this issue:

  • A GUI can be constructed to capture the input. This requires loss of focus from the terminal window.
  • You can print the character that has just been captured, but this implies a newline and will break up the text over several lines without processing things such as backspace (see issue 2522 for a recommendation around this; also, see below)
  • You can manage the text buffer yourself by using an AT clause with print. This appears to mean taking direct ownership of the text buffer as there is no way to ask the screen where the cursor is currently located, see this for a pull request which may solve the issue).

An argument can be made that a feature request like this is superfluous in light of these workarounds. It would still be useful to the programmer, however, because it alleviates the responsibility of managing the cursor from the client. Additionally, it appears that at one point (or perhaps still) that kOS required that telnet clients do not echo text on behalf of the user, as seen in sec. 4.5.8, pg 60 of this manual from 2016. I don't know if this is still current, but it appears that kOS intended to have full control over this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant