|
|
|
|
|
|
|
|
|
|
|
Re: Cannot "cut and paste " from "console"..... [message #1848317 is a reply to message #1822485] |
Sun, 28 November 2021 01:06 |
Joël DRIGO Messages: 1 Registered: June 2016 |
Junior Member |
|
|
Hello,
Maybe it will help some people who have problems copying the Eclipse console:
I couldn't paste text that I had selected in the console and copied (either through shortcuts or menus). Or sometimes I had only a part of the text pasted. I realized that the text I was printing in console was built in my code from a badly initialized char array (containing only 0's). Translation: the invisible characters cannot be copied. They even stop the copy of other following selected characters.
It also works like this because the preference of my console "Interpret ASCII control characters" is unchecked.
Small demonstration example (in Java):
public static void main(String[] args) {
char[] array = new char[10]; // new char array, so filled with 0
java.util.Arrays.fill(array, 1, array.length-1, 'x'); // I fill all characters with an x, except the first and the last, which stay to 0.
System.out.println( new String(array) );
char[] array = new char[10];
Arrays.fill(array, 0, array.length, 'x'); // fill the array with 'x'
array[1]=(char)0x005C0000; // then set the 2nd char to null char (the same if I set with 0)
array[array.length-2]=(char)0x005C0000; // then set the 2nd to last char to null.
System.out.println( new String(array) );
}
The console shows "x xxxxx x". CTRL-A (all is selected), CTRL-C then CTRL-V: I get only x.
If I check the preference "Interpret ASCII control characters", the console shows "xxxxxxx" and can be copied and pasted.
|
|
|
Powered by
FUDForum. Page generated in 0.09038 seconds