Copy and paste

View: New views
4 Messages — Rating Filter:   Alert me  

Copy and paste

by Joris van der Hoeven :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I discovered several bugs with the new copy and paste system.
One problem concerns the fact that SelectionClear events are
issued even if we were already the owner of the previous selection.
As a consequence, we lost the original TeXmacs tree and mode information.
I implement a dirty fix, but the fix might introduce other problems;
any better solution would be welcome.

As to the Qt port, one has to make sure that copy-and-paste from
within TeXmacs really uses the tree information and is not merely textual
(i.e. uses t instead of s in selection_paste). Please check.

Best wishes, --Joris


_______________________________________________
Texmacs-dev mailing list
Texmacs-dev@...
http://lists.gnu.org/mailman/listinfo/texmacs-dev

Re: Copy and paste

by Joris van der Hoeven :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Oct 05, 2009 at 10:07:31AM +0200, Joris van der Hoeven wrote:
> As to the Qt port, one has to make sure that copy-and-paste from
> within TeXmacs really uses the tree information and is not merely textual
> (i.e. uses t instead of s in selection_paste). Please check.

Seems to be fine.

--Joris


_______________________________________________
Texmacs-dev mailing list
Texmacs-dev@...
http://lists.gnu.org/mailman/listinfo/texmacs-dev

Re: Copy and paste

by Norbert Nemec :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Joris,

I just checked the patches. I believe I understand the problem.
SetSelectionOwner issues a SelectionClearEvent, but this is then of
course queued and handled later on. If the same instance of TeXmacs
already was the owner, the selection is then first replaced and cleared
afterwards. I wonder why I did not notice this in testing. I have not
used the X11 interface in some time.

In any case, I don't see any cleaner solution than the one that you
implemented.

However, there is another detail in your patch that seems unrelated and
incorrect to me:

-----------

+++ b/src/src/Plugins/X11/x_gui.cpp

@@ -217,7 +217,7 @@ x_gui_rep::get_selection (string key, tree& t,
string& s) {

    if (selection_t->contains (key)) {

      t= copy (selection_t [key]);

     s= copy (selection_s [key]);

-    res=true;

+    return true;

    }

-----------


In fact, this line *should* read "res=true". The point is that the fact
that TeXmacs has *a* selection does not mean that it actually owns *the*
selection. Only a check of GetSelectionOwner can tell this. I am not
sure whether this would ever make problems in practice. I am not sure
whether the ClearSelection mechanism can be trusted in every case.

Greetings,
Norbert



Joris van der Hoeven wrote:

> Hi,
>
> I discovered several bugs with the new copy and paste system.
> One problem concerns the fact that SelectionClear events are
> issued even if we were already the owner of the previous selection.
> As a consequence, we lost the original TeXmacs tree and mode information.
> I implement a dirty fix, but the fix might introduce other problems;
> any better solution would be welcome.
>
> As to the Qt port, one has to make sure that copy-and-paste from
> within TeXmacs really uses the tree information and is not merely textual
> (i.e. uses t instead of s in selection_paste). Please check.
>
> Best wishes, --Joris
>
>
> _______________________________________________
> Texmacs-dev mailing list
> Texmacs-dev@...
> http://lists.gnu.org/mailman/listinfo/texmacs-dev
>
>  



_______________________________________________
Texmacs-dev mailing list
Texmacs-dev@...
http://lists.gnu.org/mailman/listinfo/texmacs-dev

Re: Copy and paste

by Joris van der Hoeven :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Oct 07, 2009 at 06:39:06PM +0100, Norbert Nemec wrote:

> However, there is another detail in your patch that seems unrelated and
> incorrect to me:
>
> -----------
>
> +++ b/src/src/Plugins/X11/x_gui.cpp
> @@ -217,7 +217,7 @@ x_gui_rep::get_selection (string key, tree& t,
> string& s) {
>    if (selection_t->contains (key)) {
>      t= copy (selection_t [key]);
>     s= copy (selection_s [key]);
> -    res=true;
> +    return true;
>    }
> -----------

Yes, I wondered about this one. The problem is that textual cut&paste's
are duplicated in some cases (i.e. pasting "Hi" yields "HiHi").
So res=true is definitely incorrect, unless something else is changed.
Please investigate what would be really clean.

Thanks, --Joris


_______________________________________________
Texmacs-dev mailing list
Texmacs-dev@...
http://lists.gnu.org/mailman/listinfo/texmacs-dev