atlas-engineer / nyxt

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

lisp-repl javascript errors and design questions #2374

Open Ambrevar opened 2 years ago

Ambrevar commented 2 years ago

Since the lisp-repl "notebook" overhaul we've been having a bunch of javascript errors like:

<WARN> [18:07:17] Warning: JavaScript error: GError: Domain: "WebKitJavascriptError", Code: 699, Message: nyxt:nyxt/repl-mode:lisp-repl:1:60: TypeError: null is not an object (evaluating 'document.querySelector('.input-buffer[data-repl-id=\"0\"]').focus')

The message is clear: input-buffer[data-repl-id=\"0\"]' returns null because there is nothing there. So I tried to fix it, but I found it surprisingly hard.

I may be missing something, or the maybe the design should be better documented. But I'm also wondering if the design could not be greatly simplified.

Let's start with some questions:

Thoughts @aartaka ?

aartaka commented 2 years ago

The reason I made an empty data-repl-id for the last input is that its behavior is special—it does not evaluate anything, it's merely adding new cells. This duality is the reason for most clumsy parts in the lisp-repl. If you have an idea for how to get rid or this clumsiness, I'm all for it :)

Ambrevar commented 2 years ago

Can you highlight the clumsy parts you are thinking about? I haven't touched the repl code in a while... :p

aartaka commented 2 years ago

I mean exactly what you highlight—the speciality of the last cell, mainly.

Ambrevar commented 2 years ago

So what reverting the logic to make all cells the same?

That should cut it, no?

aartaka commented 2 years ago

Doesn't feel exactly right, but let us go with this design—it feels much simpler.

Ambrevar commented 2 years ago

Another suggestion?

aartaka commented 2 years ago

Nope :P

aadcg commented 6 months ago

Related to #2113.