Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
RegGuheert opened this issue May 12, 2016 · 3 comments

Comments

@RegGuheert
Copy link

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.

@mfikes
Copy link
Member

mfikes commented May 12, 2016

@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).

@RegGuheert
Copy link
Author

RegGuheert commented May 12, 2016

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

@paultopia
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants