[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion bb044ff2f0 213/313: Try to handle prompts
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion bb044ff2f0 213/313: Try to handle prompts with ANSI escape sequences |
Date: |
Sat, 3 Dec 2022 10:59:31 -0500 (EST) |
branch: elpa/bash-completion
commit bb044ff2f0b894efeb56dce7a29fa8ee65c07aa4
Author: montag451 <montag451@laposte.net>
Commit: montag451 <montag451@laposte.net>
Try to handle prompts with ANSI escape sequences
---
bash-completion.el | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index f0509058d6..ec5b2782b6 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -122,6 +122,7 @@
;; https://github.com/szermatt/emacs-bash-completion
(require 'comint)
+(require 'ansi-color)
(eval-when-compile (require 'cl))
;;; Code:
@@ -401,12 +402,6 @@ returned."
(point-min) (point-max))))
(process-put process 'bash-major-version bash-major-version)))
-(defun bash-completion--output-filter (output)
- (with-current-buffer (bash-completion--get-buffer nil)
- (goto-char (point-max))
- (insert output)
- ""))
-
;;; ---------- Inline functions
(defsubst bash-completion-tokenize-get-range (token)
@@ -1321,6 +1316,14 @@ and would like bash completion in Emacs to take these
changes into account."
(setq bash-completion-processes (delq entry bash-completion-processes)))
running))
+(defun bash-completion--output-filter (output)
+ (with-current-buffer (bash-completion--get-buffer nil)
+ (let ((begin (point-max)))
+ (goto-char begin)
+ (insert output)
+ (ansi-color-filter-region begin (point))
+ "")))
+
(defun bash-completion--wait-for-prompt (process prompt-regexp timeout)
(let ((no-timeout t))
(while (and no-timeout
@@ -1329,11 +1332,11 @@ and would like bash completion in Emacs to take these
changes into account."
no-timeout))
(defun bash-completion--get-prompt-regexp ()
- (if comint-use-prompt-regexp
- comint-prompt-regexp
- (let* ((end (comint-line-beginning-position))
- (start (previous-property-change end)))
- (regexp-quote (buffer-substring-no-properties start end)))))
+ (if comint-last-prompt
+ (let ((start (car comint-last-prompt))
+ (end (cdr comint-last-prompt)))
+ (regexp-quote (buffer-substring-no-properties start end)))
+ comint-prompt-regexp))
(defun bash-completion-send (commandline &optional process timeout)
"Send a command to the bash completion process.
- [nongnu] elpa/bash-completion 102316ebf9 117/313: Test bash-completion-dynamic-complete-standard, (continued)
- [nongnu] elpa/bash-completion 102316ebf9 117/313: Test bash-completion-dynamic-complete-standard, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 094da8d6f8 115/313: Fallback to comint-dynamic-simple-complete for shellcommand, even under, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion acdedd0b48 122/313: Remove colon added by mistake in -test.el, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 4e8090c081 128/313: Wrap use of obsolete fn in backward compatibility code path., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f639154925 134/313: Add bash-completion-dynamic-complete-nocomint for issue #13, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8fa510a174 136/313: Fix comments in header of bash-completion.el:, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion dda29cb470 137/313: Fix backward-compatibility code for supporting pre-24 Emacs versions,, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f3b11e1221 139/313: Preserve original, quoted version of the string being completed when, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2010d8bf9e 210/313: Fix history uncluttering, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion ffe0640440 212/313: Cosmetic changes, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion bb044ff2f0 213/313: Try to handle prompts with ANSI escape sequences,
ELPA Syncer <=
- [nongnu] elpa/bash-completion e7ee0a5e07 214/313: Add a new prop to completion process to detect if it has been setup, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f1bd7b0e17 215/313: Use more meaningful names for the functions returning completion processes, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 1e13f6ffa4 216/313: Apply the name changes introduced by the previous commit in the test files, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 4d6fb40bec 217/313: Accept output only from the process performing completion, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 61592a1ce1 218/313: bash-completion.el (bash-completion-quote): Add case for empty string (#37), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 504dd26b1d 219/313: Use cl-defstruct instead of defstruct (#39), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 96ce14af96 221/313: Fix typo (#41), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 783a1e79f0 230/313: Add melpa and melpa-stable badges to README., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion d8f02ecbb1 231/313: Merge branch 'master' into use-separate-processes-opt, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 10569a4625 232/313: Fix bash-completion-test-send., ELPA Syncer, 2022/12/03