Hi, After some I found the culprit! The issue arises from org-do-emphasis-faces. The bug is caused by the line
(font-lock-prepend-text-property (match-beginning 2) (match-end 2) 'face face) which makes the surrounding "~"s part of the box, combined with (add-text-properties (match-end 4) (match-beginning 5) '(invisible org-link)) setting them invisible. This appears to confuse Emacs. Anything along the lines of (let ((num (if org-hide-emphasis-markers 4 2))) (font-lock-prepend-text-property (match-beginning num) (match-end num) 'face face)) should fix the issue. To demonstrate the behavior, I created a MWE function reproducing the bug. (defun mwe (start end) "Reproduce a weird fontification behaviour cutting off boxes." (interactive "r") (font-lock-prepend-text-property start end 'face '(:box (:line-width 3 :color "grey"))) (add-text-properties (1- end) end '(invisible org-link))) Hope that is helpful, D.