sideline
sideline copied to clipboard
sideline wrapping lines
Hey, I think it may be some problem with my configuration, but sideline looks like that for me:
something causes it to wrap last char; is there a way to fix this?
It should have been resolved long time ago. 🤔 Is this related to #18?
Uhh, so overflow-newline-into-fringe is t for me. If I print what's going on in sideline--align-right it looks like this:
[/p]: offset => 0
[/p]: (and graphic-p (> (nth 1 fringes) 0) (not overflow-newline-into-fringe)) => nil
[/p]: graphic-p => t
[/p]: (= 0 (nth 1 fringes)) => nil ;; right fringe is enabled
so offset is zero, first if returns 0, and second if also returns 0. So I don't get any additional offset and it wraps a single char on the next line. I guess something else is enabled that eats in the space? :(
I recommend you try it in emacs -q (a clean environment). If everything seems to be working, then try minimizing your configuration. 🤔 Maybe there is a bug due to recent changes, or other plugins are conflicting with the sideline.
Hello, I get this issue too. And I have a minimal reproduce init.el and reproduce it by emacs -Q -l reproduce.el:
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(setq-default use-package-always-ensure t)
(use-package marginalia
:hook
(vertico-mode . marginalia-mode)
)
(use-package vertico
:config
(vertico-mode)
(setq vertico-grid-annotate 10)
(setq vertico-multiform-commands
'(
(execute-extended-command grid)
)
)
(vertico-multiform-mode))
(use-package flycheck
;; :bind
;; (:prefix "C-c !" :prefix-map flycheck-keymap-prefix)
:custom
(flycheck-disabled-checkers '(
rust
rust-cargo
lsp
python-flake8
python-pycompile
python-pyright
python-mypy
;; rust-clippy
emac-lisp-checkdoc))
(flycheck-set-indication-mode 'left-fringe)
;; :custom-face
;; (flycheck-info ((t (:underline ))))
;; (flycheck-warning ((t (:underline nil))))
;; (flycheck-error-list-highlight ((t (:background "midnight blue"))))
:init
(setq-default
flycheck-display-errors-delay 0.1
flycheck-mode-line-prefix "Fly"
flycheck-display-errors-function nil ;;#'flycheck-display-error-messages-unless-error-list
flycheck-idle-change-delay 0.5
flycheck-idle-buffer-switch-delay 1.0
flycheck-checker-error-threshold 100
flycheck-rust-executable nil; "cargo-clippy"
flycheck-rust-clippy-executable
"cargo-clippy"
;; "~/soft/matrix_wan_exec/cargo"
flycheck-rust-args nil; '("--profile" "rust-analyzer")
flycheck-relevant-error-other-file-show nil
)
(setq-default flycheck-enable-flycheck t)
(defun exec/flycheck-mode()
(when (buffer-local-value 'flycheck-enable-flycheck (current-buffer))
(flycheck-mode)))
:hook
(prog-mode . exec/flycheck-mode)
:config
(defun exec/flycheck-toggle-default()
(interactive)
(if flycheck-enable-flycheck
(setq-default flycheck-enable-flycheck nil)
(setq-default flycheck-enable-flycheck t)))
;; flycheck err cycle
;; Optional: ensure flycheck cycles, both when going backward and forward.
;; Tries to handle arguments correctly.
;; Since flycheck-previous-error is written in terms of flycheck-next-error,
;; advising the latter is enough.
(defun flycheck-next-error-loop-advice (orig-fun &optional n reset)
; (message "flycheck-next-error called with args %S %S" n reset)
(condition-case err
(apply orig-fun (list n reset))
((user-error)
(let ((error-count (length flycheck-current-errors)))
(if (and
(> error-count 0) ; There are errors so we can cycle.
(equal
(error-message-string err) "No more Flycheck errors"))
;; We need to cycle.
(let*
((req-n
(if (numberp n)
n
1)) ; Requested displacement.
; An universal argument is taken as reset, so shouldn't fail.
(curr-pos
(if (> req-n 0)
(- error-count 1)
0)) ; 0-indexed.
(next-pos (mod (+ curr-pos req-n) error-count))) ; next-pos must be 1-indexed
; (message "error-count %S; req-n %S; curr-pos %S; next-pos %S" error-count req-n curr-pos next-pos)
; orig-fun is flycheck-next-error (but without advise)
; Argument to flycheck-next-error must be 1-based.
(apply orig-fun (list (+ 1 next-pos) 'reset)))
(signal (car err) (cdr err)))))))
(advice-add
'flycheck-next-error
:around #'flycheck-next-error-loop-advice)
;; (add-to-list 'global-mode-string 'flycheck-mode-line)
;; (defun exec/header-line-hook()
;; (add-to-list 'header-line-format
;; flycheck-mode-line t)
;; )
;; (add-hook 'breadcrumb-local-mode-hook 'exec/header-line-hook)
(defun exec/flycheck-status-line()
(format "%s"
(buffer-local-value
'flycheck-last-status-change
(current-buffer)
)
)
(concat
(propertize " Flycheck"
'face '(:foreground "white" :background "tan4"))
(propertize
(format (if (bound-and-true-p flycheck-mode)
(format "%s" flycheck-last-status-change) " off "))
'face '(:foreground "white" :background "gray40")))
)
(add-to-list 'header-line-format '(:eval (exec/flycheck-status-line)) t)
(use-package flycheck-posframe
:disabled
:hook (flycheck-mode . flycheck-posframe-mode)
:custom-face
(flycheck-posframe-face
((t (:family "HarmonyOS Sans" :height 0.8 :inherit nil))))
(flycheck-posframe-border-face
((t (:inherit flycheck-posframe-face))))
(flycheck-posframe-background-face
((t (:inherit flycheck-posframe-face))))
:config
(setq-default
flycheck-posframe-position 'window-top-right-corner
flycheck-posframe-border-use-error-face t
flycheck-posframe-border-width 1
flycheck-posframe-info-prefix "💬 "
flycheck-posframe-warning-prefix "⚠️ "
flycheck-posframe-error-prefix "❌ "))
)
(use-package sideline
:hook
(after-init . global-sideline-mode)
:init
(setq sideline-backends-left-skip-current-line t ; don't display on current line (left)
sideline-backends-right-skip-current-line t ; don't display on current line (right)
sideline-order-left 'up ; 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 10 ; overlays' priority
sideline-display-backend-name nil
sideline-force-display-if-exceeds t
sideline-backends-left nil
sideline-backends-right '(sideline-flycheck)
)
:custom-face
(sideline-flycheck-success ((t
(
:family "JetBrainsMono Nerd Font"
:weight normal
:background "green"
:foreground "black"
:height 1.0
))))
(sideline-flycheck-warning ((t
(
:family "JetBrainsMono Nerd Font"
:weight normal
:background "orange"
:foreground "black"
:height 1.0
))))
(sideline-flycheck-error ((t
(
:family "JetBrainsMono Nerd Font"
:weight normal
:background "dark red"
:foreground "yellow"
:height 1.0
))))
) ; display the backend name
(use-package sideline-flycheck
:after sideline
:hook
(flycheck-mode . sideline-flycheck-setup)
:init
(setq
sideline-flycheck-max-lines 100
sideline-flycheck-show-checker-name nil
sideline-flycheck-display-mode 'point
)
:config
)
and the rust file: (put cursor in the empty line, below of the fn fib line , above of the end } line)
// snippet of code @ 2024-12-19 21:34:06
// === Rust Playground ===
// This snippet is in: ~/Projects/github.com/eval-exec/emacs-rust-playground/RP-2024-12-19-21_34_06/
// Execute the snippet: C-c C-c
// Delete the snippet completely: C-c k
// Toggle between main.rs and Cargo.toml: C-c b
fn main() {
println!("Results:")
}
fn fib(n: usize) -> usize {
}
Sorry, the reproduce config file is too long, but it can realy reporduce it by emacs -Q -l reproduce.el
Hello, I get this issue too. And I have a minimal reproduce init.el and reproduce it by
emacs -Q -l reproduce.el:
I think you have this issue due to (setq sideline-force-display-if-exceeds t). That's off by default. 🤔
Hello, I get this issue too. And I have a minimal reproduce init.el and reproduce it by
emacs -Q -l reproduce.el:I think you have this issue due to
(setq sideline-force-display-if-exceeds t). That's off by default. 🤔
After I set it to nil, the issue still exist.
,I thinks the issue is related to "the overlay in the tail of the {":
There are too flycheck's overlay: one after the {, another is above the }:
When I move cursor to the line above }:
the overlay behind { moved:
(It think sideline-mode put its overlay between the { and the "flycheck's overlay", cause line wrap)
On my side, it pushes the overlay down to the next line but doesn't affect the sideline's display. 🤔
Could you retry after shutdown the lsp server?
Could you retry after shutdown the lsp server?
Nothing has changed. Same result. 🤔
I do trace-function to sideline--align-right
It seems that sideline printed a \n newline char on the right?
======================================================================
1 -> (sideline--align-right #("consider returning the local binding `n`: `\n n\n`" 0 51 (face sideline-flycheck-success)) 0)
1 <- sideline--align-right: (660)
I'm getting this bogus wrapping sometimes also.
E.g. In my tty emacsclient, say I have a full width window showing a sideline message nicely. Then if I split-window-right, when my cursor is in the left hand window the sideline message wraps, but in the right hand window the sideline message displays fine. (Even if I make the left window a little larger than the right window).
This is one of the most problematic bugs for the sideline since anything that influences the window width calculation can cause this bug (either left/right offset). What I can do is guess, but there are just too many factors, and it is almost impossible for me to find the issue.
Here is what I recommend the user to do:
- First try emacs -q (clean run)
- Toggle on or off minor modes that could cause this display error
- Comment out the sector(s) of your configuration and see what is affecting this behavior
Good luck. 🥲
Is there an easy way to just add a single char offset as a safety buffer?
Is there an easy way to just add a single char offset as a safety buffer?
Unfortunately, no. I still encourage users to report bugs, as I aim to cover as many use cases as possible.
That said, you can override the sideline--align-right function.
This may be another version of the same bug.
I have whitespace-mode with
(newline-mark ?\n [?$ ?\n]) ; eol - dollar sign
So it inserts a $ before the newline character.
With whitespace-mode on, I get
If I toggle it off, this changes to what I expect,
FYI, this may be relevant to the whitespace-mode problem, which lsp-ui deals with specifically
https://github.com/emacs-lsp/lsp-ui/blob/09d40806429fadc01a12d9a1841b49430f58adb5/lsp-ui-sideline.el#L354