summaryrefslogtreecommitdiff
path: root/lisp/comint.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 419938ea684..c81551acd5f 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2215,7 +2215,10 @@ the current line with any initial string matching the regexp
(null (get-char-property (setq bof (field-beginning)) 'field)))
(field-string-no-properties bof)
(comint-bol)
- (buffer-substring-no-properties (point) (line-end-position)))))
+ (buffer-substring-no-properties (point)
+ (if comint-use-prompt-regexp
+ (line-end-position)
+ (field-end))))))
(defun comint-copy-old-input ()
"Insert after prompt old input at point as new input to be edited.
@@ -2263,8 +2266,9 @@ a buffer local variable."
(if comint-use-prompt-regexp
;; Use comint-prompt-regexp
(save-excursion
- (re-search-backward comint-prompt-regexp nil t)
(beginning-of-line)
+ (unless (looking-at comint-prompt-regexp)
+ (re-search-backward comint-prompt-regexp nil t))
(comint-skip-prompt)
(point))
;; Use input fields. Note that, unlike the behavior of