Make HungryBackspace plugin not too hungry

How can I make the HungryBackspace plugin not too hungry? For me, it
should not eat up all whitespace before the caret, just the
whitespace until the line start. Do you have the source code
available, so I can change it myself?

Thanks,
Tom

6 comments
Comment actions Permalink

Hello,

I was thinking about making this change myself.

If caret is after the indent column, then caret will move to the indent column.

If caret is already at the indent column, then the caret will move to the previous line.

A similar situation happens


Currently, if you hit HungryBackspace, it will produce


I am looking to change it to:


For your case (^ is the indent column)


Currently, Hitting HungryBackspace would produce


But it would be better if it did this:


If you press HungryBackspace with the caret column less than the indent column, then it would move to previous line like now.

-Alex

0
Comment actions Permalink

How about both versions?

That is, the really hungry version that erases all white space and the less hungry version, but allow both to be assignable through the keymap.

0
Comment actions Permalink

zmbs wrote:

How about both versions?

That is, the really hungry version that erases all white space and the less hungry version, but allow both to be assignable through the keymap.


Or make it configurable, please.

/kesh

0
Comment actions Permalink

Definately, I'll keep the current hungry version in addition to whatever less hungry version that is added.

0
Comment actions Permalink

Does anyone have code to get the current indent level on a line?

I can't figure out how to that. I looked in CodeStyleManager, Editor, PsiUtil classes and don't see any methods that would get the indent level.

It might require traversing the Psi tree to get the indent level.

I know of a real kludgy workaround which involves
moving the caret to column 0 and then calling EditorLineStart handler which will move the caret to the indent column for you, and then you can query the caret
column again to find out the indent level.

Hmm.. I'm gonna try that, but it is really kludgy.

-Alex

0
Comment actions Permalink

Also, I've really become used to bacspace removing both
quotes/parenthesis/brackets/etc. when one of them is removed.

This two missing features made me
uninstall it..


0

Please sign in to leave a comment.