[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/add-vdiff e8834fa 035/258: Fix fold size calcs
From: |
Justin Burkett |
Subject: |
[elpa] scratch/add-vdiff e8834fa 035/258: Fix fold size calcs |
Date: |
Wed, 17 May 2017 08:13:18 -0400 (EDT) |
branch: scratch/add-vdiff
commit e8834fa797e01d7755b21b7b2bd7103963afaf52
Author: justbur <address@hidden>
Commit: justbur <address@hidden>
Fix fold size calcs
* Add vdiff-min-fold-size to set the minimum number of lines to fold
Correct calculations of when to fold and how long folds are
---
vdiff.el | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/vdiff.el b/vdiff.el
index 6eb9da4..7d59abe 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -133,6 +133,11 @@ the buffer here, because those are handled differently."
:group 'vdiff
:type 'integer)
+(defcustom vdiff-min-fold-size 4
+ "Minimum number of lines to fold"
+ :group 'vdiff
+ :type 'integer)
+
(defcustom vdiff-fold-format-string "+ %s --- %s lines "
"Format string for text on closed folds. First element is the
code on the first line being covered. The second is the number of
@@ -377,7 +382,7 @@ lines hidden."
(ovr (make-overlay fold-start fold-end))
(text (format vdiff-fold-format-string
summ-text
- (1+ (- end-line beg-line))))
+ (- end-line beg-line)))
(text
(propertize
(concat text
@@ -392,9 +397,10 @@ lines hidden."
ovr)))
(defun vdiff--add-folds (a-buffer b-buffer a-range b-range)
+ ;; Ranges include padding
(when (and (> (1+ (- (cdr a-range) (car a-range)))
- (* 2 vdiff-fold-padding))
- (> (- (cdr a-range) (car a-range)) 2))
+ (+ (* 2 vdiff-fold-padding)
+ vdiff-min-fold-size)))
(let ((a-fold (vdiff--make-fold a-buffer a-range))
(b-fold (vdiff--make-fold b-buffer b-range)))
(overlay-put a-fold 'display (overlay-get a-fold 'vdiff-fold-text))
- [elpa] scratch/add-vdiff 72c20a5 010/258: Add gitignore, (continued)
- [elpa] scratch/add-vdiff 72c20a5 010/258: Add gitignore, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 016518f 016/258: Fix folds at end of buffer, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 10b7760 018/258: Add faces, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 952440e 002/258: Initial commit, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 245850f 028/258: Load cl-lib for using its function, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 988c476 027/258: Add new defcustoms to README, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff b77efe3 008/258: Add README and improve docstrings, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff ce10994 003/258: Introduce defcustoms and use lists instead of .., Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff ad6035d 015/258: Implement folding of unchanged lines, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff af75c6d 036/258: Add vdiff-exit, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff e8834fa 035/258: Fix fold size calcs,
Justin Burkett <=
- [elpa] scratch/add-vdiff 9547850 041/258: Use diff faces from theme, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff bac92b3 037/258: Improve line translation and command mirroring, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 6b6f6e7 044/258: Force fold refresh on window size change, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff e005d43 058/258: Delete overlays right away on sending changes, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 1cf0730 055/258: Fix compiler warnings, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 697bb79 060/258: Prefer last element of multiple in line map, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 3207365 064/258: Satisfy compiler, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 8b6cb54 218/258: vdiff-magit: Port resolve, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 617265b 238/258: vdiff-magit: Remove unused magit-ediff code, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 6f89757 231/258: vdiff-magit: Resurrect resolve, Justin Burkett, 2017/05/17