diff options
author | Daniele Nicolodi <daniele@grinta.net> | 2016-01-08 23:44:23 +0100 |
---|---|---|
committer | Daniele Nicolodi <daniele@grinta.net> | 2016-01-08 23:44:23 +0100 |
commit | 9cb5bc0f4aa4f3e3d97aba5255d66f0c1b89d387 (patch) | |
tree | 08e7efb25eebf1d07dfd3ad436a788613af968c4 /lisp | |
parent | 0c448cde2f02e7ae2e59a049c206136cb83484e7 (diff) | |
download | fork-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.el | 10 |
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." |