Skip to content

Commit

Permalink
Custom width offset for summary lines
Browse files Browse the repository at this point in the history
New variable `deft-width-offset` defaults to 1 in console mode
and 0 in graphical mode.  It may be used if for some reason the
default calculation results in line wrap.  Setting this to a
positve value decreases the summary line width by that amount.

Closes jrblevinGH-16.
  • Loading branch information
jrblevin committed Apr 21, 2016
1 parent 2538204 commit 84eab30
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions deft.el
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,14 @@ Available methods are 'mtime and 'title.")
(defvar deft-default-extension (copy-sequence (car deft-extensions))
"Default file extension of newly created files.")

(defvar deft-width-offset (if (display-graphic-p) 0 1)
"Number of characters of width to trim relative to `window-width`.
Defaults to 1 in console mode and 0 in graphical mode. This
variable may be changed if for some reason the default
calculation results in line wrap in the Deft browser window.
Setting this to a positive value decreases the summary line width
by that amount.")

;; Keymap definition

(defvar deft-mode-map
Expand Down Expand Up @@ -1055,8 +1063,7 @@ call the original string-width otherwise"
(mtime (when deft-time-format
(format-time-string deft-time-format (deft-file-mtime file))))
(mtime-width (deft-string-width mtime))
(line-width (- deft-window-width mtime-width
(if (display-graphic-p) 0 1)))
(line-width (- deft-window-width mtime-width deft-width-offset))
(title-width (min line-width (deft-string-width title)))
(summary-width (min (deft-string-width summary)
(- line-width
Expand Down

0 comments on commit 84eab30

Please sign in to comment.