benma / visual-regexp.el

A regexp/replace command for Emacs with interactive visual feedback
396 stars 28 forks source link

All characters are matched when input is deleted #18

Closed syohex closed 10 years ago

syohex commented 10 years ago

I suppose it is better that nothing is matched if input string is empty.

screencast is here.

vr-regexp

benma commented 10 years ago

Thanks for the report.

This matching behavior with an empty input is consistent with Emacs' builtin regexp-replace command, and in my opinion, this is the right behavior too.

Why do you think that matching nothing would be better?

syohex commented 10 years ago

Why do you think that matching nothing would be better?

Its behavior is different from initial state.

This matching behavior with an empty input is consistent with Emacs' builtin regexp-replace command, and in my opinion, this is the right behavior too.

You are right. However vr/query-replace behaves like this, I suppose all characters should matched in initial state.

benma commented 10 years ago

The initial state is only different in the visualization of the matches during regexp input. As soon as you get to the "replace" prompt, the matches are shown.

This was a deliberate decision on my part. I think the user interface would suffer if half the buffer would be filled with visual overlays as soon as vr/replace is called, especially since the empy input is very rarely (maybe even never) the desired input.

syohex commented 10 years ago

I see.