]> code.delx.au - gnu-emacs/blobdiff - lisp/comint.el
Merge from origin/emacs-24
[gnu-emacs] / lisp / comint.el
index b14ab5bdf9f0cce2ac3cdda0dd8ddcea3af1026c..b6944da355c2b7ce4559f5639d000c53d2dc505d 100644 (file)
@@ -2222,7 +2222,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.
@@ -2270,7 +2273,6 @@ 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)
        (comint-skip-prompt)
        (point))
@@ -2281,7 +2283,10 @@ a buffer local variable."
     ;; if there are two fields on a line, then the first one is the
     ;; prompt, and the second one is an input field, and is front-sticky
     ;; (as input fields should be).
-    (constrain-to-field (field-beginning) (line-end-position))))
+    (constrain-to-field (if (eq (field-at-pos (point)) 'output)
+                            (line-beginning-position)
+                          (field-beginning))
+                        (line-end-position))))
 
 (defun comint-bol (&optional arg)
   "Go to the beginning of line, then skip past the prompt, if any.