use tabbify on all ace windows

This commit is contained in:
David Botton 2024-04-25 11:49:59 -04:00
parent 85c5a7bab1
commit 831723175b
2 changed files with 31 additions and 33 deletions

View file

@ -120,7 +120,37 @@
"Ctrl-t|Tab" "Ctrl-t|Tab"
"Ctrl-t") "Ctrl-t")
(jquery editor))) (jquery editor)))
;; eval form (set-on-event-with-data editor "clog-adjust-tabs"
(lambda (obj data)
(declare (ignore obj))
(unless (equal data "")
(setf data (format nil "~A;" data))
(let* ((o (clog-ace:selected-text editor))
(p (ppcre:scan "\\S" o))
(r (make-array '(0) :element-type 'base-char
:fill-pointer 0 :adjustable t)))
(handler-case
(with-output-to-string (s r)
(with-input-from-string (n data)
(let ((*standard-output* s))
(indentify:indentify n))))
(error ()
nil))
(loop
(multiple-value-bind (start end)
(ppcre:scan "(^.*)\\n" r)
(unless start
(return))
(setf r (subseq r end))))
(setf r (subseq r 0 (ppcre:scan "\\S" r)))
(when p
(setf o (subseq o (ppcre:scan "\\S" o) (length o)))
(setf r (format nil "~A~A" r o)))
(unless (or (eq r nil)
(equal r ""))
(js-execute editor (format nil "~A.insert('~A',true)"
(clog-ace::js-ace editor)
(escape-string r))))))))
(js-execute editor (js-execute editor
(format nil (format nil
"~A.commands.addCommand({ "~A.commands.addCommand({

View file

@ -489,38 +489,6 @@
(clog-ace::js-ace ace) (clog-ace::js-ace ace)
(escape-string r))) (escape-string r)))
(set-is-dirty t)))) (set-is-dirty t))))
(set-on-event-with-data ace "clog-adjust-tabs"
(lambda (obj data)
(declare (ignore obj))
(unless (equal data "")
(setf data (format nil "~A;" data))
(let* ((o (clog-ace:selected-text ace))
(p (ppcre:scan "\\S" o))
(r (make-array '(0) :element-type 'base-char
:fill-pointer 0 :adjustable t)))
(handler-case
(with-output-to-string (s r)
(with-input-from-string (n data)
(let ((*standard-output* s))
(indentify:indentify n))))
(error ()
nil))
(loop
(multiple-value-bind (start end)
(ppcre:scan "(^.*)\\n" r)
(unless start
(return))
(setf r (subseq r end))))
(setf r (subseq r 0 (ppcre:scan "\\S" r)))
(when p
(setf o (subseq o (ppcre:scan "\\S" o) (length o)))
(setf r (format nil "~A~A" r o)))
(unless (or (eq r nil)
(equal r ""))
(js-execute ace (format nil "~A.insert('~A',true)"
(clog-ace::js-ace ace)
(escape-string r)))
(set-is-dirty t))))))
(labels ((eval-form (obj) (labels ((eval-form (obj)
(let ((p (parse-integer (let ((p (parse-integer
(js-query obj (js-query obj