mirror of
https://github.com/m00natic/vlfi.git
synced 2025-02-24 05:48:06 +00:00
Use overlays for number indicators.
This commit is contained in:
parent
641ff4b961
commit
1dcd12288b
42
vlfi.el
42
vlfi.el
@ -560,7 +560,7 @@ The same for mouse EVENT."
|
|||||||
(switch-to-buffer (window-buffer (posn-window (event-end event))))
|
(switch-to-buffer (window-buffer (posn-window (event-end event))))
|
||||||
(goto-char (posn-point (event-end event))))
|
(goto-char (posn-point (event-end event))))
|
||||||
(let* ((pos (point))
|
(let* ((pos (point))
|
||||||
(pos-relative (- pos (line-beginning-position)))
|
(pos-relative (- pos (line-beginning-position) 1))
|
||||||
(file (get-char-property pos 'file)))
|
(file (get-char-property pos 'file)))
|
||||||
(if file
|
(if file
|
||||||
(let ((chunk-start (get-char-property pos 'chunk-start))
|
(let ((chunk-start (get-char-property pos 'chunk-start))
|
||||||
@ -568,9 +568,7 @@ The same for mouse EVENT."
|
|||||||
(buffer (get-char-property pos 'buffer))
|
(buffer (get-char-property pos 'buffer))
|
||||||
(match-pos (or (get-char-property pos 'match-pos)
|
(match-pos (or (get-char-property pos 'match-pos)
|
||||||
(+ (get-char-property pos 'line-pos)
|
(+ (get-char-property pos 'line-pos)
|
||||||
(if (< 8 pos-relative)
|
pos-relative))))
|
||||||
(- pos-relative 8)
|
|
||||||
0)))))
|
|
||||||
(unless (buffer-live-p buffer)
|
(unless (buffer-live-p buffer)
|
||||||
(let ((occur-buffer (current-buffer)))
|
(let ((occur-buffer (current-buffer)))
|
||||||
(setq buffer (vlfi file))
|
(setq buffer (vlfi file))
|
||||||
@ -630,26 +628,24 @@ The same for mouse EVENT."
|
|||||||
line-pos (line-end-position))))
|
line-pos (line-end-position))))
|
||||||
(with-current-buffer occur-buffer
|
(with-current-buffer occur-buffer
|
||||||
(unless (= line last-match-line)
|
(unless (= line last-match-line)
|
||||||
(insert (propertize
|
(insert "\n:")
|
||||||
(format "%7d:" line)
|
(let* ((overlay-pos (1- (point)))
|
||||||
'file file
|
(overlay (make-overlay
|
||||||
'buffer vlfi-buffer
|
overlay-pos
|
||||||
'chunk-start chunk-start
|
(1+ overlay-pos))))
|
||||||
'chunk-end chunk-end
|
(overlay-put overlay 'before-string
|
||||||
'face 'shadow
|
(propertize
|
||||||
'mouse-face '(highlight)
|
(number-to-string line)
|
||||||
'line-pos line-pos))
|
'face 'shadow)))
|
||||||
(insert (propertize
|
(insert (propertize line-text
|
||||||
(format "%s\n" line-text)
|
'file file
|
||||||
'file file
|
'buffer vlfi-buffer
|
||||||
'buffer vlfi-buffer
|
'chunk-start chunk-start
|
||||||
'chunk-start chunk-start
|
'chunk-end chunk-end
|
||||||
'chunk-end chunk-end
|
'mouse-face '(highlight)
|
||||||
'mouse-face '(highlight)
|
'line-pos line-pos)))
|
||||||
'line-pos line-pos)))
|
|
||||||
(forward-line -1)
|
|
||||||
(let ((line-start (+ (line-beginning-position)
|
(let ((line-start (+ (line-beginning-position)
|
||||||
8))
|
1))
|
||||||
(match-pos (match-beginning 10)))
|
(match-pos (match-beginning 10)))
|
||||||
(add-text-properties
|
(add-text-properties
|
||||||
(+ line-start match-pos (- last-line-pos))
|
(+ line-start match-pos (- last-line-pos))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user