neil-lindquist / lisp-paredit

Paredit for Atom
MIT License
24 stars 5 forks source link

Enter key not working #15

Open yochannah opened 8 years ago

yochannah commented 8 years ago

For reasons I can't explain, lisp-paredit won't respond to the enter key. The enter key works fine outside Atom or with lisp-paredit disabled.

The tricky bit: I have no idea how to reproduce this bug.

Atom version 1.4.0 (highest available through my package manager at the moment)
Ubuntu 14.04.3 LTS Lisp-paredit 0.5.2

jonspalding commented 8 years ago

A few questions: Does it not respond at all or is it an intermittent problem? Did it start happening today or beforehand? Are there any errors in the console (View -> Developer -> Toggle Developer Tools) after it occurs?

yochannah commented 8 years ago

Wow, thanks for the fast response! It doesn't respond at all, anywhere in the document. It started happening last week, round about Thursday 21st Jan.

Nothing at all appears in the console when I intentionally trigger the error.

yochannah commented 8 years ago

ok, I have figured it out! The package itself was enabled, but in the lisp-paredit settings, somehow the "Enabled " had become unchecked. A colleague of mine was able to reproduce the same behaviour.

image

jonspalding commented 8 years ago

Is it only lisp documents affected?

One thing you can do is turn on the keybinding resolver (Cmd-. on Mac, probably Ctrl-. on linux) then hit enter. Do you see the lisp-paredit:newline command at the top? Something like this keybinds.

jonspalding commented 8 years ago

Ok thanks, sounds like a bug in the enable toggle.

indigo0086 commented 8 years ago

I was able to resolve by going to settings > core > Packages with Keymaps Disabled > *removed lisp-paredit. Thsi got me the indentation back correctly.

screen shot 2016-04-16 at 9 01 31 pm
naartjie commented 8 years ago

What is the status on this one? I am also having this issue. I can't find the Packages With Keymaps Disabled option in Atom 1.7.4 settings any more - has it been removed?

Adrien79 commented 7 years ago

I have a problem similar to the above when editing a .lisp file:

In both cases, the key binding resolver shows "lisp-paredit-newline" in green when I press the Enter key.

On a regular (non Lisp) file, the Enter key works normally and the key binding resolver shows "editor:newline" (same behaviour with lisp-paredit toggled on or off).

gibranrosa commented 7 years ago

@Adrien79 I have the same problem, did you find a solution?

Edit: For the record, I found the solution in my case, so simple... In case you are using Windows too, just alter the line ending to CRLF! 😆

Thanks

eskemojoe007 commented 5 years ago

I was having a similar issue on windows. Where | is the cursor location.

(do something
  something)|

Pressing enter while using CRLF results in:

(do something
  something)|
; NEW LINE CREATED with no indent, but cursor remains upper line

And the cursor doesn't move. Changing to LF endings works much better resulting in

(do something
  something)
|

Inside the () works well in either mode.

uUJsd7PX commented 5 years ago

Same problem on windows. Looks like line ending issue. Also, probably the same issue, the delete key does not work in that situation at the end of the line.

neil-lindquist commented 4 years ago

The issue describes my the newer comments relates to assumptions about line endings in the underlying paredit.js library. Specifically, in the indentRange function. Changing the split regex to /\r\n|[\n\v\f\r\x85\u2028\u2029]/ partially helps, but there are still some indexing issues that I haven't figured out yet.

Relatedly, the delete key issue comes from trying to delete a single character, but needing to delete a pair of characters.