1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-06-05 01:09:17 +02:00

- fixed position of cursor when expanding abbreviations.

This commit is contained in:
cage
2021-08-28 15:07:02 +02:00
parent e763158a8b
commit 0f2ac76c13

View File

@@ -32,7 +32,7 @@
(in-package :modules) (in-package :modules)
(defparameter *expand-abbrev-rewriting-rules* '(("^\\!g" "gemini://")) (defparameter *expand-abbrev-rewriting-rules* '(("^!g" "gemini://"))
"Before displaying messages that module will rewrites the first "Before displaying messages that module will rewrites the first
element of each item (a regular expression) of this list with the second element of each item (a regular expression) of this list with the second
@@ -69,14 +69,20 @@ So the whole list is like: '((\"foo\" \"bar\") (\"old\" \"new\") ...)")
(progn (progn
(setf *expand-abbrev-stop-rewrite* t) (setf *expand-abbrev-stop-rewrite* t)
(setf expanded (subseq expanded 1))) (setf expanded (subseq expanded 1)))
(loop for expansion in *expand-abbrev-actual-rewriting-rules* (loop for expansion in *expand-abbrev-actual-rewriting-rules* do
when (scan (expand-abbrev-abbrev-re expansion) expanded) (let ((start (scan (expand-abbrev-abbrev-re expansion) expanded)))
do (when start
(setf expanded (regex-replace (expand-abbrev-abbrev-re expansion) (setf expanded (regex-replace (expand-abbrev-abbrev-re expansion)
expanded expanded
(expand-abbrev-abbrev-replace expansion))))) (expand-abbrev-abbrev-replace expansion)))
(setf (command-window:command-line command-window) expanded) (point-tracker:move-point command-window
(point-tracker:move-point-to-end command-window expanded))) start
(length expanded))
(point-tracker:move-point-right command-window
(length expanded)
:offset
(length (expand-abbrev-abbrev-replace expansion)))))))
(setf (command-window:command-line command-window) expanded)))
command-window) command-window)
(defun expand-abbrev-command-fire-hook (x) (defun expand-abbrev-command-fire-hook (x)