pythia icon indicating copy to clipboard operation
pythia copied to clipboard

Incorrect selection is picked

Open shivakumargn opened this issue 12 years ago • 4 comments

I am using chrome, often click is needed in a row below the actual symbol to be selected.

I have also seen instances where the click is 2 to 3 rows below the actual code section select for highlighting !

shivakumargn avatar Nov 22 '13 01:11 shivakumargn

Can you give me an example file where this happens and which symbol in which row/column you are trying to select?

fzipp avatar Nov 22 '13 23:11 fzipp

pythia_bug

Image attached. The click was on Unlock(), but the "Describe" brought up a stack which on clicking highlights an unrelated data structure (1-2 lines above)

shivakumargn avatar Nov 27 '13 01:11 shivakumargn

Thanks. The problem seems to be Windows/DOS line endings (\r\n) vs. Unix line endings (\n), which results in the calculation of the wrong byte offsets. When I converted a source file to Windows line endings I was able to reproduce the bug on a Mac. The problem itself is browser independent.

fzipp avatar Nov 27 '13 19:11 fzipp

The browser loses the \r characters as soon as the source code is inserted via the .html() method:

var text = '1\r\n2\r\n3\r\n4\r\n5\r\n'; text.length == 15;

$('#src').html(text); $('#src').text().length == 10;

fzipp avatar Nov 27 '13 22:11 fzipp