Fix how ein:cell-max-num-outputs is treated

Previous version added newline after "." every time when the new
output is sent from the server.
This commit is contained in:
Takafumi Arakaki 2012-07-28 01:52:31 +02:00
parent 1a6f4cfa58
commit d65394ff75

View file

@ -461,9 +461,7 @@ Called from ewoc pretty printer via `ein:cell-pp'."
(= (1+ index) ein:cell-max-num-outputs))
;; The first output which exceeds `ein:cell-max-num-outputs'.
(ein:insert-read-only "\n"))
(ein:insert-read-only ".")
(when (= (1+ index) (ein:cell-num-outputs cell))
(ein:insert-read-only "\n")))
(ein:insert-read-only "."))
(let ((out (nth index (oref cell :outputs))))
;; Handle newline for previous stream output.
;; In IPython JS, it is handled in `append_stream' because JS
@ -494,9 +492,14 @@ Called from ewoc pretty printer via `ein:cell-pp'."
(ein:insert-read-only "\n"))
(defmethod ein:cell-insert-footer ((cell ein:codecell))
(let ((last-out (car (last (oref cell :outputs)))))
(when (equal (plist-get last-out :output_type) "stream")
(ein:cell-append-stream-text-fontified "\n" last-out)))
(if (or (oref cell :collapsed)
(and ein:cell-max-num-outputs
(> (ein:cell-num-outputs cell) ein:cell-max-num-outputs)))
;; Add a newline after the last ".".
(ein:insert-read-only "\n")
(let ((last-out (car (last (oref cell :outputs)))))
(when (equal (plist-get last-out :output_type) "stream")
(ein:cell-append-stream-text-fontified "\n" last-out))))
(call-next-method))