medley icon indicating copy to clipboard operation
medley copied to clipboard

EOL behavior on copy-paste of multiple lines and and comments

Open masinter opened this issue 1 year ago • 1 comments

Two problems: copy multiple lines from outside medley and paste into exec window... and also after ; comment in exec window.

However, I noticed an unexpected and potentially confusing behavior when evaluating expressions that end with a comment preceeded by a semicolon.

I tested the code on Medley Online by pasting into a XCL Exec the expressions previously copied into the noVNC clipboard. I initially copied the first dozen lines of code, each of which is a Lisp expression followed by a comment like this:

123       ; the integer one hundred twenty-three

If you paste such a line at the Exec, or type it and press ENTER, the caret moves down one line and the expression isn't evaluated. At this point the Exec looks like this:

cl-comment

Pressing ENTER more times just moves the caret down as many lines. To make the prompt reappear I have to press an interruption keychord such as Ctrl+E. The issue occurs also when directly typing the line at the Exec, not just via copy-paste.

Originally posted by @pamoroso in https://github.com/Interlisp/medley/issues/609#issuecomment-1987224388

masinter avatar Mar 10 '24 15:03 masinter

THe input behavior may be confusing, but it isn't exactly wrong

The "prompt" is not printed except when starting a new event. So if you have open parens you need to close them or (in Interlisp readtable) type "]" .

If you type in

(defun foo (x)
   (+ x x))

it won't prompt again after the first line.

The problem if you type in a full definition

(defun foo (x)
    ;; double the argument
   (+ x x))

it will throw away the comment. If you enter the code in SEdit, image you'll get the comment saved but "stripped" by the definer

image

masinter avatar Mar 10 '24 15:03 masinter