Author Topic: Cursor position in wrong place after "if" keyword expansion  (Read 3039 times)

schugh

  • Community Member
  • Posts: 30
  • Hero Points: 0
In my C# source code file, with SlickEdit 18, whenever I type "if<space>", the expansion kicks in but instead of the cursor in between the brackets, the cursor is placed after the closing bracket.
i.e.  if ()<cursor-here> {
      }

-- Sanjay

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1591
  • Hero Points: 140
Re: Cursor position in wrong place after "if" keyword expansion
« Reply #1 on: July 22, 2013, 04:30:04 pm »
I haven't reproduced this so far, trying to narrow it down.

Does it behave correctly if you go into Document -> C# Options and uncheck "Beautify syntax expansions"?

Does it happen for all if statement expansions everywhere, or just some of the expansions?

ExtremeXS

  • Senior Community Member
  • Posts: 108
  • Hero Points: 6
Re: Cursor position in wrong place after "if" keyword expansion
« Reply #2 on: July 23, 2013, 03:56:34 pm »
Same here - not had time to report it.

It seems very random, does if it expanding in some places/columns and not others, then suddenly everywhere, then no where for a while.

I will check the setting you mention, but I can confirm mine is turned on.

Cheers,
Mark

ExtremeXS

  • Senior Community Member
  • Posts: 108
  • Hero Points: 6
Re: Cursor position in wrong place after "if" keyword expansion
« Reply #3 on: July 23, 2013, 04:03:34 pm »
Ok just tried with the beautify expansion option turned off and the problem goes away.

In this particular case I tested if/for/foreach/switch and they all failed to position the cursor correctly in a function within a class, under some variables no matter if I instigated the expansion from column zero of an empty line, or preindented to where code is, or from a return on the previous line.  All cases put the cursor after the close bracket.  V17 final did not exhibit this behaviour.

I can go to the first line of the same function and will expand fine, then function before and after also expanded, but where I was initially editing fails everytime.


   public override void Render(GuiComponent parent)
   {
      base.Render(parent);
//FAILS HERE
      App.sDrawing.SetLayer(Drawing.Layers.GuiBackground);
//WORKS HERE
      float alpha = m_Fade.Alpha();
//FAILS HERE


Cheers,
Mark

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1591
  • Hero Points: 140
Re: Cursor position in wrong place after "if" keyword expansion
« Reply #4 on: July 23, 2013, 04:35:35 pm »
That helped.  It's still tricky to reproduce, but I see what the problem is now.  Thanks for the extra information.  I'll try to get this in for the next hotfix drop.

ExtremeXS

  • Senior Community Member
  • Posts: 108
  • Hero Points: 6
Re: Cursor position in wrong place after "if" keyword expansion
« Reply #5 on: July 23, 2013, 05:21:54 pm »
Thanks Patrick, great job :)

ExtremeXS

  • Senior Community Member
  • Posts: 108
  • Hero Points: 6
Re: Cursor position in wrong place after "if" keyword expansion
« Reply #6 on: August 16, 2013, 11:55:20 am »
Just so you are aware I am still seeing this issue in V18.0.1.

   public override void Update(float time)
   {
...
      if (m_Fade.IsComplete()) {
         if (m_Fade.IsFadingIn()) {
            Disabled = false;
// HERE>> inserted if, cursor after close bracket.
         }
...
      }
   }

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1591
  • Hero Points: 140
Re: Cursor position in wrong place after "if" keyword expansion
« Reply #7 on: August 16, 2013, 12:43:31 pm »
That's not what I was expecting, I'll look into it later this morning.  Thanks for the update.