(cons (+ window-x window-start-x)
(+ window-y window-start-y))))
+(defun artist--adjust-x (x)
+ "Adjust the X position wrt. `display-line-numbers-mode'."
+ (let ((adjust (line-number-display-width)))
+ (if (= adjust 0)
+ x
+ (- x adjust 2))))
(defun artist-mouse-draw-continously (ev)
"Generic function for shapes that require 1 point as input.
(ev-start (event-start ev))
(initial-win (posn-window ev-start))
(ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start)))
- (x1 (car ev-start-pos))
+ (x1 (artist--adjust-x (car ev-start-pos)))
(y1 (cdr ev-start-pos))
(shape)
(timer))
(member 'down (event-modifiers ev)))
(setq ev-start-pos (artist-coord-win-to-buf
(posn-col-row (event-start ev))))
- (setq x1 (car ev-start-pos))
+ (setq x1 (artist--adjust-x (car ev-start-pos)))
(setq y1 (cdr ev-start-pos))
;; Cancel previous timer
(ev-start (event-start ev))
(initial-win (posn-window ev-start))
(ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start)))
- (x1-last (car ev-start-pos))
+ (x1-last (artist--adjust-x (car ev-start-pos)))
(y1-last (cdr ev-start-pos))
(x2 x1-last)
(y2 y1-last)
;;
(setq ev-start-pos (artist-coord-win-to-buf
(posn-col-row (event-start ev))))
- (setq x2 (car ev-start-pos))
+ (setq x2 (artist--adjust-x (car ev-start-pos)))
(setq y2 (cdr ev-start-pos))
;; Draw the new shape (if not rubber-banding, place both marks)
;; set x2 and y2
(setq ev-start-pos (artist-coord-win-to-buf
(posn-col-row (event-start ev))))
- (setq x2 (car ev-start-pos))
+ (setq x2 (artist--adjust-x (car ev-start-pos)))
(setq y2 (cdr ev-start-pos))
;; First undraw last shape
(arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol op))
(ev-start (event-start ev))
(ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start)))
- (x1 (car ev-start-pos))
+ (x1 (artist--adjust-x (car ev-start-pos)))
(y1 (cdr ev-start-pos)))
(select-window (posn-window ev-start))
(artist-funcall init-fn x1 y1)
(ev-start (event-start ev))
(initial-win (posn-window ev-start))
(ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start)))
- (x1 (car ev-start-pos))
+ (x1 (artist--adjust-x (car ev-start-pos)))
(y1 (cdr ev-start-pos))
(x2)
(y2)
(member 'down (event-modifiers ev)))
(setq ev-start-pos (artist-coord-win-to-buf
(posn-col-row (event-start ev))))
- (setq x2 (car ev-start-pos))
+ (setq x2 (artist--adjust-x (car ev-start-pos)))
(setq y2 (cdr ev-start-pos))
(if (not (eq initial-win (posn-window (event-start ev))))