Commit 6490269b authored by Noam Postavsky's avatar Noam Postavsky

Merge from emacs-26

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

# Conflicts:
#	lisp/term.el
#	test/lisp/term-tests.el
parents f02b9e9a 150bdfe4
Pipeline #2506 passed with stage
in 54 minutes
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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,
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment