Function: eglot-move-to-utf-16-linepos

eglot-move-to-utf-16-linepos is a byte-compiled function defined in eglot.el.gz.

Signature

(eglot-move-to-utf-16-linepos N)

Documentation

Move to line's Nth code unit as computed by LSP's UTF-16 criterion.

Aliases

eglot-move-to-lsp-abiding-column (obsolete since 29.1)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/eglot.el.gz
(defun eglot-move-to-utf-16-linepos (n)
  "Move to line's Nth code unit as computed by LSP's UTF-16 criterion."
  (let* ((bol (eglot--bol))
         (goal-char (+ bol n))
         (eol (line-end-position)))
    (goto-char bol)
    (while (and (< (point) goal-char) (< (point) eol))
      ;; code points in the "supplementary place" use two code units
      (when (<= #x010000 (char-after) #x10ffff) (setq goal-char (1- goal-char)))
      (forward-char 1))))