[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 5127bfd 20/68: ace-window.el (aw-generic): finalize improv

From: Oleh Krehel
Subject: [elpa] master 5127bfd 20/68: ace-window.el (aw-generic): finalize improve for hscroll
Date: Sat, 21 Mar 2015 19:06:53 +0000

branch: master
commit 5127bfdaaed4e4fc30654cf5e5e78c2044585cb3
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ace-window.el (aw-generic): finalize improve for hscroll
    * ace-window.el (aw-offset): New function.
    The issue with top left part of the window being after the newline,
    i.e. it can't be written to without modifying the buffer, is fixed
    by displaying the jump character on the next available line.
    Fixes #11.
 ace-window.el |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/ace-window.el b/ace-window.el
index 26f7d51..a9e2001 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -152,8 +152,8 @@ HANDLER is a function that takes a window argument."
                                    (with-current-buffer b
                                      (insert " "))))
-                                :offset (+ (window-start 
(aj-visual-area-window va))
-                                           (window-hscroll 
(aj-visual-area-window va)))
+                                :offset
+                                (aw-offset (aj-visual-area-window va))
                                 :visual-area va))
                 ;; create background for each visual area
@@ -281,6 +281,23 @@ Windows are numbered top down, left to right."
              (get-buffer-window (current-buffer))
+(defun aw-offset (window)
+  "Return point in WINDOW that's closest to top left corner.
+The point is writable, i.e. it's not part of space after newline."
+  (let ((h (window-hscroll window))
+        (beg (window-start window))
+        (end (window-end window)))
+    (with-current-buffer
+        (window-buffer window)
+      (save-excursion
+        (goto-char beg)
+        (while (and (< (point) end)
+                    (< (- (line-end-position)
+                          (line-beginning-position))
+                       h))
+          (forward-line))
+        (+ (point) h)))))
 (provide 'ace-window)
 ;;; ace-window.el ends here

reply via email to

[Prev in Thread] Current Thread [Next in Thread]