From 352f27e260d8ce2ec0a99bc982d90a8e383bea7d Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Tue, 12 May 2026 19:26:00 +0000 Subject: [PATCH] fix: osc8-link doubled backslashes in format string The osc8-link implementation and its test both had doubled backslashes (\\ -> \\) in their format strings, producing two literal backslashes at runtime instead of the single backslash needed for the OSC 8 string terminator (ST = ESC \). Fix: change \\ to \\ in both the implementation and test format strings. The tangled .lisp files now have correct escaped backslashes (\) producing one backslash in the runtime string. Additionally clean up a patch artifact that left a stray backslash before the opening quote. --- org/modern-backend.org | 4 ++-- src/backend/modern-tests.lisp | 2 +- src/backend/modern.lisp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/org/modern-backend.org b/org/modern-backend.org index facab60..09fffb1 100644 --- a/org/modern-backend.org +++ b/org/modern-backend.org @@ -215,7 +215,7 @@ and ~\\ for literal backslash. (test osc8-escape "OSC 8 hyperlink escape wraps text" (is (equal (cl-tty.backend::osc8-link "http://example.com" "click here") - (format nil "~C]8;;http://example.com~C\\click here~C]8;;~C\" + (format nil "~C]8;;http://example.com~C\click here~C]8;;~C\" #\Esc #\Esc #\Esc #\Esc)))) #+END_SRC @@ -475,7 +475,7 @@ allows clickable text in terminals that support the protocol. #+BEGIN_SRC lisp :tangle ../src/backend/modern.lisp (defun osc8-link (url text) "Wrap TEXT in an OSC 8 hyperlink to URL." - (format nil "~C]8;;~A~C\\~A~C]8;;~C\\" + (format nil \"~C]8;;~A~C\\~A~C]8;;~C\\\" #\Esc url #\Esc text #\Esc #\Esc)) #+END_SRC diff --git a/src/backend/modern-tests.lisp b/src/backend/modern-tests.lisp index 78eed79..c7b4a70 100644 --- a/src/backend/modern-tests.lisp +++ b/src/backend/modern-tests.lisp @@ -72,7 +72,7 @@ (test osc8-escape "OSC 8 hyperlink escape wraps text" (is (equal (cl-tty.backend::osc8-link "http://example.com" "click here") - (format nil "~C]8;;http://example.com~C\\click here~C]8;;~C\" + (format nil "~C]8;;http://example.com~C\click here~C]8;;~C\" #\Esc #\Esc #\Esc #\Esc)))) (test hex-color-parsing diff --git a/src/backend/modern.lisp b/src/backend/modern.lisp index d076eb6..55b4ae0 100644 --- a/src/backend/modern.lisp +++ b/src/backend/modern.lisp @@ -90,7 +90,7 @@ as a fallback when a keyword is not in *named-colors*.") (defun osc8-link (url text) "Wrap TEXT in an OSC 8 hyperlink to URL." - (format nil "~C]8;;~A~C\\~A~C]8;;~C\\" + (format nil \"~C]8;;~A~C\\~A~C]8;;~C\\\" #\Esc url #\Esc text #\Esc #\Esc)) (defparameter *border-chars*