From 874c30e7e11a6d61c3f66928fbf5cb1535207473 Mon Sep 17 00:00:00 2001 From: Friedrich Delgado Friedrichs Date: Sat, 25 Oct 2008 14:37:31 +0200 Subject: [PATCH] escape carets from window-name and group-name, fixes a hang in the status bar reproducible by googling for "^9" or (message "^R 2*^9 - Google Search - Iceweasel^r") --- primitives.lisp | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/primitives.lisp b/primitives.lisp index 01da193..11b9e1c 100644 --- a/primitives.lisp +++ b/primitives.lisp @@ -716,9 +716,24 @@ do: (setf output (concatenate 'string output (string (car cur))) cur (cdr cur))))))) +(defun escape-carets (string) + (if (> (length string) 0) + (let ((pos (position #\^ string))) + (if pos + (concat (subseq string 0 (+ 1 pos)) + "^" + (escape-carets (subseq string (+ 1 pos)))) + string)) + string)) + +(defun return-escaped-carets (fun) + (lambda (&rest args) + (let ((string (apply fun args))) + (escape-carets string)))) + (defvar *window-formatters* '((#\n window-number) (#\s fmt-window-status) - (#\t window-name) + (#\t (return-escaped-carets window-name)) (#\c window-class) (#\i window-res) (#\r window-role) @@ -757,7 +772,7 @@ characters.") (defvar *group-formatters* '((#\n group-number) (#\s fmt-group-status) - (#\t group-name)) + (#\t (return-escaped-carets group-name))) "An alist of characters and formatter functions. The character can be used as a format character in @var{*group-format*}. When the character is encountered in the string, the corresponding function is called -- 1.5.6.5