use position-bytes function to get the byte offset

The position-bytes function is the correct way to get byte offset for an
UTF-8 encoded source file. Probably, it still won't work for UTF-16 and
UTF-32, but at least it fixes the UTF-8.
This commit is contained in:
Sergei Nosov 2014-08-11 12:18:39 +04:00
parent 043b32357d
commit a7679c7003
1 changed files with 3 additions and 2 deletions

View File

@ -23,8 +23,9 @@
(require 'auto-complete) (require 'auto-complete)
(require 'rx) (require 'rx)
(require 'yasnippet) (require 'yasnippet nil t)
(require 'eshell) (require 'eshell)
(defcustom ac-dcd-executable (defcustom ac-dcd-executable
"dcd-client" "dcd-client"
"Location of dcd-client executable." "Location of dcd-client executable."
@ -167,7 +168,7 @@ If you want to restart server, use `ac-dcd-init-server' instead."
(defsubst ac-dcd-cursor-position () (defsubst ac-dcd-cursor-position ()
"Get cursor position to pass to dcd-client. "Get cursor position to pass to dcd-client.
TODO: multi byte character support" TODO: multi byte character support"
(point)) (position-bytes (point)))
(defsubst ac-dcd-build-complete-args (pos) (defsubst ac-dcd-build-complete-args (pos)
(list (list