Commit 41ffda74 authored by Per Cederqvist's avatar Per Cederqvist

Merge branch 'bidi-isolate' into 'master'

Isolate bidi directionality changes to a single text.

See merge request !15
parents d4f71395 4ab6ce3b
2020-09-04 Per Cederqvist <ceder@lysator.liu.se>
Isolate bidi directionality changes to a single text.
* view-text.el (lyskom-print-text): Insert a paragraph separator
if the bidi directionality was changed by the text.
2020-08-17 Per Cederqvist <ceder@lysator.liu.se>
Emacs 27.1 compatibility.
......
......@@ -882,7 +882,8 @@ Mark the text as read if (and only if) MARK-AS-READ is non-nil.
Args: TEXT-STAT TEXT MARK-AS-READ TEXT-NO FLAT-REVIEW."
(let* ((lyskom-current-function 'lyskom-print-text)
(cti (lyskom-get-aux-item (text-stat->aux-items text-stat) 1))
(content-type (and cti (aux-item->data (car cti)))))
(content-type (and cti (aux-item->data (car cti))))
(bidi-at-start (current-bidi-paragraph-direction)))
(cond
((or (null text)
(null text-stat))
......@@ -1011,6 +1012,23 @@ Args: TEXT-STAT TEXT MARK-AS-READ TEXT-NO FLAT-REVIEW."
(when kom-highlight-dashed-lines
`(face ,(or kom-dashed-lines-face
lyskom-default-dashed-lines-face)))))))
;; If the last paragraph of the text has a different bidi
;; direction than the default bidi direction in this buffer,
;; insert a newline so that the rest of the buffer will get
;; its direction from the prompt.
;;
;; Perhaps it would be more correct to always insert a newline
;; before the text and after the text, so that the text always
;; has a bidi direction that is independent from the bidi
;; direction of the prompts, headers and footers, but that
;; would be too large a departure from the classical layout of
;; a LysKOM buffer. If there were an invisible way to specify
;; a paragraph break at those positions, that would be nice.
;; For now, we live with this workaround.
(unless (eq (current-bidi-paragraph-direction) bidi-at-start)
(insert "\n"))
(if mark-as-read
(lyskom-mark-as-read text-stat))
(setq lyskom-previous-text lyskom-current-text)
......
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