Ticket #582 (new enhancement)

Opened 5 years ago

Last modified 4 years ago

Some minor UI nits

Reported by: rongarret Owned by:
Priority: normal Milestone:
Component: IDE Version: trunk
Keywords: Cc:

Description

Three little things, minor, but annoying:

  1. When evaluating a region with multiple forms, a bunch of prompts get printed out in the listener, one per form, but not the actual results. Only the result of the last form appears.
  1. The behavior of the ENTER key seems to be the same in the listener as in an editor window, which has the undesirable effect that if you are evaluating a form in the listener that requires scrolling the window so that the bottom-most prompt is no longer visible, nothing appears to happen. You have to manually scroll the listener back down to see the result of what you did. It would be better if the effect of ENTER in the listener were equivalent to hitting RETURN twice, i.e. copy the form down to the bottom-most prompt and scroll the window down so that the bottom-most prompt is visible before evaluating the form.
  1. The behavior of the RETURN key on a previous form in the listener has two features that I find annoying: first, if there is already something typed after the bottom-most prompt, then pressing RETURN on a previous form replaces that input. It would be nicer if it worked like FRED did, and added the form to the end of whatever was already there. Second, the cursor is unconditionally placed at the end of the selected form. It would be nice if the cursor remained in the same location that it was in relative to the form being selected when RETURN was pressed.

Let me know if you want me to break these out into separate tickets.

Change History

comment:1 Changed 5 years ago by gz

Regarding item 1 - the printing of multiple prompts is a bug. The non-printing of multiple results is not a bug. It is controlled by ccl::*verbose-eval-selection*, which is NIL by default. Setting it to T will make the intermediate results print.

comment:2 Changed 4 years ago by alexander

  • Priority changed from minor to normal

I moved the priority up to normal as this is really quite annoying when using the Cocoa based IDE

comment:3 Changed 4 years ago by rongarret

I made it minor because all of these can be easily fixed by the user:

  1. As gz pointed out, (setf ccl::*verbose-eval-selection* t)
(defcommand "Editor Execute Expression" (p)
  "Executes the current region in the editor Lisp."
  (declare (ignore p))
  (let* ((region (current-form-region))
         (form (region-to-string region))
         (buf (gui::hemlock-buffer (#/topListener gui::hemlock-listener-document))))
    (if buf
      (let ((HI::*CURRENT-BUFFER* buf))
        (move-mark (current-point) (region-end (buffer-region buf)))))
    (format (HEMLOCK-EXT:TOP-LISTENER-OUTPUT-STREAM) "~&~A~&" form)
    (eval-region region)))

3.

;;; Fix copy-region-to-input to work like FRED did
(defun mark-in-region-p (mark region)
  (and (mark<= (region-start region) mark) (mark<= mark (region-end region))))

(defun input-offset ()
  (if (hi::region-active-p)
    0
    (let* ((mark (current-point))
           (history (value input-regions))
           (region (find mark history :key 'car :test 'mark-in-region-p)))
      (and region (count-characters (region mark (region-end (car region))))))))

(defun copy-region-to-input (region)
  (when region
    (let* ((region-string (region-to-string region))
           (end-mark (region-end (buffer-region (current-buffer))))
           (offset (or (input-offset) 0)))
      (move-mark (current-point) end-mark)
      (insert-string (current-point) region-string)
      (buffer-end (current-point))
      (character-offset (current-point) (- offset)))))
Note: See TracTickets for help on using tickets.