File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -412,10 +412,21 @@ and INHERIT-INPUT-METHOD see function `read-string' for more information."
412412For arguments OLD, NEW and S; see the function `eask-s-replace'
413413for more information."
414414 (if-let* ((data (eask-ansi-codes s))
415- (start (nth 1 data))
416- (end (nth 0 data))
417415 (splits (split-string s (regexp-quote old))))
418- (mapconcat #'identity splits (concat start new end))
416+ (let* ((result (nth 0 splits))
417+ (index 1 )
418+ (base 0 )
419+ (reset (car (last data))))
420+ (while (< index (length splits))
421+ (let ((start (nth base data))
422+ (end (nth (1+ base) data))) ; \e[0m
423+ (setq result (concat result
424+ end new start
425+ (nth index splits))))
426+ (cl-incf base 2 )
427+ (cl-incf index))
428+ ; ; Just ensure the last character is reset.
429+ (concat result reset))
419430 (eask-s-replace old new s)))
420431
421432; ;
You can’t perform that action at this time.
0 commit comments