howl-editor / howl

The Howl Editor
http://howl.io
Other
712 stars 68 forks source link

Auto pairs don't always work #59

Closed refi64 closed 9 years ago

refi64 commented 9 years ago

Sometimes, entering the first character in an auto pair correctly adds the other one afterwards. Other times, it simply doesn't work.

I know that's not much info, but I don't know what other info would be wanted, so I decided to post this first.

nilnor commented 9 years ago

As you say there's not much to go on - some example would be needed. Also note that there are cases when auto pairs are by design not inserted, I can't say whether this is the case here of course, but the spec shows some examples of this. The logic for determining whether to insert auto pairs or not can be improved, but the cases I've found are additional cases where I would not want the auto pairs inserted, and so would hardly help given your description. I'm closing this for now as there's not anything I can look at without more information, but please reopen if you can find a concrete example of it going wrong.

refi64 commented 9 years ago

@nilnor It's hard. All I know is this:

  1. Run howl x.coffee.
  2. Type something f( in the buffer.

About 10% of the time, the right parenthesis appears when the left one is entered. Other times, it won't.

It's also one-for-all: if that first right parenthesis does not appear, the auto-pairs never again work in that session. If the right parenthesis does appear, then it will continue working.

Also: I have no button to reopen... :O

nilnor commented 9 years ago

Sounds like it's easy for you to reproduce though? It fails at around 90% of the time? I can't reproduce this at all I'm afraid, and have never seen this before. If you start Howl from the console, is there something being logged when this happens? Is it only with Coffeescript?

refi64 commented 9 years ago

@nilnor

  1. Nothing is logged.
  2. It happens with every lexer I've tried: C, CoffeeScript, Python, Ruby, Clojure, etc. I picked CoffeeScript because it was the language I was using at the moment.
nilnor commented 9 years ago

Since I've never seen this myself, I suspect that it could also be due to some local configuration on your side. At any rate, I can't troubleshoot when I can't reproduce, so you will have to do some investigating on your side. I suggest starting up without your init file and see if the problem persists. If not, there's something there that causes this which would help narrow it down. Apart from that some carefully placed prints here and there should help you narrow it down. Good places for these printouts would be auto_pair.handle() and if it turns out not to be called at all Editor._on_keypress.

refi64 commented 9 years ago

60