Login  Register

Newline is ignored at end of string in text windows

Posted by Stein Rørvik on Jul 05, 2018; 8:07am
URL: http://imagej.273.s1.nabble.com/Newline-is-ignored-at-end-of-string-in-text-windows-tp5020909.html

There is an issue with the way the linebreak \n symbol is handled when writing to text windows.
If the line ends in an explicit \n symbol (to give an extra linebreak), it is just ignored.
See the following three cases which one would expect to give the same result; the third one is printed wrongly.

This could perhaps also be a windows-only issue, perhaps related to the previous one I just posted to the list.

print("\\Clear");
print("----------");

print("abc");
print("");             //ok
print("");             //ok
print("123");

print("----------");

print("abc");
print("\n\n123");             //ok

print("----------");

print("abc");
print("\n\n");    //entire string is ignored
print("123");

print("----------");


I am using daily build ImageJ 1.51e with Java 1.6 on Windows 7/64-bit.


Stein


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html