atlas-engineer / nyxt

Nyxt - the hacker's browser.
https://nyxt-browser.com/
9.88k stars 413 forks source link

Pressing `return` in lisp-repl does nothing #2323

Closed Ambrevar closed 2 years ago

Ambrevar commented 2 years ago

@aartaka Looks like lisp-repl is broken on master :p

aartaka commented 2 years ago

Wait, why do you press return there? Press C-return :D

aadcg commented 2 years ago

Right @aartaka.

Suggestions about the REPL:

Personally, I like (multi-line) prompts to behave the way things do in a text file. C-j sends input and RET inserts a newline (and may indent).

Ambrevar commented 2 years ago

Yup, having ret do nothing is very confusing :p

Other bug: on inserting ( I get this error:

<WARN> [18:39:21] Warning: JavaScript error: GError: Domain: "WebKitJavascriptError", Code: 699, Message: nyxt:nyxt/repl-mode:lisp-repl:1:40: TypeError: null is not an object (evaluating 'document.querySelector('#input-buffer').selectionStart')
Ambrevar commented 2 years ago

Something else (sorry for the report spam): clicking on the arrows is a bit hard, one has to hit the character very precisely. If you hit the box but not the character, it won't do anything.

aadcg commented 2 years ago

@Ambrevar, the hints help a bit :p

aartaka commented 2 years ago

Oh wait, now I get it! Indeed, the input in lisp-repl is not a multi-line one. Maybe we should use textareas then...

Ambrevar commented 2 years ago

Definitely! :)

Ambrevar commented 2 years ago

Something else: shouldn't we make past inputs immutable? Allow duplicating them into current input?

Otherwise, the user can edit the input content but not press C-return, which means the input wouldn't match the result.

Ambrevar commented 2 years ago

See #2342 for a bunch of fixes which should address the aforementioned concerns.

aadcg commented 2 years ago

shouldn't we make past inputs immutable?

In #2223 I made a reference to it. Quote:

A richer interface (think Emacs' comint) gives the user's caret complete freedom across all inputs and outputs. A (hard) question immediately arises: should older inputs and outputs be read-only (Emacs today says no, for instance)?

I think older inputs shouldn't be immutable, but you must be able to re-run that input and replace the corresponding output.

Ambrevar commented 2 years ago

That we can do already, it's just that it's unclear when the input has been modified or not, or what the original input was.

aadcg commented 2 years ago

In my opinion, it's ok. If you were to reproduce a REPL session, you'd re-run the inputs.

Ambrevar commented 2 years ago

Not necessarily about sessions, but what about simply "at a glance"? Seeing inconsistent input / output pairs is unfortunate.

aadcg commented 2 years ago

I think the only thing we should do would be to trigger a visual sign of that inconsistency (change output background, foreground color, etc).