summaryrefslogtreecommitdiffstats
path: root/packages/x11-wm/stumpwm/files/stumpwm-printing.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/x11-wm/stumpwm/files/stumpwm-printing.patch')
-rw-r--r--packages/x11-wm/stumpwm/files/stumpwm-printing.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/packages/x11-wm/stumpwm/files/stumpwm-printing.patch b/packages/x11-wm/stumpwm/files/stumpwm-printing.patch
new file mode 100644
index 0000000..bea70b1
--- /dev/null
+++ b/packages/x11-wm/stumpwm/files/stumpwm-printing.patch
@@ -0,0 +1,77 @@
+Source: Elias Pipping <pipping@exherbo.org>
+Upstream: no (pasted on irc)
+Reason: A window whose title contains the string ^\ cannot have it printed
+
+From 56b478ae447ca8bf4b0d6d80e10fe00fb1c8d95b Mon Sep 17 00:00:00 2001
+From: Elias Pipping <pipping@exherbo.org>
+Date: Sat, 5 Jan 2013 22:03:53 +0100
+Subject: [PATCH 1/2] Typo
+
+---
+ primitives.lisp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/primitives.lisp b/primitives.lisp
+index 50d062e..3d42012 100644
+--- a/primitives.lisp
++++ b/primitives.lisp
+@@ -753,7 +753,7 @@ do:
+ (format t "%~a~@[~a~]" len from-left-p)
+ (let* ((fmt (cadr (assoc (car cur) fmt-alist :test 'char=)))
+ (str (cond (fmt
+- ;; it can return any type, not jut as string.
++ ;; it can return any type, not just a string.
+ (format nil "~a" (apply fmt args)))
+ ((char= (car cur) #\%)
+ (string #\%))
+--
+1.8.0.3
+
+From db588e4393567b3016c2be57511d35d3c01e4e46 Mon Sep 17 00:00:00 2001
+From: Elias Pipping <pipping@exherbo.org>
+Date: Sat, 5 Jan 2013 22:08:11 +0100
+Subject: [PATCH 2/2] Escape window information before printing
+
+Otherwise, a window with a title like ^\ will wreak havoc when
+echo-string-list fails to parse it.
+---
+ primitives.lisp | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/primitives.lisp b/primitives.lisp
+index 3d42012..88b45d4 100644
+--- a/primitives.lisp
++++ b/primitives.lisp
+@@ -732,6 +732,15 @@ do:
+ ;;;
+ ;;; formatting routines
+
++(defun escape-string (str)
++ (let (buf)
++ (map nil #'(lambda (ch)
++ (push ch buf)
++ (when (char= ch #\^)
++ (push ch buf)))
++ str)
++ (coerce (reverse buf) 'string)))
++
+ (defun format-expand (fmt-alist fmt &rest args)
+ (let* ((chars (coerce fmt 'list))
+ (output "")
+@@ -753,8 +762,11 @@ do:
+ (format t "%~a~@[~a~]" len from-left-p)
+ (let* ((fmt (cadr (assoc (car cur) fmt-alist :test 'char=)))
+ (str (cond (fmt
+- ;; it can return any type, not just a string.
+- (format nil "~a" (apply fmt args)))
++ ;; Any sequence that could be interpreted as
++ ;; a colorisation directive is escaped here
++ (escape-string
++ ;; it can return any type, not just a string.
++ (format nil "~a" (apply fmt args))))
+ ((char= (car cur) #\%)
+ (string #\%))
+ (t
+--
+1.8.0.3
+