[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 836f46c976 1/3: company--posn-col-row: fix wron
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company 836f46c976 1/3: company--posn-col-row: fix wrong col value with RTL direction |
Date: |
Fri, 30 Jun 2023 21:57:29 -0400 (EDT) |
branch: externals/company
commit 836f46c976251315f9e583679a6edb0ea2bc423e
Author: Mahmoud Nagy <mnagy1312@tutanota.com>
Commit: Mahmoud Nagy <mnagy1312@tutanota.com>
company--posn-col-row: fix wrong col value with RTL direction
`posn-col-row` return value relative to the left, which make the overlay
appears
in completely wrong position when using a RTL language and
`bidi-paragraph-direction` set no nil or forcing right-to-left.
---
company.el | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/company.el b/company.el
index bcbe3a5057..e8075a3145 100644
--- a/company.el
+++ b/company.el
@@ -1061,6 +1061,10 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
(row (cdr (or (posn-actual-col-row posn)
;; When position is non-visible for some reason.
(posn-col-row posn)))))
+ ;; posn-col-row return value relative to the left
+ (when (eq (current-bidi-paragraph-direction) 'right-to-left)
+ (let ((ww (window-body-width)))
+ (setq col (- ww col))))
(when (bound-and-true-p display-line-numbers)
(cl-decf col (+ 2 (line-number-display-width))))
(cons (+ col (window-hscroll)) row)))