Skip to content

Commit

Permalink
corrected bug with caret placement
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentpetit committed Jan 9, 2010
1 parent ce40099 commit 2d1a740
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions ccw.core/src/ccw/editors/antlrbased/PareditAutoEditStrategy.clj
Expand Up @@ -20,12 +20,16 @@

(defn -customizeDocumentCommand
[#^IAutoEditStrategy this, #^IDocument document, #^DocumentCommand command]
(when (.doit command)
(if (and (= 0 (.length command))
(when (and (.doit command)
(= 0 (.length command))
(contains? *one-char-command* (.text command)))
(let [result (paredit (get *one-char-command* (.text command)) {:text (.get document) :offset (.offset command) :length 0})]
#_(println "result:" result)
(set! (.offset command) 0)
(set! (.length command) (.length (.get document)))
(set! (.text command) (:text result))
(set! (.caretOffset command) (:offset result))))))
(let [result (paredit (get *one-char-command* (.text command))
{:text (.get document)
:offset (.offset command)
:length 0})]
(println "result:" result)
(set! (.offset command) 0)
(set! (.length command) (.length (.get document)))
(set! (.text command) (:text result))
(set! (.shiftsCaret command) false)
(set! (.caretOffset command) (:offset result)))))

0 comments on commit 2d1a740

Please sign in to comment.