diff options
| author | F. Jason Park | 2022-03-21 19:21:57 -0700 |
|---|---|---|
| committer | F. Jason Park | 2022-06-30 15:19:53 -0700 |
| commit | a9d89d083ac5bf0b9fd5568d42e565aba0b6e13f (patch) | |
| tree | 90819c90c517a0a23c4428ba48cc884df58bc8ce | |
| parent | 05902243431c877011a0bf6ce38c9230d0ef0721 (diff) | |
| download | emacs-a9d89d083ac5bf0b9fd5568d42e565aba0b6e13f.tar.gz emacs-a9d89d083ac5bf0b9fd5568d42e565aba0b6e13f.zip | |
Fix regression in erc-send-input-line
* lisp/erc/erc.el (erc-send-input-line): Restore remedial single-space
padding to ensure empty messages typed at the prompt without an
explicit /msg aren't rejected by the server. This behavior is only
noticeable when `erc-send-whitespace-lines' is active.
* test/lisp/erc/erc-tests.el (erc-process-input-line): Add trailing
newline to more correctly simulate how it's actually called by
`erc-send-input'. (Bug#50008)
| -rw-r--r-- | lisp/erc/erc.el | 2 | ||||
| -rw-r--r-- | test/lisp/erc/erc-tests.el | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 1c221a9cb13..971d3f426fc 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el | |||
| @@ -2992,6 +2992,8 @@ for special purposes (see erc-dcc.el).") | |||
| 2992 | 2992 | ||
| 2993 | (defun erc-send-input-line (target line &optional force) | 2993 | (defun erc-send-input-line (target line &optional force) |
| 2994 | "Send LINE to TARGET." | 2994 | "Send LINE to TARGET." |
| 2995 | (when (string= line "\n") | ||
| 2996 | (setq line " \n")) | ||
| 2995 | (erc-message "PRIVMSG" (concat target " " line) force)) | 2997 | (erc-message "PRIVMSG" (concat target " " line) force)) |
| 2996 | 2998 | ||
| 2997 | (defun erc-get-arglist (fun) | 2999 | (defun erc-get-arglist (fun) |
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index 618d7eeea02..afe9cc7b8cb 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el | |||
| @@ -643,19 +643,19 @@ | |||
| 643 | (ert-info ("Implicit cmd via `erc-send-input-line-function'") | 643 | (ert-info ("Implicit cmd via `erc-send-input-line-function'") |
| 644 | 644 | ||
| 645 | (ert-info ("Baseline") | 645 | (ert-info ("Baseline") |
| 646 | (erc-process-input-line "hi") | 646 | (erc-process-input-line "hi\n") |
| 647 | (should (equal (pop erc-server-flood-queue) | 647 | (should (equal (pop erc-server-flood-queue) |
| 648 | '("PRIVMSG #chan :hi\r\n" . utf-8)))) | 648 | '("PRIVMSG #chan :hi\r\n" . utf-8)))) |
| 649 | 649 | ||
| 650 | (ert-info ("Spaces preserved") | 650 | (ert-info ("Spaces preserved") |
| 651 | (erc-process-input-line "hi you") | 651 | (erc-process-input-line "hi you\n") |
| 652 | (should (equal (pop erc-server-flood-queue) | 652 | (should (equal (pop erc-server-flood-queue) |
| 653 | '("PRIVMSG #chan :hi you\r\n" . utf-8)))) | 653 | '("PRIVMSG #chan :hi you\r\n" . utf-8)))) |
| 654 | 654 | ||
| 655 | (ert-info ("Empty line transmitted without injected-space kludge") | 655 | (ert-info ("Empty line transmitted with injected-space kludge") |
| 656 | (erc-process-input-line "") | 656 | (erc-process-input-line "\n") |
| 657 | (should (equal (pop erc-server-flood-queue) | 657 | (should (equal (pop erc-server-flood-queue) |
| 658 | '("PRIVMSG #chan :\r\n" . utf-8)))) | 658 | '("PRIVMSG #chan : \r\n" . utf-8)))) |
| 659 | 659 | ||
| 660 | (should-not calls)))))) | 660 | (should-not calls)))))) |
| 661 | 661 | ||