Author Topic: how to disable space between ( and asterisk  (Read 2201 times)

Chris Nisbet

  • Community Member
  • Posts: 26
  • Hero Points: 2
how to disable space between ( and asterisk
« on: December 15, 2015, 06:01:40 AM »
Hi
I'm trying to figure out how to configure SE so that it doesn't place a space after an opening parenthesis and an asterisk
e.g.
abc( *var);
If if replace *var with something else
e.g.
def(var);
no space is placed after the bracket, which is as desired (function/method calls->pad inside parenthesis is off).
This behaviour seems to be due to the spacing->expressions->unary operators->* dereference operator setting, which is currently set to "space before".
I have this set this way so that something like
a = sizeof *var;
puts a space between sizeof and *
If I set that setting to no spaces, the abc(*var) is fixed, but I also lose the space between the sizeof and *.
Is there any way I can configure things to get the best of both worlds? i.e. the function/method calls->pad inside parenthesis setting has precedence over the "* dereference operator" setting.
As usual, thanks in advance for any guidance.

I'm using: SlickEdit Pro 2014 (v19.0.2.5 32-bit)
I have beautify while typing enabled. I'm editing a C file if that makes any difference.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: how to disable space between ( and asterisk
« Reply #1 on: December 15, 2015, 03:59:19 PM »
    You can actually cheese this by going to the Unary Operators/* dereference operator setting, and unchecking the setting.  These settings are 3 state - on forces a space, off will remove a space (unless another rule takes precedence), and unchecked tells it to leave it as is in the source.  So this way, it won't eat the space after "sizeof" (which it should not do anyway), and the pad-parens setting will work as expected.  On the bad side, if you have something like "* bar", it's not going to clean up that space after the "*" either.

I'll try to address this in v21 - we should not be eating the space after sizeof, so that's a bug;  and you can make a good argument that pad-parens should take precedence over the unary/postfix space settings for the first and last arguments of a function call, but I'll need to see how that one effects our regression tests to see if it does anything unexpected.

Thanks for the report.

Chris Nisbet

  • Community Member
  • Posts: 26
  • Hero Points: 2
Re: how to disable space between ( and asterisk
« Reply #2 on: December 15, 2015, 04:46:32 PM »
Thanks. I'll try out your suggestion.

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: how to disable space between ( and asterisk
« Reply #3 on: December 18, 2015, 05:23:49 PM »
There are so many options in the beautifier that it can be pretty hard to figure out which ones to set.


The code-preview box in the settings window is too small, and this dialog isn't resizable.


Can you:
#1 Make this dialog non-modal and resizable.
#2 Instead of loading a file in the preview box, attach to a buffer and real-time update the buffer.
#3 Ditch the preview box entirely.
#4 Include a checkbox to toggle between original code view vs. code formatted with the current settings.
#5 Gee, maybe it should be a tool window :-)


Then, I can load my favorite source code, open the beautifier settings and watch my code update as I tweak the settings.
Since the dialog is non-modal, I can also scroll around as needed.


For the icing on the cake, add highlights in the buffer where the formatting was just changed.
For icing *AND* sprinkles on the cake, show a diffzilla like side-by-side with the original vs. reformatted code.