Recent

Author Topic: Wrong result GetWordAtRowCol if we have tabs char  (Read 3094 times)

Zaher

  • Hero Member
  • *****
  • Posts: 679
    • parmaja.org
Wrong result GetWordAtRowCol if we have tabs char
« on: December 27, 2016, 11:17:01 am »
If I have tab char in the line before the cursor,  GetWordAtRowCol count the tab char  as one char/column, so it not gets the right result.

function TCustomSynEdit.GetWordAtRowCol(XY: TPoint): string;

Is it a bug?

I can manage to not allow to leave tabs in the editor, but i don't thing it is good idea.

thanks

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Wrong result GetWordAtRowCol if we have tabs char
« Reply #1 on: December 27, 2016, 09:50:07 pm »
I am not sure if this function takes physical or logical pos. (I would guess logical)
http://wiki.freepascal.org/SynEdit#Logical.2FPhysical_caret_position

In any case there are functions to convert between the two.

Zaher

  • Hero Member
  • *****
  • Posts: 679
    • parmaja.org
Re: Wrong result GetWordAtRowCol if we have tabs char
« Reply #2 on: December 29, 2016, 09:48:58 pm »
Thank you, it takes Logical position, this works fine for me

SynEdit.GetWordAtRowCol(SynEdit.LogicalCaretXY);

 

TinyPortal © 2005-2018