1
0
Fork 0

- [gemini] [bugfix] clear page when rendering starts after a gemini

page's download is completed.

  When a page  is fully downloaded before the rendering  is started an
  event  is  triggered  to  'compact'  all  the  rendering  events  (a
  rendering of  a single line  of the gemini  file) in a  single event
  that renders the rest of the page.

  If this 'bulk' rendering was started without a rendering of a single
  line occurred  the information  about clearing the  rendering window
  (before render the text) was not took into account.  This patch adds
  the check for this information.
This commit is contained in:
cage 2020-10-11 18:51:55 +02:00
parent df8d3221ec
commit 979fb9a068
1 changed files with 25 additions and 21 deletions

View File

@ -973,6 +973,19 @@
:reader skip-rendering-p :reader skip-rendering-p
:writer (setf skip-rendering)))) :writer (setf skip-rendering))))
(defun refresh-gemini-message-window (links source rendered-text append-text)
(let* ((win specials:*message-window*)
(window-metadata (message-window:metadata win)))
(if append-text
(progn
(message-window:append-source-text win rendered-text :prepare-for-rendering t)
(gemini-viewer:append-metadata-link window-metadata links)
(gemini-viewer:append-metadata-source window-metadata source))
(progn
(setf (message-window:source-text win) rendered-text)
(setf (gemini-viewer:gemini-metadata-source-file window-metadata) rendered-text)
(setf (gemini-viewer:gemini-metadata-links window-metadata) links)))))
(defmethod process-event ((object gemini-got-line-event)) (defmethod process-event ((object gemini-got-line-event))
(with-accessors ((response payload) (with-accessors ((response payload)
(append-text append-text) (append-text append-text)
@ -989,19 +1002,10 @@
(not (skip-rendering-p object))) (not (skip-rendering-p object)))
(let* ((win specials:*message-window*) (let* ((win specials:*message-window*)
(rendered-line (gemini-parser:sexp->text parsed-file (rendered-line (gemini-parser:sexp->text parsed-file
text-rendering-theme)) text-rendering-theme)))
(window-metadata (message-window:metadata win)))
(if append-text
(progn
(message-window:append-source-text win rendered-line :prepare-for-rendering t)
(gemini-viewer:append-metadata-link window-metadata links)
(gemini-viewer:append-metadata-source window-metadata source)
(setf (windows:keybindings win) (setf (windows:keybindings win)
keybindings:*gemini-message-keymap*)) keybindings:*gemini-message-keymap*)
(progn (refresh-gemini-message-window links source rendered-line append-text)
(setf (message-window:source-text win) rendered-line)
(setf (gemini-viewer:gemini-metadata-source-file window-metadata) rendered-line)
(setf (gemini-viewer:gemini-metadata-links window-metadata) links)))
(windows:draw win)))))) (windows:draw win))))))
(defclass gemini-compact-lines-event (program-event) (defclass gemini-compact-lines-event (program-event)
@ -1014,7 +1018,8 @@
(with-accessors ((download-uri download-uri)) object (with-accessors ((download-uri download-uri)) object
(let ((all-lines "") (let ((all-lines "")
(all-links ()) (all-links ())
(all-source "")) (all-source "")
(append-text t))
(map-events (lambda (a) (map-events (lambda (a)
(with-accessors ((response payload) (with-accessors ((response payload)
(wrapper-object wrapper-object)) a (wrapper-object wrapper-object)) a
@ -1030,6 +1035,8 @@
(not (skip-rendering-p a))) (not (skip-rendering-p a)))
(let ((rendered-text (gemini-parser:sexp->text parsed-file (let ((rendered-text (gemini-parser:sexp->text parsed-file
text-rendering-theme))) text-rendering-theme)))
(when (null (append-text a))
(setf append-text nil))
(appendf all-links links) (appendf all-links links)
(setf all-source (setf all-source
(text-utils:strcat all-source source)) (text-utils:strcat all-source source))
@ -1042,13 +1049,10 @@
(and (typep a 'gemini-got-line-event) (and (typep a 'gemini-got-line-event)
(string= download-uri (string= download-uri
(gemini-viewer:download-uri wrapper-object)))))) (gemini-viewer:download-uri wrapper-object))))))
(let* ((win specials:*message-window*) (let* ((win specials:*message-window*))
(window-metadata (message-window:metadata win)))
(message-window:append-source-text win all-lines :prepare-for-rendering t)
(gemini-viewer:append-metadata-link window-metadata all-links)
(gemini-viewer:append-metadata-source window-metadata all-source)
(setf (windows:keybindings win) (setf (windows:keybindings win)
keybindings:*gemini-message-keymap*) keybindings:*gemini-message-keymap*)
(refresh-gemini-message-window all-links all-source all-lines append-text)
(windows:draw win)))))) (windows:draw win))))))
(defclass gemini-abort-downloading-event (program-event) ()) (defclass gemini-abort-downloading-event (program-event) ())