summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorDaniele Nicolodi <daniele@grinta.net>2016-01-08 23:44:23 +0100
committerDaniele Nicolodi <daniele@grinta.net>2016-01-08 23:44:23 +0100
commit9cb5bc0f4aa4f3e3d97aba5255d66f0c1b89d387 (patch)
tree08e7efb25eebf1d07dfd3ad436a788613af968c4 /lisp
parent0c448cde2f02e7ae2e59a049c206136cb83484e7 (diff)
downloadfork-ledger-9cb5bc0f4aa4f3e3d97aba5255d66f0c1b89d387.tar.gz
fork-ledger-9cb5bc0f4aa4f3e3d97aba5255d66f0c1b89d387.tar.bz2
fork-ledger-9cb5bc0f4aa4f3e3d97aba5255d66f0c1b89d387.zip
Fix highlight of the transaction under point
When a transaction is being added the previous one is highlighted. Solve the problem checking that the highlighted region contains the point.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-xact.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/ledger-xact.el b/lisp/ledger-xact.el
index dad5ff5b..795df86a 100644
--- a/lisp/ledger-xact.el
+++ b/lisp/ledger-xact.el
@@ -57,10 +57,12 @@
(setq ledger-xact-highlight-overlay (ledger-highlight-make-overlay)))
(let ((exts (ledger-navigate-find-element-extents (point))))
(let ((b (car exts))
- (e (cadr exts)))
- (if (> (- e b) 1)
- (move-overlay ledger-xact-highlight-overlay b (+ 1 e))
- (move-overlay ledger-xact-highlight-overlay 1 1))))))
+ (e (cadr exts))
+ (p (point)))
+ (if (and (> (- e b) 1) ; not an empty line
+ (<= p e) (>= p b)) ; point is within the boundaries
+ (move-overlay ledger-xact-highlight-overlay b (+ 1 e))
+ (move-overlay ledger-xact-highlight-overlay 1 1))))))
(defun ledger-xact-payee ()
"Return the payee of the transaction containing point or nil."