Strings are pasted in the wrong position in new text windows

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Strings are pasted in the wrong position in new text windows

Stein Rørvik
There seems to be a bug in the way the clipboard is handled in the ImageJ built-in text editor.

Try this:

Copy some string to the clipboard from any application, e.g. MyString

Create a new text window (Ctrl-Shift-N) in ImageJ and then type something (e.g. Test)
and then paste the above string at the current cursor position (which is after your typed string)
by keyboard Ctrl-V or from the menu.

The result is MyStringTest instead of TestMyString

The pasted position seems to always come at the start of the current line or at the start of the file.
The result of this varies, depending on the length of the text already present before you try to paste.

This problem only occurs with newly created text windows;
it does not happen if you paste into a text window that was opened from a file.

I am using daily build ImageJ 1.51s on Windows 7 64-bit.

Stein


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Strings are pasted in the wrong position in new text windows

Gabriel Landini
On Friday, 17 November 2017 12:18:25 GMT you wrote:
> There seems to be a bug in the way the clipboard is handled in the ImageJ
> built-in text editor.
>
> Try this:

Hi,
I tried that, but can't reproduce it in linux64 (latest daily build) Java 8 or
Java 8.
Maybe it is a Win issue?
Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Strings are pasted in the wrong position in new text windows

Herbie
In reply to this post by Stein Rørvik
Good day Stein,

I can't confirm this behavior under macOS with Java 6.

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::::
Am 17.11.17 um 13:18 schrieb Stein Rørvik:

> There seems to be a bug in the way the clipboard is handled in the
> ImageJ built-in text editor.
>
> Try this:
>
> Copy some string to the clipboard from any application, e.g.
> MyString
>
> Create a new text window (Ctrl-Shift-N) in ImageJ and then type
> something (e.g. Test) and then paste the above string at the current
> cursor position (which is after your typed string) by keyboard Ctrl-V
> or from the menu.
>
> The result is MyStringTest instead of TestMyString
>
> The pasted position seems to always come at the start of the current
> line or at the start of the file. The result of this varies,
> depending on the length of the text already present before you try to
> paste.
>
> This problem only occurs with newly created text windows; it does not
> happen if you paste into a text window that was opened from a file.
>
> I am using daily build ImageJ 1.51s on Windows 7 64-bit.
>
> Stein
>
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Strings are pasted in the wrong position in new text windows

Stein Rørvik
Yes it might very well be a Win issue; probably has to do with the window and clipboard handling.
I tested it both with Java 6 and Java 8 and older ImageJ versions and see the same behaviour.
Naturally this does not happen in Fiji since that has a completely different text editor.

Stein

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Herbie
Sent: 17. november 2017 13:52
To: [hidden email]
Subject: Re: Strings are pasted in the wrong position in new text windows

Good day Stein,

I can't confirm this behavior under macOS with Java 6.

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::::
Am 17.11.17 um 13:18 schrieb Stein Rørvik:

> There seems to be a bug in the way the clipboard is handled in the
> ImageJ built-in text editor.
>
> Try this:
>
> Copy some string to the clipboard from any application, e.g.
> MyString
>
> Create a new text window (Ctrl-Shift-N) in ImageJ and then type
> something (e.g. Test) and then paste the above string at the current
> cursor position (which is after your typed string) by keyboard Ctrl-V
> or from the menu.
>
> The result is MyStringTest instead of TestMyString
>
> The pasted position seems to always come at the start of the current
> line or at the start of the file. The result of this varies, depending
> on the length of the text already present before you try to paste.
>
> This problem only occurs with newly created text windows; it does not
> happen if you paste into a text window that was opened from a file.
>
> I am using daily build ImageJ 1.51s on Windows 7 64-bit.
>
> Stein
>
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Strings are pasted in the wrong position in new text windows

Wayne Rasband-2
In reply to this post by Stein Rørvik
> On Nov 17, 2017, at 7:18 AM, Stein Rørvik <[hidden email]> wrote:
>
> There seems to be a bug in the way the clipboard is handled in the ImageJ built-in text editor.
>
> Try this:
>
> Copy some string to the clipboard from any application, e.g. MyString
>
> Create a new text window (Ctrl-Shift-N) in ImageJ and then type something (e.g. Test)
> and then paste the above string at the current cursor position (which is after your typed string)
> by keyboard Ctrl-V or from the menu.
>
> The result is MyStringTest instead of TestMyString

This Windows-only bug is fixed in the latest daily build (1.51u15).

-wayne

> The pasted position seems to always come at the start of the current line or at the start of the file.
> The result of this varies, depending on the length of the text already present before you try to paste.
>
> This problem only occurs with newly created text windows;
> it does not happen if you paste into a text window that was opened from a file.
>
> I am using daily build ImageJ 1.51s on Windows 7 64-bit.
>
> Stein

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Strings are pasted in the wrong position in new text windows

Stein Rørvik
Thanks, it works fine now!

Stein

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband
Sent: 17. januar 2018 05:02
To: [hidden email]
Subject: Re: Strings are pasted in the wrong position in new text windows

> On Nov 17, 2017, at 7:18 AM, Stein Rørvik <[hidden email]> wrote:
>
> There seems to be a bug in the way the clipboard is handled in the ImageJ built-in text editor.
>
> Try this:
>
> Copy some string to the clipboard from any application, e.g. MyString
>
> Create a new text window (Ctrl-Shift-N) in ImageJ and then type
> something (e.g. Test) and then paste the above string at the current
> cursor position (which is after your typed string) by keyboard Ctrl-V or from the menu.
>
> The result is MyStringTest instead of TestMyString

This Windows-only bug is fixed in the latest daily build (1.51u15).

-wayne

> The pasted position seems to always come at the start of the current line or at the start of the file.
> The result of this varies, depending on the length of the text already present before you try to paste.
>
> This problem only occurs with newly created text windows; it does not
> happen if you paste into a text window that was opened from a file.
>
> I am using daily build ImageJ 1.51s on Windows 7 64-bit.
>
> Stein

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Strings are pasted in the wrong position in new text windows

Stein Rørvik
In reply to this post by Wayne Rasband-2
I submitted to the list in January 2018 a bug in the way the clipboard is handled in the ImageJ built-in text editor. The issue as described was then resolved in daily build 1.51u15, but there is still a related problem (most likely windows-only) present with respect to the cursor position in newly made text windows.

Try this:

Copy some string to the clipboard from any application, e.g. MyString

Create a new text window (Ctrl-Shift-N) in ImageJ and then _type_ some text (do not paste) into multiple lines, e.g.

        This is line 1
        This is line 2

and then attempt to paste the string in your clipboard between these two lines (cursor at the start of line 2) by keyboard Ctrl-V or from the menu.

The result is

        This is line 1
        TMyStringhis is line 2

instead of the expected
        This is line 1
        MyStringThis is line 2

Obviously the cursor position is wrong by one position; if you have two lines before the cursor point the position gets two positions wrong:

        This is line 1
        This is line 2
        ThMyStringis is line 3

I assume this is a windows-only bug due to its common confusion from CR+LF line endings instead of just CR or LF.

The issue does not occur if the source text was copied from another application and pasted into the editor. For example, if you type the three line text in Notepad++ and paste into ImageJ, the subsequent pasting gets correct:

        This is line 1
        This is line 2
        MyStringThis is line 3

This problem only occurs with newly created text windows;
it does not happen if you paste into a text window that was opened from a file.

I am using daily build ImageJ 1.52e on Windows 7 64-bit.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
Sent: 17. januar 2018 05:02
To: [hidden email]
Subject: Re: Strings are pasted in the wrong position in new text windows

> On Nov 17, 2017, at 7:18 AM, Stein Rørvik <[hidden email]> wrote:
>
> There seems to be a bug in the way the clipboard is handled in the ImageJ built-in text editor.
>
> Try this:
>
> Copy some string to the clipboard from any application, e.g. MyString
>
> Create a new text window (Ctrl-Shift-N) in ImageJ and then type
> something (e.g. Test) and then paste the above string at the current
> cursor position (which is after your typed string) by keyboard Ctrl-V or from the menu.
>
> The result is MyStringTest instead of TestMyString

This Windows-only bug is fixed in the latest daily build (1.51u15).

-wayne

> The pasted position seems to always come at the start of the current line or at the start of the file.
> The result of this varies, depending on the length of the text already present before you try to paste.
>
> This problem only occurs with newly created text windows; it does not
> happen if you paste into a text window that was opened from a file.
>
> I am using daily build ImageJ 1.51s on Windows 7 64-bit.
>
> Stein

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Strings are pasted in the wrong position in new text windows

Gabriel Landini
On Thursday, 5 July 2018 08:48:43 BST [hidden email] wrote:
> This is line 1
> This is line 2
> ThMyStringis is line 3

That does not happen under linux.
Cheers
Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Strings are pasted in the wrong position in new text windows

Wayne Rasband-2
In reply to this post by Stein Rørvik
> On Jul 5, 2018, at 3:48 AM, Stein Rørvik <[hidden email]> wrote:
>
> I submitted to the list in January 2018 a bug in the way the clipboard is handled in the ImageJ built-in text editor. The issue as described was then resolved in daily build 1.51u15, but there is still a related problem (most likely windows-only) present with respect to the cursor position in newly made text windows.

The problem that caused text to be inserted at the wrong position in Windows is fixed in the latest ImageJ daily build (1.52e34). It is also fixed in the 1.52e release candidate listed in the Help>Update ImageJ dialog. This is a Windows bug that ImageJ works around by counting the number of return characters (“\r”) before the cursor position and pasting at the cursor position minus this count.

-wayne

> Try this:
>
> Copy some string to the clipboard from any application, e.g. MyString
>
> Create a new text window (Ctrl-Shift-N) in ImageJ and then _type_ some text (do not paste) into multiple lines, e.g.
>
> This is line 1
> This is line 2
>
> and then attempt to paste the string in your clipboard between these two lines (cursor at the start of line 2) by keyboard Ctrl-V or from the menu.
>
> The result is
>
> This is line 1
> TMyStringhis is line 2
>
> instead of the expected
> This is line 1
> MyStringThis is line 2
>
> Obviously the cursor position is wrong by one position; if you have two lines before the cursor point the position gets two positions wrong:
>
> This is line 1
> This is line 2
> ThMyStringis is line 3
>
> I assume this is a windows-only bug due to its common confusion from CR+LF line endings instead of just CR or LF.
>
> The issue does not occur if the source text was copied from another application and pasted into the editor. For example, if you type the three line text in Notepad++ and paste into ImageJ, the subsequent pasting gets correct:
>
> This is line 1
> This is line 2
> MyStringThis is line 3
>
> This problem only occurs with newly created text windows;
> it does not happen if you paste into a text window that was opened from a file.
>
> I am using daily build ImageJ 1.52e on Windows 7 64-bit.
>
> Stein
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
> Sent: 17. januar 2018 05:02
> To: [hidden email]
> Subject: Re: Strings are pasted in the wrong position in new text windows
>
>> On Nov 17, 2017, at 7:18 AM, Stein Rørvik <[hidden email]> wrote:
>>
>> There seems to be a bug in the way the clipboard is handled in the ImageJ built-in text editor.
>>
>> Try this:
>>
>> Copy some string to the clipboard from any application, e.g. MyString
>>
>> Create a new text window (Ctrl-Shift-N) in ImageJ and then type
>> something (e.g. Test) and then paste the above string at the current
>> cursor position (which is after your typed string) by keyboard Ctrl-V or from the menu.
>>
>> The result is MyStringTest instead of TestMyString
>
> This Windows-only bug is fixed in the latest daily build (1.51u15).
>
> -wayne
>
>> The pasted position seems to always come at the start of the current line or at the start of the file.
>> The result of this varies, depending on the length of the text already present before you try to paste.
>>
>> This problem only occurs with newly created text windows; it does not
>> happen if you paste into a text window that was opened from a file.
>>
>> I am using daily build ImageJ 1.51s on Windows 7 64-bit.
>>
>> Stein

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Strings are pasted in the wrong position in new text windows

Stein Rørvik
Thanks;

I tested this and it works, but unfortunately another problem has appeared.
It is no longer possible to paste anything when you are at the very last position of the text.
That translates to the first position of the window for a new window,
or the first character of any new line at the end of the text.

Inserting one blank character (e.g. a space) and moving one step backwards is a workaround.
I suggest you fix this in the 1.52e release candidate too, as this is quite confusing; the paste function simply appears to not work at all in new empty text windows. I assume this is still a windows-only bug.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
Sent: 06. juli 2018 00:22
To: [hidden email]
Subject: Re: Strings are pasted in the wrong position in new text windows

> On Jul 5, 2018, at 3:48 AM, Stein Rørvik <[hidden email]> wrote:
>
> I submitted to the list in January 2018 a bug in the way the clipboard is handled in the ImageJ built-in text editor. The issue as described was then resolved in daily build 1.51u15, but there is still a related problem (most likely windows-only) present with respect to the cursor position in newly made text windows.

The problem that caused text to be inserted at the wrong position in Windows is fixed in the latest ImageJ daily build (1.52e34). It is also fixed in the 1.52e release candidate listed in the Help>Update ImageJ dialog. This is a Windows bug that ImageJ works around by counting the number of return characters (“\r”) before the cursor position and pasting at the cursor position minus this count.

-wayne

> Try this:
>
> Copy some string to the clipboard from any application, e.g. MyString
>
> Create a new text window (Ctrl-Shift-N) in ImageJ and then _type_ some text (do not paste) into multiple lines, e.g.
>
> This is line 1
> This is line 2
>
> and then attempt to paste the string in your clipboard between these two lines (cursor at the start of line 2) by keyboard Ctrl-V or from the menu.
>
> The result is
>
> This is line 1
> TMyStringhis is line 2
>
> instead of the expected
> This is line 1
> MyStringThis is line 2
>
> Obviously the cursor position is wrong by one position; if you have two lines before the cursor point the position gets two positions wrong:
>
> This is line 1
> This is line 2
> ThMyStringis is line 3
>
> I assume this is a windows-only bug due to its common confusion from CR+LF line endings instead of just CR or LF.
>
> The issue does not occur if the source text was copied from another application and pasted into the editor. For example, if you type the three line text in Notepad++ and paste into ImageJ, the subsequent pasting gets correct:
>
> This is line 1
> This is line 2
> MyStringThis is line 3
>
> This problem only occurs with newly created text windows; it does not
> happen if you paste into a text window that was opened from a file.
>
> I am using daily build ImageJ 1.52e on Windows 7 64-bit.
>
> Stein
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne
> Rasband
> Sent: 17. januar 2018 05:02
> To: [hidden email]
> Subject: Re: Strings are pasted in the wrong position in new text
> windows
>
>> On Nov 17, 2017, at 7:18 AM, Stein Rørvik <[hidden email]> wrote:
>>
>> There seems to be a bug in the way the clipboard is handled in the ImageJ built-in text editor.
>>
>> Try this:
>>
>> Copy some string to the clipboard from any application, e.g. MyString
>>
>> Create a new text window (Ctrl-Shift-N) in ImageJ and then type
>> something (e.g. Test) and then paste the above string at the current
>> cursor position (which is after your typed string) by keyboard Ctrl-V or from the menu.
>>
>> The result is MyStringTest instead of TestMyString
>
> This Windows-only bug is fixed in the latest daily build (1.51u15).
>
> -wayne
>
>> The pasted position seems to always come at the start of the current line or at the start of the file.
>> The result of this varies, depending on the length of the text already present before you try to paste.
>>
>> This problem only occurs with newly created text windows; it does not
>> happen if you paste into a text window that was opened from a file.
>>
>> I am using daily build ImageJ 1.51s on Windows 7 64-bit.
>>
>> Stein

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

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