0

The are various known bugs with the fill-column indicator, there is one well known bug that occurs when the window is too narrow for the window.

Causing a column of $ to show on the right hand side of the window.

Since this has been broken for a while. Is it possible to simply disable fci-mode when the window is too narrow to display it?

example of the problem

  • Why not ask the forum to fix the bug, instead of working around the bug? I realize you will get a few comments and up-vote comment by people who will suggest that you contact the maintainer, but I don't think there is anything wrong with taking matters into your own hands and asking for help if needed (especially when the maintainer is too busy). – lawlist Dec 5 '16 at 4:36
  • Also, the link you provided describes a desire to use fci with truncate-lines set to nil. However, there is much discussion in the thread that convolutes the issue. Please consider describing in your own words what you believe the bug to be, and how to reproduce the bug reliably. You state that the bug occurs when the window is too narrow; however, it is unclear whether you are causing that behavior because you have truncate-lines set to nil. The thread you linked has no screenshot. Please consider adding a screenshot so we can all see what the bug looks like in action. – lawlist Dec 5 '16 at 4:44
  • They are aware of the bug - so asking to fix something thats already reported isn't helping. Also the linked bug was wrong as you notice, (similar but not the same), linked to the correct bug now. Added image showing the problem. – ideasman42 Dec 5 '16 at 5:05
  • Sorry for off topic, but can you tell me the font name in the screenshots ? – stackunderflow Dec 5 '16 at 11:17
  • 1
    Since it is just a workaround that you seek, have a look at the first five (5) hooks set forth in the variable fci-hook-assignments. The functions that are attached to those hooks can be modified (at the very outset of each function) to turn off fci mode when the (window-width) is less than or equal to the fill-column; otherwise, if not, then check to see if fci is on and if not turn it on, and if on, then do what it normally does. This will help you when you are in the fci buffer. You'll need a similar solution that walks windows or buffers when you are not in the fci buffer. – lawlist Dec 5 '16 at 15:23
1

Here's a workaround that displays fci when its needed.

Note that while it takes horizontal scroll into account, I couldn't find a hook to run when horizontal scrolling changes.

if fci-rule-column isn't set it uses the value for fill-column.

(defvar i42/fci-mode-suppressed nil)
(make-variable-buffer-local 'i42/fci-mode-suppressed)

(defun fci-width-workaround (frame)
  (let ((fci-enabled (symbol-value 'fci-mode))
        (fci-column (if fci-rule-column fci-rule-column fill-column))
        (current-window-list (window-list frame 'no-minibuf)))
    (dolist (window current-window-list)
      (with-selected-window window
        (if i42/fci-mode-suppressed
            (when (and (eq fci-enabled nil)
                       (< fci-column
                          (+ (window-width) (window-hscroll))))
              (setq i42/fci-mode-suppressed nil)
              (turn-on-fci-mode))
          ;; i42/fci-mode-suppressed == nil
          (when (and fci-enabled fci-column
                     (>= fci-column
                         (+ (window-width) (window-hscroll))))
            (setq i42/fci-mode-suppressed t)
            (turn-off-fci-mode)))))))
(add-hook 'window-size-change-functions 'fci-width-workaround)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.