From 8f1c83af6b69c0d6007b4afe68f2d61eb1bb98f2 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 11 May 2018 07:05:53 -0400 Subject: [PATCH] Fix comint-get-old-input-default for output field case (Bug#25028) * lisp/comint.el (comint-get-old-input-default): Don't return whole field when point was on an output field. --- lisp/comint.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/comint.el b/lisp/comint.el index e81f739849..5c1918ffad 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -2262,16 +2262,18 @@ comint-get-old-input-default If `comint-use-prompt-regexp' is non-nil, then return the current line with any initial string matching the regexp `comint-prompt-regexp' removed." - (let (bof) + (let (field-prop bof) (if (and (not comint-use-prompt-regexp) ;; Make sure we're in an input rather than output field. - (null (get-char-property (setq bof (field-beginning)) 'field))) + (not (setq field-prop (get-char-property + (setq bof (field-beginning)) 'field)))) (field-string-no-properties bof) (comint-bol) - (buffer-substring-no-properties (point) - (if comint-use-prompt-regexp - (line-end-position) - (field-end)))))) + (buffer-substring-no-properties + (point) + (if (or comint-use-prompt-regexp (eq field-prop 'output)) + (line-end-position) + (field-end)))))) (defun comint-copy-old-input () "Insert after prompt old input at point as new input to be edited. -- 2.11.0