diff --git a/idris-commands.el b/idris-commands.el index f7cb915f..00fb1525 100644 --- a/idris-commands.el +++ b/idris-commands.el @@ -229,15 +229,27 @@ A prefix argument forces loading but only up to the current line." for h in hs do (pcase h (`(((:filename ,fn) - (:start ,start-line ,start-col) - (:end ,end-line ,end-col)) + (:start ,start-line-raw ,start-col-raw) + (:end ,end-line-raw ,end-col-raw)) ,props) (when (string= (file-name-nondirectory fn) (file-name-nondirectory (buffer-file-name))) - (idris-highlight-input-region (current-buffer) + (let ((start-line (if (>=-protocol-version 2 1) + (+ 1 start-line-raw) + start-line-raw)) + (start-col (if (>=-protocol-version 2 1) + (+ 1 start-col-raw) + start-col-raw)) + (end-line (if (>=-protocol-version 2 1) + (+ 1 end-line-raw) + end-line-raw )) + (end-col (if (>= idris-protocol-version 2 1) + (+ 1 end-col-raw) + end-col-raw ))) + (idris-highlight-input-region (current-buffer) start-line start-col end-line end-col - props)))))) + props))))))) (_ (idris-make-clean) (idris-update-options-cache) diff --git a/idris-highlight-input.el b/idris-highlight-input.el index 56f46a62..396ff202 100644 --- a/idris-highlight-input.el +++ b/idris-highlight-input.el @@ -60,14 +60,14 @@ See Info node `(elisp)Overlay Properties' to understand how ARGS are used." (widen) (if (or (> end-line start-line) (and (= end-line start-line) - (>= end-col start-col))) + (> end-col start-col))) (with-current-buffer buffer (save-excursion (goto-char (point-min)) (let* ((start-pos (+ (line-beginning-position start-line) (idris-highlight-column start-col))) (end-pos (+ (line-beginning-position end-line) - (idris-highlight-column (+ 1 end-col)))) + (idris-highlight-column end-col))) (highlight-overlay (make-overlay start-pos end-pos (get-buffer buffer)))) (overlay-put highlight-overlay 'idris-source-highlight t) diff --git a/inferior-idris.el b/inferior-idris.el index ac818c2e..4e70d57a 100644 --- a/inferior-idris.el +++ b/inferior-idris.el @@ -67,11 +67,18 @@ "The Idris connection.") (defvar idris-protocol-version 0 "The protocol version") +(defvar idris-protocol-version-minor 0 "The protocol minor version") + +(defun >=-protocol-version (major minor) + (or (> idris-protocol-version major) + (and (>= idris-protocol-version major) + (>= idris-protocol-version-minor minor)))) (defun idris-version-hook-function (event) (pcase event - (`(:protocol-version ,version ,_target) + (`(:protocol-version ,version ,minor) (setf idris-protocol-version version) + (setf idris-protocol-version-minor minor) (remove-hook 'idris-event-hooks 'idris-version-hook-function) t)))