mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-15 15:00:24 -08:00
catch errors related to input from string
This commit is contained in:
parent
1d2d9af9a1
commit
5e69bd4acd
1 changed files with 15 additions and 10 deletions
|
|
@ -470,16 +470,20 @@
|
|||
(set-is-dirty t))))
|
||||
(set-on-event-with-data ace "clog-adjust-tabs"
|
||||
(lambda (obj data)
|
||||
; (declare (ignore obj))
|
||||
(declare (ignore obj))
|
||||
(unless (equal data "")
|
||||
(setf data (format nil "~A;" data))
|
||||
(let ((o (clog-ace:selected-text ace))
|
||||
(r (make-array '(0) :element-type 'base-char
|
||||
:fill-pointer 0 :adjustable t)))
|
||||
(with-output-to-string (s r)
|
||||
(with-input-from-string (n data)
|
||||
(let ((*standard-output* s))
|
||||
(indentify:indentify n))))
|
||||
(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)
|
||||
|
|
@ -487,8 +491,9 @@
|
|||
(return))
|
||||
(setf r (subseq r end))))
|
||||
(setf r (subseq r 0 (ppcre:scan "\\S" r)))
|
||||
(setf o (subseq o (ppcre:scan "\\S" o) (length o)))
|
||||
(setf r (format nil "~A~A" r o))
|
||||
(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)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue