[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 45b6921 09/36: Updated print function
From: |
Alexey Veretennikov |
Subject: |
[elpa] master 45b6921 09/36: Updated print function |
Date: |
Wed, 27 Jan 2016 23:50:51 +0000 |
branch: master
commit 45b69211a9668bd7d41ec308e702b5c3b4842400
Author: Alexey Veretennikov <address@hidden>
Commit: Alexey Veretennikov <address@hidden>
Updated print function
---
ztree-view.el | 45 +++++++++++++++++++++++++--------------------
1 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/ztree-view.el b/ztree-view.el
index b165107..539c0ed 100644
--- a/ztree-view.el
+++ b/ztree-view.el
@@ -344,7 +344,7 @@ Optional argument FACE face to use to draw a character."
(goto-char (+ x (-(point) 1)))
(delete-char 1)
(insert-char c 1)
- (put-text-property (1- (point)) (point) 'face (if face face
'ztreep-arrow-face))))
+ (put-text-property (1- (point)) (point) 'font-lock-face (if face face
'ztreep-arrow-face))))
(defun ztree-vertical-line-char ()
"Return the character used to draw vertical line"
@@ -569,29 +569,34 @@ Writes a string with given DEPTH, prefixed with [ ] if
EXPANDABLE
and [-] or [+] depending on if it is EXPANDED from the specified OFFSET.
Optional argument FACE face to write text with."
(let ((node-sign #'(lambda (exp)
- (insert "[" (if exp "-" "+") "]")
- (set-text-properties (- (point) 3)
- (point)
- '(face ztreep-expand-sign-face)))))
- (move-to-column offset t)
+ (let ((sign (concat "[" (if exp "-" "+") "]")))
+ (insert (propertize sign
+ 'font-lock-face
+ ztreep-expand-sign-face)))))
+ ;; face to use. if FACE is not null, use it, otherwise
+ ;; deside from the node type
+ (entry-face (cond (face face)
+ (expandable 'ztreep-node-face)
+ (t ztreep-leaf-face))))
+ ;; move-to-column in contrast to insert reuses the last property
+ ;; so need to clear it
+ (let ((start-pos (point)))
+ (move-to-column offset t)
+ (remove-text-properties start-pos (point) '(font-lock-face nil)))
(delete-region (point) (line-end-position))
+ ;; every indentation level is 4 characters
(when (> depth 0)
(dotimes (i depth)
- (insert " ")
- (insert-char ?\s 3))) ; insert 3 spaces
+ (insert-char ?\s 4))) ; insert 4 spaces
(when (> (length short-name) 0)
- (if expandable
- (progn
- (funcall node-sign expanded) ; for expandable nodes insert
"[+/-]"
- (insert " ")
- (put-text-property 0 (length short-name)
- 'face (if face face 'ztreep-node-face)
short-name)
- (insert short-name))
- (progn
- (insert " ")
- (put-text-property 0 (length short-name)
- 'face (if face face 'ztreep-leaf-face) short-name)
- (insert short-name))))))
+ (let ((start-pos (point)))
+ (if expandable
+ (funcall node-sign expanded)) ; for expandable nodes insert
"[+/-]"
+ ;; indentation for leafs 4 spaces from the node name
+ (insert-char ?\s (- 4 (- (point) start-pos))))
+ (insert (propertize short-name 'font-lock-face entry-face)))))
+
+
(defun ztree-jump-side ()
"Jump to another side for 2-sided trees."
- [elpa] master updated (e7f3aa4 -> a136ff8), Alexey Veretennikov, 2016/01/27
- [elpa] master 4e112f8 04/36: Updated add-tree method, Alexey Veretennikov, 2016/01/27
- [elpa] master ac0834d 05/36: Updated readme: added information about contributing, Alexey Veretennikov, 2016/01/27
- [elpa] master 5603c70 02/36: Updated README to include new variable introduced in issue #23, Alexey Veretennikov, 2016/01/27
- [elpa] master c6c9257 01/36: Implemented issue #23: Add optional unicode tree drawing facility, Alexey Veretennikov, 2016/01/27
- [elpa] master c75719f 10/36: Replaced hardcoded diff with diff-command from diff.el, Alexey Veretennikov, 2016/01/27
- [elpa] master 418af99 08/36: Added face for ignored files, Alexey Veretennikov, 2016/01/27
- [elpa] master 45b6921 09/36: Updated print function,
Alexey Veretennikov <=
- [elpa] master 04b29c8 06/36: Updated readme, Alexey Veretennikov, 2016/01/27
- [elpa] master 67b9b4b 03/36: Issue #24: updated traverse function, Alexey Veretennikov, 2016/01/27
- [elpa] master 4a935ee 07/36: Reshuffled readme, Alexey Veretennikov, 2016/01/27
- [elpa] master 6018029 11/36: Started updating diff logic to include ignored files, Alexey Veretennikov, 2016/01/27
- [elpa] master c227ed8 12/36: Added debug output and some other changes, Alexey Veretennikov, 2016/01/27
- [elpa] master 64d3960 13/36: Added face for ignored files, Alexey Veretennikov, 2016/01/27
- [elpa] master 45dda44 14/36: Started updating diff logic to include ignored files, Alexey Veretennikov, 2016/01/27
- [elpa] master 2dc412f 15/36: Added debug output and some other changes, Alexey Veretennikov, 2016/01/27
- [elpa] master 9408ca1 17/36: Fixed ztree-node-is-visible, Alexey Veretennikov, 2016/01/27
- [elpa] master eea3c2b 19/36: added comments, Alexey Veretennikov, 2016/01/27