[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master cad2b8d: Compute erc line lengths correctly for utf
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master cad2b8d: Compute erc line lengths correctly for utf-8 (etc.) |
Date: |
Fri, 13 Apr 2018 14:24:56 -0400 (EDT) |
branch: master
commit cad2b8d109d4fd2b78d4e064af729336f348a2bb
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Compute erc line lengths correctly for utf-8 (etc.)
* lisp/erc/erc-backend.el (erc-split-line): Fold the lines
according to octet length, not the number of characters (bug#23047).
---
lisp/erc/erc-backend.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 7eec56e..814ecfa 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -466,14 +466,18 @@ If this is set to nil, never try to reconnect."
The length is specified in `erc-split-line-length'.
Currently this is called by `erc-send-input'."
- (if (< (length longline)
- erc-split-line-length)
- (list longline)
+ (let ((charset (car (erc-coding-system-for-target nil))))
(with-temp-buffer
(insert longline)
+ ;; The line lengths are in octets, not characters (because these
+ ;; are server protocol limits), so we have to first make the
+ ;; text into bytes, then fold the bytes on "word" boundaries,
+ ;; and then make the bytes into text again.
+ (encode-coding-region (point-min) (point-max) charset)
(let ((fill-column erc-split-line-length))
(fill-region (point-min) (point-max)
nil t))
+ (decode-coding-region (point-min) (point-max) charset)
(split-string (buffer-string) "\n"))))
(defun erc-forward-word ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master cad2b8d: Compute erc line lengths correctly for utf-8 (etc.),
Lars Ingebrigtsen <=