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

Fix read1 and readln in the ui.listener #2778

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Capital-EX
Copy link
Contributor

These changes should fix read1 and readln in the UI Listener. I've added specialized interactor-read*-finish and interactor-read* words to handle the actual behavior or read1 and readln. This should leave any word that depends on existing implementation of interactor-read unchanged.

Marking this as draft as I have to make changes to read as well. Currently, n read n read ... exhibits the same bug. Should be able to apply the same fix, but I need to take a break for today. Feel free to offer feedback.

@Capital-EX
Copy link
Contributor Author

I've now fixed read to allow multiple line inputs. Gonna work on read-until later.

@Capital-EX
Copy link
Contributor Author

Capital-EX commented Apr 3, 2023

Progress:

  • readln
  • read1
  • read
  • read-until
  • read-quot

@Capital-EX Capital-EX marked this pull request as ready for review April 6, 2023 04:11
@Capital-EX
Copy link
Contributor Author

Capital-EX commented Apr 6, 2023

Well, that required a lot more re-writing than I expected. But, I think it should all be done. The only part I'm not confident about is the change to read-quot.

It's behavior in the CLI Listener is to read each line as one quote. However, it's behavior in the UI Listener is to read all lines then evaluate them. So, I had to implement a means to check which mode read-quot should be in.

Another reason I'm not fully happy with these changes is...

: set-from-listener? ( -- ? )
    get-callstack callstack>array second \ listener-step = ; inline

...reading the call stack feels about as leaky as abstractions can get.

@olus2000
Copy link
Contributor

olus2000 commented Aug 20, 2023

This PR seems to completely break read-contents on the interactor, which in all fairness makes it somewhat consistent with the cli listener. It doesn't react to the enter key alone (newlines can still be inserted with shift+enter), and there doesn't seem to be a way to end the input.

As for readln and read1: the previous input is removed from display after more input is requested.

@mrjbq7
Copy link
Member

mrjbq7 commented Aug 21, 2023 via email

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

Successfully merging this pull request may close these issues.

None yet

3 participants