emacs-sideline / sideline

Show information on the side
GNU General Public License v3.0
118 stars 14 forks source link

Compatibility issue with diff-hl #10

Closed ginqi7 closed 1 year ago

ginqi7 commented 1 year ago

I meet a strange issue, when using diff-hl and sideline together.

When both diff-hl and sideline are displayed on the same empty line, the sideline content will occupy two virtual lines. There are tree conditions:

  1. Both diff-hl-mode and sideline-mode are enabled.
  2. diff-hl-mode fringe and sideline-mode overlay are displayed on a same line.
  3. the line is empty. (If there are non-empty strings on the line, it's not a problem.)

The sideline content overlay will word-wrap to two virtual lines.

without diff-hl:

SCR-20230407-ugmf

with diff-hl:

image
jcs090218 commented 1 year ago

Hmm.. I am not able to reproduce this. Can you to provide more information? Maybe try emacs -q.

ginqi7 commented 1 year ago
image

I try to use minimal configuration like:

(require 'diff-hl)
(require 'sideline)
(require 'sideline-eldoc)
(global-diff-hl-mode)
(setq sideline-backends-skip-current-line t ; don't display on current line
      sideline-order-left 'down             ; or 'up
      sideline-order-right 'up              ; or 'down
      sideline-format-left "%s   "          ; format for left aligment
      sideline-format-right "%s"     ; format for right aligment
      sideline-priority 100             ; overlays' priority
      sideline-display-backend-name nil)
(add-hook 'emacs-lisp-mode-hook #'sideline-mode)
(defun my-backend-async (command)
  "Example async backend."
  (cl-case command
    (`candidates
     (cons :async
           (lambda (callback &rest _)
             (funcall callback '("info 1" "info 2" "info 3")))))))
(setq sideline-backends-right '(my-backend-async)) ; use `sideline-backends-right' for right alignment
(setq sideline-backends-left nil) ; use `sideline-backends-right' for right alignment

My environment is :

  1. MacOS M1
  2. emacs 30
  3. sideline and diff-hl use latest commit

sideline: 2fa3e671 diff-hl: 67ce270

jcs090218 commented 1 year ago

Thanks for the minimal configuration! However, I'm still not able to reproduce this bug... I'm on Windows with Emacs 29.0.60. Maybe something new with Emacs 30? 🤔 Can you try other Emacs versions to see if it occurs?

2023-04-08 10 52 53

ginqi7 commented 1 year ago

It needs that diff-hl-mode fringe and sideline-mode overlay are displayed on a same empty line.

So you could try to create a file in a git project, and commit it, and modify a empty line.

make sure a diff-hl-mode fringe shows on left and sideline overlay display on right.

image
jcs090218 commented 1 year ago

Thanks! It's fixed in #11. Can you test to see if it works? :)

ginqi7 commented 1 year ago

Thank you for your quick response. It's fixed.