Skip to content

Multi-line input truncated when comint-use-prompt-regexp and comint-eol-on-send are both t #38

Description

@dpom

Description

Multi-line input containing blank lines is truncated to just the first line when comint-use-prompt-regexp and comint-eol-on-send are both t.

Example: sending "First sentence\n\nSecond sentence" results in only "First sentence" being sent to the process.

Root cause

In Emacs 30's comint-send-input, when comint-use-prompt-regexp is t and comint-eol-on-send is t, the function calls (end-of-line) (instead of (goto-char (field-end))) to position point before capturing input. If point starts at the process mark (not at point-max), (end-of-line) only moves to the end of the first line, truncating the rest.

;; comint-send-input in Emacs 30:
(if comint-eol-on-send
    (if comint-use-prompt-regexp
        (end-of-line)               ;; ← truncates at first newline
      (goto-char (field-end))))     ;; ← works correctly

In shell-maker-submit, point is conditionally moved to point-max only when (shell-maker-point-at-last-prompt-p) returns nil. When point is at the process mark (right after the prompt, before the input text), the predicate returns t, so goto-char is skipped. This leaves point at the process mark, where (end-of-line) only captures the first line.

Fix

PR #37: unconditionally move to point-max before calling comint-send-input in shell-maker-submit.

Workaround

Users can set comint-use-prompt-regexp to nil in the shell-maker buffer, or ensure point is at point-max before submitting.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions