replete-ios icon indicating copy to clipboard operation
replete-ios copied to clipboard

Auto-square-brace makes it impossible to paste function with multiple arity

Open RegGuheert opened this issue 9 years ago • 3 comments

I've been using Replete together with "Clojure for the Brave and True" in order to learn Clojure on my iPad Air 2. All has gone well until I got to the point of trying to implement multiple-arity functions. The following example from here is where I am having some issues:

(defn x-chop
  "Describe the kind of chop you're inflicting on someone"
  ([name chop-type]
     (str "I " chop-type " chop " name "! Take that!"))
  ([name]
     (x-chop name "karate")))

When I paste this example into Replete, I get the following instead:

(defn x-chop
  "Describe the kind of chop you're inflicting on someone"
  ([name chop-type
     (str "I " chop-type " chop " name "! Take that!")])
  ([name
     (x-chop name "karate")]))

Once pasted, I find that I am completely unable to fix the position of both of the braces. I can fix one of the trailing braces, but if I fix the second one, the other one reverts to the incorrect position.

This problem does not occur if I simply type in the function definition directly. I suspect the difference has to do with how I move to the right of the square brace at the appropriate time. But the real issue seems to be the inability to fix the square brace position once it has been pasted into the entry field.

RegGuheert avatar May 12 '16 14:05 RegGuheert

@RegGuheert Thanks! That's interesting.

I can reproduce the problem. It appears to be caused by the lines after the binding forms being over far enough to the right, and you can work around the problem by, after pasting, placing your cursor before, say (str and tapping delete twice.

But, perhaps there is something Replete can do in this case. (Evidently Cursive handles it when in Parinfer mode).

mfikes avatar May 12 '16 14:05 mfikes

Thanks for the workaround! That will come in handy (due to the level of indentation used in the text).

RegGuheert avatar May 12 '16 15:05 RegGuheert

I noticed similar issues copy-pasting forms in---maybe the easiest solution is to include an option to turn off paredit/parinfer (not sure which is baked in) mode for a given input prompt?

paultopia avatar Jun 12 '16 19:06 paultopia