Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Minor fix for the patch truncate style #280

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

Merged
merged 4 commits into from
Dec 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions dashboard-widgets.el
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ WIDGET-PARAMS are passed to the \"widget-create\" function."
(len-total (- dashboard-path-max-length len-rep))
front)
(if (<= len-path dashboard-path-max-length) path
(setq front (substring path (- len-path len-total) len-path))
(concat dashboard-path-shorten-string front))))
(setq front (ignore-errors (substring path (- len-path len-total) len-path)))
(if front (concat dashboard-path-shorten-string front) ""))))

(defun dashboard-shorten-path-middle (path)
"Shorten PATH from middle if exceeding maximum length."
Expand All @@ -682,17 +682,18 @@ WIDGET-PARAMS are passed to the \"widget-create\" function."
back front)
(if (<= len-path dashboard-path-max-length) path
(setq back (substring path 0 end-back)
front (substring path start-front len-path))
(concat back dashboard-path-shorten-string front))))
front (ignore-errors (substring path start-front len-path)))
(if front (concat back dashboard-path-shorten-string front) ""))))

(defun dashboard-shorten-path-end (path)
"Shorten PATH from end if exceeding maximum length."
(let* ((len-path (length path)) (len-rep (length dashboard-path-shorten-string))
(len-total (- dashboard-path-max-length len-rep))
back)
(if (<= len-path dashboard-path-max-length) path
(setq back (substring path 0 len-total))
(concat back dashboard-path-shorten-string))))
(setq back (ignore-errors (substring path 0 len-total)))
(if (and back (< 0 dashboard-path-max-length))
(concat back dashboard-path-shorten-string) ""))))

(defun dashboard-shorten-path (path)
"Shorten the PATH."
Expand Down