Merge from emacs-26

150bdfe43a Handle completely undecoded input in term (Bug#29918)
021f32cca1 * doc/misc/forms.texi (Control File Format): Fix a doc error.
76538d09b7 Fix typo in package-alist docstring
b2fde4b5e8 * doc/lispref/text.texi (Mode-Specific Indent): Fix a typo...
7e62778548 ; Another minor change in 'bidi-display-reordering's doc s...
4455ddbe56 Improve doc string of 'bidi-display-reordering'
34ee26dd93 Add warning to bidi-display-reordering doc string

# Conflicts:
#	lisp/term.el
#	test/lisp/term-tests.el
This commit is contained in:
Noam Postavsky 2019-07-20 22:02:36 -04:00
commit 6490269bec
6 changed files with 33 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -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