Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions diff-hl-show-hunk-inline.el
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ the hunk consist only on added lines, then
`diff-hl-show-hunk--no-lines-removed-message' it is shown."
:type 'boolean)

(defcustom diff-hl-show-hunk-inline-scroll-indicators '(" ⬆ " . " ⬇ ")
"Strings used to indicate hidden inline popup content.
The car is used for hidden content above the popup; the cdr is used for
hidden content below it. Each string includes any surrounding padding."
:type '(cons (string :tag "Above")
(string :tag "Below")))

(defun diff-hl-show-hunk-inline--splice (list offset length)
"Compute a sublist of LIST starting at OFFSET, of LENGTH."
(butlast
Expand Down Expand Up @@ -112,7 +119,11 @@ Compute it from LINES starting at INDEX with a WINDOW-SIZE."
(defun diff-hl-show-hunk-inline--compute-header (width &optional header)
"Compute the header of the popup.
Compute it from some WIDTH, and some optional HEADER text."
(let* ((scroll-indicator (if (eq diff-hl-show-hunk-inline--current-index 0) " " " ⬆ "))
(let* ((above-indicator (car diff-hl-show-hunk-inline-scroll-indicators))
(scroll-indicator
(if (eq diff-hl-show-hunk-inline--current-index 0)
(make-string (length above-indicator) ?\s)
above-indicator))
(header (or header ""))
(new-width (- width (length header) (length scroll-indicator)))
(header (if (< new-width 0) "" header))
Expand All @@ -125,11 +136,13 @@ Compute it from some WIDTH, and some optional HEADER text."
(defun diff-hl-show-hunk-inline--compute-footer (width &optional footer)
"Compute the header of the popup.
Compute it from some WIDTH, and some optional FOOTER text."
(let* ((scroll-indicator (if (>= diff-hl-show-hunk-inline--current-index
(- (length diff-hl-show-hunk-inline--current-lines)
diff-hl-show-hunk-inline--height))
" "
" ⬇ "))
(let* ((below-indicator (cdr diff-hl-show-hunk-inline-scroll-indicators))
(scroll-indicator
(if (>= diff-hl-show-hunk-inline--current-index
(- (length diff-hl-show-hunk-inline--current-lines)
diff-hl-show-hunk-inline--height))
(make-string (length below-indicator) ?\s)
below-indicator))
(footer (or footer ""))
(new-width (- width (length footer) (length scroll-indicator)))
(footer (if (< new-width 0) "" footer))
Expand Down
Loading