From 72bcfebf952f25e35da4a3c94b09444a343f945c Mon Sep 17 00:00:00 2001 From: Artur Date: Fri, 1 Mar 2024 23:00:18 +0300 Subject: [PATCH] feat: right padding for truncated line by symbols count (#48) --- blamer.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/blamer.el b/blamer.el index 2a319a5..253e7bf 100644 --- a/blamer.el +++ b/blamer.el @@ -5,7 +5,7 @@ ;; Author: Artur Yaroshenko ;; 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 @@ -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." @@ -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." @@ -317,6 +317,12 @@ 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.") @@ -694,8 +700,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)