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

Truncation of lines does not seem to work in all cases #48

Open
ax487 opened this issue Jun 9, 2023 · 9 comments
Open

Truncation of lines does not seem to work in all cases #48

ax487 opened this issue Jun 9, 2023 · 9 comments

Comments

@ax487
Copy link
Contributor

ax487 commented Jun 9, 2023

I am experiencing an issue where the blamer message is stretching across two lines:

example

This is despite the fat that lines are supposed to be truncated.

I would like blamer to be as unobtrusive as possible, so this is somewhat unfortunate: If I move the cursor between lines, the actual lines jump around, which is a little distracting.

Is this intended behavior? I would rather have the blaming information disappear entirely, since I can always use magit if I really need it (for the most part it is not essential).

Edit: This looks a bit like an off-by-one error with respect to the width:

example
example_2

Maybe some symbol is not accounted for when the length is calculated? If I subtract one from the calculated width, everything looks fine again:

(defun blamer--maybe-normalize-truncated-line (text)
  "Disable line break for truncated line by truncated TEXT for available width."
  (if (and (not truncate-lines) blamer-force-truncate-long-line)
      (truncate-string-to-width text (- (blamer--get-available-width-before-window-end) (blamer--get-line-number-column-width) 1))
    text))
@Artawower
Copy link
Owner

Hello, this is completely unexpected behaviour. Can you try removing the pencil icon from the template? Has the behaviour remained the same?

Also, can you try checking this behaviour with the emacs -q command?

@ax487
Copy link
Contributor Author

ax487 commented Jun 14, 2023

This may be a problem with my setup, it works correctly with a plain emacs -Q

next_example

@Artawower
Copy link
Owner

It is very difficult to say what caused this problem in this case. So far, the only solution I can see is debugging with bisect. If we find a package which causes the width to change, we can try to include it in the width calculation.

@ax487
Copy link
Contributor Author

ax487 commented Jun 25, 2023

As far as I have seen, this only occurs when using emacs in daemon-mode...

@Artawower
Copy link
Owner

this is strange. Are the environment variables the same in daemon mode?
But in fact the string should not carry over in any case

@ax487
Copy link
Contributor Author

ax487 commented Jun 27, 2023

Edit: Removing the pencil seems to have done the trick. I was reading about the problems and recalled your suggestion.

@Artawower
Copy link
Owner

I think the link leads to the wrong place 😅 Anyway, glad it helped!

BTW, it's really cool update of all-the-icons

@suetanvil
Copy link

I'm seeing this issue on version 0.8.2:

image

Emacs version: "GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0)
of 2023-08-16, modified by Debian"

I tried replacing the bullet(?) character in blamer-commit-formatter with a / (as seen in the screenshot) based on my suspicion that you're running afoul of some kind of Unicode issue, but it didn't help in my case.

(It's annoying but still usable; I generally only turn it on when I need the information anyway.)

@Artawower
Copy link
Owner

Artawower commented Mar 1, 2024

This bug is a big headache. As I said above, we need to determine which package/configuration is affecting the line break.... possibly through some sort of bisect to disable packets.

As a temporary solution, I might suggest adding a special offset from the end of the line.
If you have 1 character as a line break, you can set (setq blamer-symbol-count-before-new-line 1) for example. (Make sure you are using version 0.8.5)

You can also try setting a special face height for blamer. Here is part of my personal config

(use-package blamer
  ; ...
  :custom-face
  (blamer-face ((t :inherit font-lock-comment-face
                   :italic t
                   :font "Fira Code 14"
                   :height 0.9
                   :background unspecified))))
  ; ....

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

No branches or pull requests

3 participants