Skip to content

Commit

Permalink
feat: right padding for truncated line by symbols count (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
Artawower committed Mar 1, 2024
1 parent 5c44952 commit 39077eb
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions blamer.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
;; Author: Artur Yaroshenko <[email protected]>
;; URL: https://github.com/artawower/blamer.el
;; Package-Requires: ((emacs "27.1") (posframe "1.1.7") (async "1.9.8"))
;; Version: 0.8.4
;; Version: 0.8.5

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -197,7 +197,7 @@ This feature required Emacs built with `imagemagick'"
(defcustom blamer-avatar-size 96
"Size of avatar."
:group 'blamer
:type 'int)
:type 'integer)

(defcustom blamer-avatar-ratio '(3 . 3)
"Image ration for avatar."
Expand All @@ -207,7 +207,7 @@ This feature required Emacs built with `imagemagick'"
(defcustom blamer-avatar-cache-time 604800
"Time in seconds to cache avatar. Default value is 1 week."
:group 'blamer
:type 'int)
:type 'integer)

(defcustom blamer-avatar-folder "~/.blamer/avatars/"
"Folder for avatars."
Expand Down Expand Up @@ -317,6 +317,13 @@ author name by left click and copying commit hash by right click.
(const :tag "Info about author" blamer-tooltip-author-info)
(const :tag "No tooltip" nil)))

(defcustom blamer-symbol-count-before-new-line 0
"The number of characters before the end of the line.
May be useful in some cases where the accuser unexpectedly
moves to the next line."
:group 'blamer
:type 'integer)

(defvar blamer-idle-timer nil
"Current timer before commit info showing.")

Expand Down Expand Up @@ -694,8 +701,11 @@ Works only for github right now."

(defun blamer--maybe-normalize-truncated-line (text)
"Disable line break for truncated line by truncated TEXT for available width."

(if (and (not truncate-lines) blamer-force-truncate-long-line)
(truncate-string-to-width text (- (blamer--get-available-width-before-window-end) (blamer--get-line-number-column-width)))
(truncate-string-to-width text (- (blamer--get-available-width-before-window-end)
(blamer--get-line-number-column-width)
blamer-symbol-count-before-new-line))
text))

(defun blamer--create-popup-msg (commit-info)
Expand Down

0 comments on commit 39077eb

Please sign in to comment.