[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8f93cba324e: Fix truncation of long lines in compilation buffers
From: |
Eli Zaretskii |
Subject: |
master 8f93cba324e: Fix truncation of long lines in compilation buffers |
Date: |
Sun, 7 Apr 2024 05:09:59 -0400 (EDT) |
branch: master
commit 8f93cba324e4d4022a9422b8c56186213ba2de8d
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix truncation of long lines in compilation buffers
* lisp/progmodes/compile.el
(compilation--insert-abbreviated-line): Handle long lines that end
in a newline. (Bug#70236)
---
lisp/progmodes/compile.el | 41 +++++++++++++++++++++++------------------
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 11d400e145a..d7690b7fa74 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2644,24 +2644,29 @@ and runs `compilation-filter-hook'."
(text-properties-at (1- beg))))
(insert string)
;; If we exceeded the limit, hide the last portion of the line.
- (when (> (current-column) width)
- (let ((start (save-excursion
- (move-to-column width)
- (point))))
- (buttonize-region
- start (point)
- (lambda (start)
- (let ((inhibit-read-only t))
- (remove-text-properties start (save-excursion
- (goto-char start)
- (line-end-position))
- (text-properties-at start)))))
- (put-text-property
- start (if (= (aref string (1- (length string))) ?\n)
- ;; Don't hide the final newline.
- (1- (point))
- (point))
- 'display (if (char-displayable-p ?…) "[…]" "[...]"))))))
+ (let* ((ends-in-nl (= (aref string (1- (length string))) ?\n))
+ (curcol (if ends-in-nl
+ (progn (backward-char) (current-column))
+ (current-column))))
+ (when (> curcol width)
+ (let ((start (save-excursion
+ (move-to-column width)
+ (point))))
+ (buttonize-region
+ start (point)
+ (lambda (start)
+ (let ((inhibit-read-only t))
+ (remove-text-properties start (save-excursion
+ (goto-char start)
+ (line-end-position))
+ (text-properties-at start)))))
+ (put-text-property
+ start (if ends-in-nl
+ ;; Don't hide the final newline.
+ (1- (point))
+ (point))
+ 'display (if (char-displayable-p ?…) "[…]" "[...]"))))
+ (if ends-in-nl (forward-char)))))
(defsubst compilation-buffer-internal-p ()
"Test if inside a compilation buffer."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 8f93cba324e: Fix truncation of long lines in compilation buffers,
Eli Zaretskii <=