diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index e73141faf4c..7ce54f59c69 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -2344,7 +2344,7 @@ Here is what it does: @itemize @item First, it checks whether Transient Mark mode is enabled and the region -is active. If so, it called @code{indent-region} to indent all the +is active. If so, it calls @code{indent-region} to indent all the text in the region (@pxref{Region Indent}). @item diff --git a/doc/misc/forms.texi b/doc/misc/forms.texi index d669ed6d038..9423f946091 100644 --- a/doc/misc/forms.texi +++ b/doc/misc/forms.texi @@ -431,7 +431,7 @@ file. Example: If the control file does not set @code{forms-format-list} a default format is used. In this situation, Forms mode will deduce the number of fields from the data file providing this file exists and -@code{forms-number-of-records} has not been set in the control file. +@code{forms-number-of-fields} has not been set in the control file. The control file can optionally set the following additional Forms mode variables. Most of them have default values that are good for most diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 9a350aadaca..53fa15d4199 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -547,8 +547,8 @@ name (a symbol) and DESC is a `package--bi-desc' structure.") (defvar package-alist nil "Alist of all packages available for activation. Each element has the form (PKG . DESCS), where PKG is a package -name (a symbol) and DESCS is a non-empty list of `package-desc' structure, -sorted by decreasing versions. +name (a symbol) and DESCS is a non-empty list of `package-desc' +structures, sorted by decreasing versions. This variable is set automatically by `package-load-descriptor', called via `package-initialize'. To change which packages are diff --git a/lisp/term.el b/lisp/term.el index dec8f5a3178..f3411044b25 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -2916,11 +2916,12 @@ See `term-prompt-regexp'." (when (= funny str-length) (let ((partial 0) (count (length decoded-substring))) - (while (eq (char-charset (aref decoded-substring - (- count 1 partial))) - 'eight-bit) + (while (and (< partial count) + (eq (char-charset (aref decoded-substring + (- count 1 partial))) + 'eight-bit)) (cl-incf partial)) - (when (> partial 0) + (when (> count partial 0) (setq term-terminal-undecoded-bytes (substring decoded-substring (- partial))) (setq decoded-substring diff --git a/src/buffer.c b/src/buffer.c index 209e29f0f19..ea785bbcd70 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5659,7 +5659,11 @@ This variable is never applied to a way of decoding a file while reading it. */ DEFVAR_PER_BUFFER ("bidi-display-reordering", &BVAR (current_buffer, bidi_display_reordering), Qnil, - doc: /* Non-nil means reorder bidirectional text for display in the visual order. */); + doc: /* Non-nil means reorder bidirectional text for display in the visual order. +Setting this to nil is intended for use in debugging the display code. +Don't set to nil in normal sessions, as that is not supported. +See also `bidi-paragraph-direction'; setting that non-nil might +speed up redisplay. */); DEFVAR_PER_BUFFER ("bidi-paragraph-start-re", &BVAR (current_buffer, bidi_paragraph_start_re), Qnil, diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el index 33ed006cf8b..5fca002f07c 100644 --- a/test/lisp/term-tests.el +++ b/test/lisp/term-tests.el @@ -305,6 +305,25 @@ This is a reduced example from GNU nano's initial screen." `("\e[1;3r" "\e[2;1H" ,x "\r\e[1A" ,y)) (concat y "\n" x))))) +(ert-deftest term-decode-partial () ;; Bug#25288. + "Test multibyte characters sent into multiple chunks." + ;; Set `locale-coding-system' so test will be deterministic. + (let* ((locale-coding-system 'utf-8-unix) + (string (make-string 7 ?ш)) + (bytes (encode-coding-string string locale-coding-system))) + (should (equal string + (term-test-screen-from-input + 40 1 `(,(substring bytes 0 (/ (length bytes) 2)) + ,(substring bytes (/ (length bytes) 2)))))))) +(ert-deftest term-undecodable-input () ;; Bug#29918. + "Undecodable bytes should be passed through without error." + (let* ((locale-coding-system 'utf-8-unix) ; As above. + (bytes "\376\340\360\370") + (string (decode-coding-string bytes locale-coding-system))) + (should (equal string + (term-test-screen-from-input + 40 1 bytes))))) + (provide 'term-tests) ;;; term-tests.el ends here