aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorF. Jason Park2023-06-10 00:17:44 -0700
committerF. Jason Park2023-06-11 20:14:08 -0700
commit2daa71f93294240f899fa94e3f7a87900bd64e3f (patch)
tree7a1c59630cbd40e45569eca30e42ebba84f1dddd
parentd880a08f9592e51ada5749d10b472396683fb6ee (diff)
downloademacs-2daa71f93294240f899fa94e3f7a87900bd64e3f.tar.gz
emacs-2daa71f93294240f899fa94e3f7a87900bd64e3f.zip
Don't insert prompt input before markers in ERC
* etc/ERC-NEWS: Update entry in 5.6 section announcing a persistent prompt. * lisp/erc/erc-dcc.el (erc-dcc-chat-setup): Use helper `erc--initialize-markers' to set up prompt. * lisp/erc/erc.el (erc--initialize-markers): Change `erc-insert-marker' type to t. Do this to spare modules that want to remember the current message location from resorting to workarounds, like leaving a marker one char before the end of a message, which is not foolproof. (erc--refresh-prompt): Temporarily change type of `erc-insert-marker' when inserting prompt. (erc-display-line-1): Insert incoming message normally instead of forcing before markers, thus respecting markers left by third parties. Strictly speaking, this is a breaking change. (erc-display-msg): Insert normally instead of calling `insert-before-markers', which was a regression introduced by 05f6fdb9 "Preserve ERC prompt and its bounding markers". * test/lisp/erc/erc-dcc-tests.el (erc-dcc-tests--dcc-handle-ctcp-send, erc-dcc-tests--erc-dcc-do-GET-command): Use helper to initialize prompt and markers. * test/lisp/erc/erc-networks-tests.el (erc-networks--ensure-announced, erc-networks--rename-server-buffer--existing--reuse, erc-networks--rename-server-buffer--existing--noreuse, erc-networks--rename-server-buffer--reconnecting, erc-networks--rename-server-buffer--id, erc-networks--rename-server-buffer--existing--live, erc-networks--rename-server-buffer--local-match, erc-networks--rename-server-buffer--local-nomatch): Use helper to initialize prompt and bounding markers. * test/lisp/erc/erc-stamp-tests.el (erc-stamp-tests--insert-right): Use `erc--initialize-markers' for setting up prompt. * test/lisp/erc/erc-tests.el (erc--refresh-prompt): Adjust assertions for expected prompt content. (Bug#60936)
-rw-r--r--etc/ERC-NEWS9
-rw-r--r--lisp/erc/erc-dcc.el3
-rw-r--r--lisp/erc/erc.el18
-rw-r--r--test/lisp/erc/erc-dcc-tests.el10
-rw-r--r--test/lisp/erc/erc-networks-tests.el24
-rw-r--r--test/lisp/erc/erc-stamp-tests.el7
-rw-r--r--test/lisp/erc/erc-tests.el47
7 files changed, 58 insertions, 60 deletions
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS
index e4947d0c64d..68f1083621c 100644
--- a/etc/ERC-NEWS
+++ b/etc/ERC-NEWS
@@ -244,7 +244,14 @@ running hooks during message insertion, and the position of its
244"insert marker" (ERC's per-buffer process mark) was inconsistent 244"insert marker" (ERC's per-buffer process mark) was inconsistent
245during these spells. To make insertion handling more predictable in 245during these spells. To make insertion handling more predictable in
246preparation for incorporating various protocol extensions, the prompt 246preparation for incorporating various protocol extensions, the prompt
247and its bounding markers have become perennial fixtures. In rare 247and its bounding markers have become perennial fixtures. To effect
248this change, small behavioral differences in message insertion have
249been adopted. Crucially, 'erc-insert-marker' now has an "insertion
250type" of t, and 'erc-display-line-1' now calls 'insert' instead of
251'insert-before-prompt'. This allows user code to leave its own
252markers via 'erc-insert-modify-hook' and 'erc-insert-post-hook'
253instead of having to resort to workarounds. Message insertion for
254outgoing messages, in 'erc-display-msg', remains as before. In rare
248cases, these changes may mean third-party code needs tweaking, for 255cases, these changes may mean third-party code needs tweaking, for
249example, requiring the use of 'insert-before-markers' instead of 256example, requiring the use of 'insert-before-markers' instead of
250'insert'. As always, users feeling unduly inconvenienced by these 257'insert'. As always, users feeling unduly inconvenienced by these
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 2012bcadae1..cc2dcc9a788 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -1213,9 +1213,8 @@ other client."
1213 erc-dcc-from nick 1213 erc-dcc-from nick
1214 erc-dcc-entry-data entry 1214 erc-dcc-entry-data entry
1215 erc-dcc-unprocessed-output "" 1215 erc-dcc-unprocessed-output ""
1216 erc-insert-marker (point-max-marker)
1217 erc-input-marker (make-marker)) 1216 erc-input-marker (make-marker))
1218 (erc-display-prompt buffer (point-max)) 1217 (erc--initialize-markers (point) nil)
1219 (set-process-buffer proc buffer) 1218 (set-process-buffer proc buffer)
1220 (add-hook 'kill-buffer-hook #'erc-dcc-chat-buffer-killed nil t) 1219 (add-hook 'kill-buffer-hook #'erc-dcc-chat-buffer-killed nil t)
1221 (run-hook-with-args 'erc-dcc-chat-connect-hook proc)) 1220 (run-hook-with-args 'erc-dcc-chat-connect-hook proc))
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index c0fa48bd9bd..c1c5b7b5e9a 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2214,8 +2214,8 @@ nil."
2214 (alist-get 'erc-insert-marker continued-session)) 2214 (alist-get 'erc-insert-marker continued-session))
2215 (set-marker erc-input-marker 2215 (set-marker erc-input-marker
2216 (alist-get 'erc-input-marker continued-session)) 2216 (alist-get 'erc-input-marker continued-session))
2217 (goto-char erc-insert-marker) 2217 (set-marker-insertion-type erc-insert-marker t)
2218 (cl-assert (= (field-end) erc-input-marker)) 2218 (cl-assert (= (field-end erc-insert-marker) erc-input-marker))
2219 (goto-char old-point) 2219 (goto-char old-point)
2220 (erc--unhide-prompt)) 2220 (erc--unhide-prompt))
2221 (cl-assert (not (get-text-property (point) 'erc-prompt))) 2221 (cl-assert (not (get-text-property (point) 'erc-prompt)))
@@ -2226,6 +2226,7 @@ nil."
2226 (insert "\n\n") 2226 (insert "\n\n")
2227 (set-marker erc-insert-marker (point)) 2227 (set-marker erc-insert-marker (point))
2228 (erc-display-prompt) 2228 (erc-display-prompt)
2229 (set-marker-insertion-type erc-insert-marker t)
2229 (cl-assert (= (point) (point-max))))) 2230 (cl-assert (= (point) (point-max)))))
2230 2231
2231(defun erc-open (&optional server port nick full-name 2232(defun erc-open (&optional server port nick full-name
@@ -2821,10 +2822,12 @@ this option to nil."
2821 (when (functionp erc-prompt) 2822 (when (functionp erc-prompt)
2822 (save-excursion 2823 (save-excursion
2823 (goto-char erc-insert-marker) 2824 (goto-char erc-insert-marker)
2825 (set-marker-insertion-type erc-insert-marker nil)
2824 ;; Avoid `erc-prompt' (the named function), which appends a 2826 ;; Avoid `erc-prompt' (the named function), which appends a
2825 ;; space, and `erc-display-prompt', which propertizes all but 2827 ;; space, and `erc-display-prompt', which propertizes all but
2826 ;; that space. 2828 ;; that space.
2827 (insert-and-inherit (funcall erc-prompt)) 2829 (insert-and-inherit (funcall erc-prompt))
2830 (set-marker-insertion-type erc-insert-marker t)
2828 (delete-region (point) (1- erc-input-marker))))) 2831 (delete-region (point) (1- erc-input-marker)))))
2829 2832
2830(defun erc-display-line-1 (string buffer) 2833(defun erc-display-line-1 (string buffer)
@@ -2860,7 +2863,7 @@ If STRING is nil, the function does nothing."
2860 (save-restriction 2863 (save-restriction
2861 (widen) 2864 (widen)
2862 (goto-char insert-position) 2865 (goto-char insert-position)
2863 (insert-before-markers string) 2866 (insert string)
2864 (erc--assert-input-bounds) 2867 (erc--assert-input-bounds)
2865 ;; run insertion hook, with point at restored location 2868 ;; run insertion hook, with point at restored location
2866 (save-restriction 2869 (save-restriction
@@ -6490,15 +6493,14 @@ Return non-nil only if we actually send anything."
6490 (when erc-insert-this 6493 (when erc-insert-this
6491 (save-excursion 6494 (save-excursion
6492 (erc--assert-input-bounds) 6495 (erc--assert-input-bounds)
6493 (let ((insert-position (marker-position erc-insert-marker)) 6496 (let ((insert-position (marker-position (goto-char erc-insert-marker)))
6494 beg) 6497 beg)
6495 (goto-char insert-position) 6498 (insert (erc-format-my-nick))
6496 (insert-before-markers (erc-format-my-nick))
6497 (setq beg (point)) 6499 (setq beg (point))
6498 (insert-before-markers line) 6500 (insert line)
6499 (erc-put-text-property beg (point) 'font-lock-face 'erc-input-face) 6501 (erc-put-text-property beg (point) 'font-lock-face 'erc-input-face)
6500 (erc-put-text-property insert-position (point) 'erc-command 'PRIVMSG) 6502 (erc-put-text-property insert-position (point) 'erc-command 'PRIVMSG)
6501 (insert-before-markers "\n") 6503 (insert "\n")
6502 (save-restriction 6504 (save-restriction
6503 (narrow-to-region insert-position (point)) 6505 (narrow-to-region insert-position (point))
6504 (run-hooks 'erc-send-modify-hook) 6506 (run-hooks 'erc-send-modify-hook)
diff --git a/test/lisp/erc/erc-dcc-tests.el b/test/lisp/erc/erc-dcc-tests.el
index 7fb5f82e784..f02ddf228a2 100644
--- a/test/lisp/erc/erc-dcc-tests.el
+++ b/test/lisp/erc/erc-dcc-tests.el
@@ -57,11 +57,8 @@
57 (erc-mode) 57 (erc-mode)
58 (setq erc-server-process 58 (setq erc-server-process
59 (start-process "fake" (current-buffer) "sleep" "10") 59 (start-process "fake" (current-buffer) "sleep" "10")
60 erc-input-marker (make-marker)
61 erc-insert-marker (make-marker)
62 erc-server-current-nick "dummy") 60 erc-server-current-nick "dummy")
63 (erc-display-prompt) 61 (erc--initialize-markers (point) nil)
64 (set-marker erc-insert-marker (pos-bol))
65 (set-process-query-on-exit-flag erc-server-process nil) 62 (set-process-query-on-exit-flag erc-server-process nil)
66 (should-not erc-dcc-list) 63 (should-not erc-dcc-list)
67 (erc-ctcp-query-DCC erc-server-process 64 (erc-ctcp-query-DCC erc-server-process
@@ -121,17 +118,14 @@
121 calls) 118 calls)
122 (erc-mode) 119 (erc-mode)
123 (setq erc-server-process proc 120 (setq erc-server-process proc
124 erc-input-marker (make-marker)
125 erc-insert-marker (make-marker)
126 erc-server-current-nick "dummy") 121 erc-server-current-nick "dummy")
122 (erc--initialize-markers (point) nil)
127 (set-process-query-on-exit-flag proc nil) 123 (set-process-query-on-exit-flag proc nil)
128 (cl-letf (((symbol-function 'read-file-name) 124 (cl-letf (((symbol-function 'read-file-name)
129 (lambda (&rest _) file)) 125 (lambda (&rest _) file))
130 ((symbol-function 'erc-dcc-get-file) 126 ((symbol-function 'erc-dcc-get-file)
131 (lambda (&rest r) (push r calls)))) 127 (lambda (&rest r) (push r calls))))
132 (goto-char (point-max)) 128 (goto-char (point-max))
133 (set-marker erc-insert-marker (point-max))
134 (erc-display-prompt)
135 129
136 (ert-info ("No turbo") 130 (ert-info ("No turbo")
137 (should-not (plist-member elt :turbo)) 131 (should-not (plist-member elt :turbo))
diff --git a/test/lisp/erc/erc-networks-tests.el b/test/lisp/erc/erc-networks-tests.el
index b9d216f217b..f0fcbbc81c6 100644
--- a/test/lisp/erc/erc-networks-tests.el
+++ b/test/lisp/erc/erc-networks-tests.el
@@ -1233,10 +1233,7 @@
1233 :contents "MOTD File is missing"))) 1233 :contents "MOTD File is missing")))
1234 1234
1235 (erc-mode) ; boilerplate displayable start (needs `erc-server-process') 1235 (erc-mode) ; boilerplate displayable start (needs `erc-server-process')
1236 (insert "\n\n") 1236 (erc--initialize-markers (point) nil)
1237 (setq erc-input-marker (make-marker) erc-insert-marker (make-marker))
1238 (set-marker erc-insert-marker (point-max))
1239 (erc-display-prompt) ; boilerplate displayable end
1240 1237
1241 (erc-networks--ensure-announced erc-server-process parsed) 1238 (erc-networks--ensure-announced erc-server-process parsed)
1242 (goto-char (point-min)) 1239 (goto-char (point-min))
@@ -1277,9 +1274,9 @@
1277 (with-current-buffer old-buf 1274 (with-current-buffer old-buf
1278 (erc-mode) 1275 (erc-mode)
1279 (insert "*** Old buf") 1276 (insert "*** Old buf")
1277 (erc--initialize-markers (point) nil)
1280 (setq erc-network 'FooNet 1278 (setq erc-network 'FooNet
1281 erc-server-current-nick "tester" 1279 erc-server-current-nick "tester"
1282 erc-insert-marker (set-marker (make-marker) (point-max))
1283 erc-server-process old-proc 1280 erc-server-process old-proc
1284 erc-networks--id (erc-networks--id-create nil))) 1281 erc-networks--id (erc-networks--id-create nil)))
1285 1282
@@ -1328,10 +1325,10 @@
1328 erc-reuse-buffers) 1325 erc-reuse-buffers)
1329 (with-current-buffer old-buf 1326 (with-current-buffer old-buf
1330 (erc-mode) 1327 (erc-mode)
1328 (erc--initialize-markers (point) nil)
1331 (insert "*** Old buf") 1329 (insert "*** Old buf")
1332 (setq erc-network 'FooNet 1330 (setq erc-network 'FooNet
1333 erc-server-current-nick "tester" 1331 erc-server-current-nick "tester"
1334 erc-insert-marker (set-marker (make-marker) (point-max))
1335 erc-server-process old-proc 1332 erc-server-process old-proc
1336 erc-networks--id (erc-networks--id-create nil))) 1333 erc-networks--id (erc-networks--id-create nil)))
1337 (with-current-buffer (get-buffer-create "#chan") 1334 (with-current-buffer (get-buffer-create "#chan")
@@ -1377,10 +1374,10 @@
1377 1374
1378 (with-current-buffer old-buf 1375 (with-current-buffer old-buf
1379 (erc-mode) 1376 (erc-mode)
1377 (erc--initialize-markers (point) nil)
1380 (insert "*** Old buf") 1378 (insert "*** Old buf")
1381 (setq erc-network 'FooNet 1379 (setq erc-network 'FooNet
1382 erc-server-current-nick "tester" 1380 erc-server-current-nick "tester"
1383 erc-insert-marker (set-marker (make-marker) (point-max))
1384 erc-server-process old-proc 1381 erc-server-process old-proc
1385 erc-networks--id (erc-networks--id-create nil))) 1382 erc-networks--id (erc-networks--id-create nil)))
1386 1383
@@ -1415,10 +1412,10 @@
1415 1412
1416 (with-current-buffer old-buf 1413 (with-current-buffer old-buf
1417 (erc-mode) 1414 (erc-mode)
1415 (erc--initialize-markers (point) nil)
1418 (insert "*** Old buf") 1416 (insert "*** Old buf")
1419 (setq erc-network 'FooNet 1417 (setq erc-network 'FooNet
1420 erc-networks--id (erc-networks--id-create 'MySession) 1418 erc-networks--id (erc-networks--id-create 'MySession)
1421 erc-insert-marker (set-marker (make-marker) (point-max))
1422 erc-server-process old-proc)) 1419 erc-server-process old-proc))
1423 1420
1424 (with-current-buffer (get-buffer-create "#chan") 1421 (with-current-buffer (get-buffer-create "#chan")
@@ -1454,10 +1451,10 @@
1454 1451
1455 (with-current-buffer old-buf 1452 (with-current-buffer old-buf
1456 (erc-mode) 1453 (erc-mode)
1454 (erc--initialize-markers (point) nil)
1457 (insert "*** Old buf") 1455 (insert "*** Old buf")
1458 (setq erc-network 'FooNet 1456 (setq erc-network 'FooNet
1459 erc-server-current-nick "tester" 1457 erc-server-current-nick "tester"
1460 erc-insert-marker (set-marker (make-marker) (point-max))
1461 erc-server-process old-proc 1458 erc-server-process old-proc
1462 erc-networks--id (erc-networks--id-create nil)) 1459 erc-networks--id (erc-networks--id-create nil))
1463 (should (erc-server-process-alive))) 1460 (should (erc-server-process-alive)))
@@ -1473,15 +1470,12 @@
1473 (ert-info ("New buffer rejected, abandoned, not killed") 1470 (ert-info ("New buffer rejected, abandoned, not killed")
1474 (with-current-buffer (get-buffer-create "irc.foonet.org") 1471 (with-current-buffer (get-buffer-create "irc.foonet.org")
1475 (erc-mode) 1472 (erc-mode)
1473 (erc--initialize-markers (point) nil)
1476 (setq erc-network 'FooNet 1474 (setq erc-network 'FooNet
1477 erc-server-current-nick "tester" 1475 erc-server-current-nick "tester"
1478 erc-insert-marker (make-marker)
1479 erc-input-marker (make-marker)
1480 erc-server-process (erc-networks-tests--create-live-proc) 1476 erc-server-process (erc-networks-tests--create-live-proc)
1481 erc-networks--id (erc-networks--id-create nil)) 1477 erc-networks--id (erc-networks--id-create nil))
1482 (set-process-sentinel erc-server-process #'ignore) 1478 (set-process-sentinel erc-server-process #'ignore)
1483 (erc-display-prompt nil (point-max))
1484 (set-marker erc-insert-marker (pos-bol))
1485 (erc-display-message nil 'notice (current-buffer) "notice") 1479 (erc-display-message nil 'notice (current-buffer) "notice")
1486 (with-silent-modifications 1480 (with-silent-modifications
1487 (should-not (erc-networks--rename-server-buffer erc-server-process))) 1481 (should-not (erc-networks--rename-server-buffer erc-server-process)))
@@ -1514,10 +1508,10 @@
1514 (with-current-buffer old-buf 1508 (with-current-buffer old-buf
1515 (erc-mode) 1509 (erc-mode)
1516 (insert "*** Old buf") 1510 (insert "*** Old buf")
1511 (erc--initialize-markers (point) nil)
1517 (setq erc-network 'FooNet 1512 (setq erc-network 'FooNet
1518 erc-server-current-nick "tester" 1513 erc-server-current-nick "tester"
1519 erc-server-announced-name "us-east.foonet.org" 1514 erc-server-announced-name "us-east.foonet.org"
1520 erc-insert-marker (set-marker (make-marker) (point-max))
1521 erc-server-process old-proc 1515 erc-server-process old-proc
1522 erc--isupport-params (make-hash-table) 1516 erc--isupport-params (make-hash-table)
1523 erc-networks--id (erc-networks--id-create nil)) 1517 erc-networks--id (erc-networks--id-create nil))
@@ -1566,10 +1560,10 @@
1566 (with-current-buffer old-buf 1560 (with-current-buffer old-buf
1567 (erc-mode) 1561 (erc-mode)
1568 (insert "*** Old buf") 1562 (insert "*** Old buf")
1563 (erc--initialize-markers (point) nil)
1569 (setq erc-network 'FooNet 1564 (setq erc-network 'FooNet
1570 erc-server-current-nick "tester" 1565 erc-server-current-nick "tester"
1571 erc-server-announced-name "us-west.foonet.org" 1566 erc-server-announced-name "us-west.foonet.org"
1572 erc-insert-marker (set-marker (make-marker) (point-max))
1573 erc-server-process old-proc 1567 erc-server-process old-proc
1574 erc--isupport-params (make-hash-table) 1568 erc--isupport-params (make-hash-table)
1575 erc-networks--id (erc-networks--id-create nil)) 1569 erc-networks--id (erc-networks--id-create nil))
diff --git a/test/lisp/erc/erc-stamp-tests.el b/test/lisp/erc/erc-stamp-tests.el
index 01e71e348e0..6da7ed4503d 100644
--- a/test/lisp/erc/erc-stamp-tests.el
+++ b/test/lisp/erc/erc-stamp-tests.el
@@ -43,13 +43,10 @@
43 (with-current-buffer (get-buffer-create "*erc-stamp-tests--insert-right*") 43 (with-current-buffer (get-buffer-create "*erc-stamp-tests--insert-right*")
44 (erc-mode) 44 (erc-mode)
45 (erc-munge-invisibility-spec) 45 (erc-munge-invisibility-spec)
46 (erc--initialize-markers (point) nil)
46 (setq erc-server-process (start-process "p" (current-buffer) 47 (setq erc-server-process (start-process "p" (current-buffer)
47 "sleep" "1") 48 "sleep" "1"))
48 erc-input-marker (make-marker)
49 erc-insert-marker (make-marker))
50 (set-process-query-on-exit-flag erc-server-process nil) 49 (set-process-query-on-exit-flag erc-server-process nil)
51 (set-marker erc-insert-marker (point-max))
52 (erc-display-prompt)
53 50
54 (funcall test) 51 (funcall test)
55 52
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 7d1e20132e1..f3489a16386 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -294,16 +294,19 @@
294 (set-process-query-on-exit-flag erc-server-process nil) 294 (set-process-query-on-exit-flag erc-server-process nil)
295 ;; Incoming message redraws prompt 295 ;; Incoming message redraws prompt
296 (erc-display-message nil 'notice nil "Welcome") 296 (erc-display-message nil 'notice nil "Welcome")
297 (should (looking-at-p (rx "*** Welcome")))
298 (forward-line)
297 (should (looking-at-p "ServNet 4>")) 299 (should (looking-at-p "ServNet 4>"))
298 ;; Say something 300 ;; Say something
299 (save-excursion (goto-char erc-input-marker) 301 (goto-char erc-input-marker)
300 (insert "Howdy") 302 (insert "Howdy")
301 (erc-send-current-line) 303 (erc-send-current-line)
302 (forward-line -1) 304 (save-excursion (forward-line -1)
303 (should (looking-at "No target")) 305 (should (looking-at "No target"))
304 (forward-line -1) 306 (forward-line -1)
305 (should (looking-at "<tester> Howdy"))) 307 (should (looking-at "<tester> Howdy")))
306 (should (looking-at-p "ServNet 6>")) 308 (should (looking-back "ServNet 6> "))
309 (should (= erc-input-marker (point)))
307 ;; Space after prompt is unpropertized 310 ;; Space after prompt is unpropertized
308 (should (get-text-property (1- erc-input-marker) 'erc-prompt)) 311 (should (get-text-property (1- erc-input-marker) 'erc-prompt))
309 (should-not (get-text-property erc-input-marker 'erc-prompt)) 312 (should-not (get-text-property erc-input-marker 'erc-prompt))
@@ -317,6 +320,7 @@
317 (erc-tests--send-prep) 320 (erc-tests--send-prep)
318 (goto-char erc-insert-marker) 321 (goto-char erc-insert-marker)
319 (should (looking-at-p "#chan 9>")) 322 (should (looking-at-p "#chan 9>"))
323 (goto-char erc-input-marker)
320 (setq erc-server-process (buffer-local-value 'erc-server-process 324 (setq erc-server-process (buffer-local-value 'erc-server-process
321 (get-buffer "ServNet")) 325 (get-buffer "ServNet"))
322 erc-networks--id (erc-with-server-buffer erc-networks--id) 326 erc-networks--id (erc-with-server-buffer erc-networks--id)
@@ -328,18 +332,18 @@
328 (erc-update-current-channel-member "tester" "tester") 332 (erc-update-current-channel-member "tester" "tester")
329 (erc-display-message nil nil (current-buffer) 333 (erc-display-message nil nil (current-buffer)
330 (erc-format-privmessage "alice" "Hi" nil t)) 334 (erc-format-privmessage "alice" "Hi" nil t))
331 (should (looking-at-p "#chan@ServNet 10>")) 335 (should (looking-back "#chan@ServNet 10> "))
332 (save-excursion (goto-char erc-input-marker) 336 (goto-char erc-input-marker)
333 (insert "Howdy") 337 (insert "Howdy")
334 (erc-send-current-line) 338 (erc-send-current-line)
335 (forward-line -1) 339 (save-excursion (forward-line -1)
336 (should (looking-at "<tester> Howdy"))) 340 (should (looking-at "<tester> Howdy")))
337 (should (looking-at-p "#chan@ServNet 11>")) 341 (should (looking-back "#chan@ServNet 11> "))
338 (save-excursion (goto-char erc-input-marker) 342 (should (= (point) erc-input-marker))
339 (insert "/query bob") 343 (insert "/query bob")
340 (erc-send-current-line)) 344 (erc-send-current-line)
341 ;; Query does not redraw (nor /help, only message input) 345 ;; Query does not redraw (nor /help, only message input)
342 (should (looking-at-p "#chan@ServNet 11>")) 346 (should (looking-back "#chan@ServNet 11> "))
343 ;; No sign of old prompts 347 ;; No sign of old prompts
344 (save-excursion 348 (save-excursion
345 (goto-char (point-min)) 349 (goto-char (point-min))
@@ -349,15 +353,16 @@
349 (with-current-buffer (get-buffer "bob") 353 (with-current-buffer (get-buffer "bob")
350 (goto-char erc-insert-marker) 354 (goto-char erc-insert-marker)
351 (should (looking-at-p "bob@ServNet 14>")) 355 (should (looking-at-p "bob@ServNet 14>"))
356 (goto-char erc-input-marker)
352 (erc-display-message nil nil (current-buffer) 357 (erc-display-message nil nil (current-buffer)
353 (erc-format-privmessage "bob" "Hi" nil t)) 358 (erc-format-privmessage "bob" "Hi" nil t))
354 (should (looking-at-p "bob@ServNet 15>")) 359 (should (looking-back "bob@ServNet 15> "))
355 (save-excursion (goto-char erc-input-marker) 360 (goto-char erc-input-marker)
356 (insert "Howdy") 361 (insert "Howdy")
357 (erc-send-current-line) 362 (erc-send-current-line)
358 (forward-line -1) 363 (save-excursion (forward-line -1)
359 (should (looking-at "<tester> Howdy"))) 364 (should (looking-at "<tester> Howdy")))
360 (should (looking-at-p "bob@ServNet 16>")) 365 (should (looking-back "bob@ServNet 16> "))
361 ;; No sign of old prompts 366 ;; No sign of old prompts
362 (save-excursion 367 (save-excursion
363 (goto-char (point-min)) 368 (goto-char (point-min))