Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghost guide characters when changing indent size #70

Open
okomestudio opened this issue Dec 28, 2019 · 12 comments
Open

Ghost guide characters when changing indent size #70

okomestudio opened this issue Dec 28, 2019 · 12 comments
Labels

Comments

@okomestudio
Copy link

Say I have this code nicely highlighted with gray guides:

00

When I edit a line (one with <div class="page"> in this case), somehow the character guides get messed up and leave all those "ghost" guide characters (in black) that should not be there:

01

These ghost characters are not real in a sense that they aren't actually edited into the code itself (killing the buffer and reopening the file renders properly with the new indent size).

This happens when I use highlight-indent-guides with the web-mode hook, but it doesn't happen with my Python code (python-mode). Is this some compatibility issue mentioned in README or actually a bug?

@DarthFennec
Copy link
Owner

Sorry for the late reply, I could have sworn I had already responded to this. Yeah, I can reproduce it, and it only seems to happen in web-mode. There must be some compatibility issue, though not one I was previously aware of. I'll take a closer look at web-mode to see if I can tell what the problem might be.

@andreyorst
Copy link

this also happens to me in many lisp modes. Also when some indentation is corrected automatically, e.g. by parinfer or by indent-region

@jcs090218
Copy link
Collaborator

Any progress on this issue? It's quite annoying when this happens. And this indeed happens in many different major-modes.

@Cons-Cat
Copy link

This is probably the single most annoying issue that I've personally encountered using this package.

@DarthFennec
Copy link
Owner

It might be easier if I had more examples to cross-reference. I've only seen this in web-mode so far, what other modes does it happen in? I still haven't had time for a deep dive into web-mode, but if there's some clear connection between the modes this affects it might shed some light. Beyond that, I'm still planning on a detailed look at web-mode when I get time for it.

@jcs090218
Copy link
Collaborator

jcs090218 commented Dec 15, 2020

There are few cases I could reproduce this issue.

Case 1

This occurs when guides is trying to highlight the guides under dotimes operator (image on left). But once the indentation is mess up by deleting the spaces infront of if operator, then the guides seem to be confused? (image on right)

before after
align_before align_after

Case 2

If I try to delete the newline from beginning of line. There are guides left behind the previous line.

before after
del_b del_a

P.S. This is in emacs-lisp-mode

@DarthFennec
Copy link
Owner

@jcs090218 Hmm ... yeah neither of these things happen for me, can't reproduce. I'm definitely in emacs-lisp-mode. Perhaps you have a minor mode loaded that's interfering with the update mechanism, or something like that? It seems like font-lock isn't running properly for some reason.

@andreyorst
Copy link

also can't reproduce with this particular example, however this happens to me very often with Parinfer-rust-mode when the whole block of indentation is changed.

@andreyorst
Copy link

here's a minimal repro that works for me with emacs -q: highlight-indent-guides-#70.zip

$ cd highlight-indent-guides-#70
$ emacs -q -l repro-init.el bug.el

image
By deleting indentation with backspace one by one I get this result:

image

Here's a GIF:

simplescreenrecorder-2020-12-17_10 27 32

This is Emacs version: 27.1, and freshly installed highlight-indent-guides without anything else.

@plcplc
Copy link

plcplc commented Jul 19, 2022

I have this issue as well.

I see it most when I apply auto-formatting via lsp in haskell files.

@lapinskim
Copy link

In my case this bug is fixed in a particular buffer when I toggle the highlight-indent-guides-mode off and back on again. The issues no longer appears in this buffer.

highlight-indent-guides is loaded as follows:

(use-package highlight-indent-guides
  :ensure t
  :after modus-themes
  :custom
  (highlight-indent-guides-method 'character)
  (highlight-indent-guides-auto-character-face-perc 25)
  :hook
  ((prog-mode text-mode conf-mode) . highlight-indent-guides-mode))

@weitanism
Copy link

Here is my workaround based on @lapinskim's comment:

(use-package
 highlight-indent-guides
 :init
 (add-hook
  'prog-mode-hook
  (lambda ()
    ;; NOTE: Workaround to fix wired appearance after
    ;; reformatting. See
    ;; https://github.com/DarthFennec/highlight-indent-guides/issues/70#issuecomment-1342713343
    ;; for more information.
    (highlight-indent-guides-mode +1)
    (highlight-indent-guides-mode -1)
    (highlight-indent-guides-mode +1))))

NOTE: Only tested on Emacs 30.0.50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants