Fuco1 / indicators.el

Display the buffer relative location of line in the fringe.
43 stars 5 forks source link

Problems with relative indicator (scroll bar) #6

Closed mrcnski closed 6 months ago

mrcnski commented 6 years ago

I'm using the indicator from the readme to show the current position in a buffer.

It generally works pretty well but messes up when the point is at the end of a buffer. The indicator no longer shows the position in the buffer accurately and sometimes (I can't reproduce this consistently) I am not able to scroll the buffer away from the point.

Let me know if I can provide any more info (can take a screencast if you'd find it helpful). Thanks!

Fuco1 commented 6 years ago

The problem is that emacs can only show things on the side of existing lines in the buffer. When you get to the end of the buffer the "empty space" after the last line is not addressable so the indicator jumps around to some possible position (where it ends up is quite random at the moment).

There's no easy fix currently as this is pretty much baked in into Emacs's display engine.

mrcnski commented 6 years ago

Thanks for the quick response! Hmm, is it possible for indicators to be disabled in this situation?

mrcnski commented 6 years ago

And is it possible to at least fix the scrolling issue? When I'm at the end of a buffer I (sometimes) can't scroll away unless I move the point up first, which is a bit annoying. I just doublechecked and confirmed that this is caused by indicators-mode.

Fuco1 commented 6 years ago

What Emacs version are you using? I've been using this for quite some time with flycheck and it never happened to me that I couldn't scroll. Also, what exactly do you mean by scrolling?

Can you paste your config?

mrcnski commented 6 years ago

Hey, sorry for the delayed answer. Emacs version:

GNU Emacs 26.1 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511)) of 2018-05-31

Also, what exactly do you mean by scrolling?

I like to scroll using (scroll-down-line 6) (bound to a hotkey, of course). Sometimes when the point is at the end of a buffer, scrolling gets "stuck" and I can't scroll away.

Can you paste your config

;; Add indicators for position in buffer and end of buffer.
;; Only load this for graphical displays (i.e. not the terminal).
(when (display-graphic-p)
  (use-package indicators
    :diminish indicators-mode
    :hook ((prog-mode . new-indicators)
           (conf-mode . new-indicators)
           (text-mode . new-indicators)
           )
    :config
    (defun new-indicators ()
      "Create new indicators in the current buffer."
      (interactive)

      ;; ;; show an arrow at the end of buffer using the default fringe face
      ;; (ind-create-indicator 'point-max
      ;;                       :managed t
      ;;                       :relative nil
      ;;                       :fringe 'left-fringe
      ;;                       :bitmap 'right-arrow
      ;;                       :face 'fringe)

      ;; show relative position in the file (a.k.a. scroll bar)
      (ind-create-indicator 'point :managed t)
      )
    )
  )

My full config is here: https://github.com/m-cat/init.el