]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix regression in erc-send-input-line
authorF. Jason Park <jp@neverwas.me>
Tue, 22 Mar 2022 02:21:57 +0000 (19:21 -0700)
committerF. Jason Park <jp@neverwas.me>
Thu, 30 Jun 2022 22:19:53 +0000 (15:19 -0700)
* 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)

lisp/erc/erc.el
test/lisp/erc/erc-tests.el

index 1c221a9cb136ca826c28c99867b4a8b4b34f7851..971d3f426fc5dfd9a67df9a558ded17f717591f6 100644 (file)
@@ -2992,6 +2992,8 @@ for special purposes (see erc-dcc.el).")
 
 (defun erc-send-input-line (target line &optional force)
   "Send LINE to TARGET."
+  (when (string= line "\n")
+    (setq line " \n"))
   (erc-message "PRIVMSG" (concat target " " line) force))
 
 (defun erc-get-arglist (fun)
index 618d7eeea02fd0d06b9ac47772fc214f2861de92..afe9cc7b8cb7092f728187074f250d5d95060075 100644 (file)
         (ert-info ("Implicit cmd via `erc-send-input-line-function'")
 
           (ert-info ("Baseline")
-            (erc-process-input-line "hi")
+            (erc-process-input-line "hi\n")
             (should (equal (pop erc-server-flood-queue)
                            '("PRIVMSG #chan :hi\r\n" . utf-8))))
 
           (ert-info ("Spaces preserved")
-            (erc-process-input-line "hi you")
+            (erc-process-input-line "hi you\n")
             (should (equal (pop erc-server-flood-queue)
                            '("PRIVMSG #chan :hi you\r\n" . utf-8))))
 
-          (ert-info ("Empty line transmitted without injected-space kludge")
-            (erc-process-input-line "")
+          (ert-info ("Empty line transmitted with injected-space kludge")
+            (erc-process-input-line "\n")
             (should (equal (pop erc-server-flood-queue)
-                           '("PRIVMSG #chan :\r\n" . utf-8))))
+                           '("PRIVMSG #chan : \r\n" . utf-8))))
 
           (should-not calls))))))