Author Topic: Change "." to "->&  (Read 1910 times)

ewendt

  • Community Member
  • Posts: 42
  • Hero Points: 2
Hello

Is it somehow possible to automatically convert a "." operator to a "->" operator editing C or C++, if it is clear that the variable to which the member may belong is a pointer?

Example:

struct { int a, b;} *s;
...
keystrokes:
s
s.
s->               // this is changed by SE during typing, because SE knows, that this is a pointer
s->a

This is a nice feature in QT editor and I would like to use it in SE.

Perhaps this is implemented and I did not find it? Or perhaps this be done with a SE macro?  ???

jorick

  • Senior Community Member
  • Posts: 389
  • Hero Points: 17
I second ewendt's idea above!  I'm always wondering if I should be using a . or -> and usually find out the hard way at compile time.

Graeme

  • Senior Community Member
  • Posts: 2758
  • Hero Points: 341
I second ewendt's idea above!  I'm always wondering if I should be using a . or -> and usually find out the hard way at compile time.
I posted a macro to do something like that here
http://community.slickedit.com/index.php/topic,9696.0.html
but it looks like it's not working too well.  I'll see if I can fix it up.  It's not exactly what you're asking for - instead of typing dot you type say alt+dot and the code tries to find which operator works.  Binding the macro to dot itself is more challenging I think.

ewendt

  • Community Member
  • Posts: 42
  • Hero Points: 2
I put a modification proposal in the macro section with the topic
"suggestion for modification of 'codehelp.e' "
with a short demonstration, that SE is able to change "." to "->" while typing if it makes sense.

http://community.slickedit.com/index.php/topic,10918.0.html