mirror of https://codeberg.org/cage/tinmop/
Compare commits
2 Commits
4dfa362c0f
...
e070f89b05
Author | SHA1 | Date |
---|---|---|
cage | e070f89b05 | |
cage | 93dd9b1c11 |
|
@ -2045,7 +2045,17 @@ local file paths."
|
|||
|
||||
(defun scale-gemtext (main-window offset)
|
||||
(ev:with-enqueued-process-and-unblock ()
|
||||
(let ((saved-active-stream (find-streaming-stream-url)))
|
||||
(let* ((saved-active-stream (find-streaming-stream-url))
|
||||
(gemtext-widget (gemtext-widget main-window))
|
||||
(saved-visible-portion (gui:y-visible-portion gemtext-widget))
|
||||
(saved-start-visible-portion (getf saved-visible-portion :start))
|
||||
(gemtext-y (gui:root-y gemtext-widget))
|
||||
(saved-pixel-y (truncate (- (* saved-start-visible-portion
|
||||
(gui:window-height gemtext-widget))
|
||||
gemtext-y)))
|
||||
(saved-pixel-indices `(:x 0 :y ,saved-pixel-y))
|
||||
(saved-line-index (gui:index->line-char-coordinates gemtext-widget
|
||||
saved-pixel-indices)))
|
||||
(interrupt-rendering main-window)
|
||||
(maybe-stop-streaming-stream-thread)
|
||||
(when saved-active-stream
|
||||
|
@ -2061,7 +2071,8 @@ local file paths."
|
|||
1.0))
|
||||
(render-ir-lines (get-address-bar-text main-window) main-window)
|
||||
(when contains-inlined-images
|
||||
(inline-all-images main-window))))))
|
||||
(inline-all-images main-window))
|
||||
(gui:scroll-to gemtext-widget `(:line ,saved-line-index :char 0))))))
|
||||
|
||||
(defun initialize-keybindings (main-window target)
|
||||
(gui:bind target
|
||||
|
|
|
@ -405,7 +405,8 @@
|
|||
(null (iri:host iri)))))
|
||||
|
||||
(defun absolute-url-p (url)
|
||||
(not (relative-url-p url)))
|
||||
(and (not (relative-url-p url))
|
||||
(iri:iri-parse url :null-on-error t)))
|
||||
|
||||
(defun absolute-url-scheme-p (url expected-scheme)
|
||||
(when-let ((parsed-iri (iri:iri-parse url :null-on-error t)))
|
||||
|
|
|
@ -749,15 +749,15 @@ printed in the box column by column; in the example above the results are:
|
|||
constants:+internal-scheme-local-posts+)))
|
||||
"Collect all hyperlinks in a text marked from a list of valid `schemes'"
|
||||
(flet ((build-re-scheme ()
|
||||
(let ((res ""))
|
||||
(let ((res "^"))
|
||||
(loop for (scheme . rest) on schemes do
|
||||
(if rest
|
||||
(setf res (strcat res "(" scheme ")|"))
|
||||
(setf res (strcat res "(" scheme ")://"))))
|
||||
(if rest
|
||||
(setf res (strcat res "(" scheme ")|"))
|
||||
(setf res (strcat res "(" scheme ")://"))))
|
||||
(strcat "(" res ")"))))
|
||||
(a:when-let* ((all-uris (lines->uri text))
|
||||
(re (strcat (build-re-scheme) "\\P{White_Space}+"))
|
||||
(scanner (cl-ppcre:create-scanner re)))
|
||||
(scanner (cl-ppcre:create-scanner re)))
|
||||
(let ((results '()))
|
||||
(loop for uri in all-uris when (cl-ppcre:scan scanner uri) do
|
||||
(pushnew uri results :test #'string=))
|
||||
|
|
Loading…
Reference in New Issue