Skip to content

Copy and paste does not work correctly on Windows 10 #16459

Closed

Description

@CodeGradox

When I copy a url or text in Windows and paste it into the omibar in Servo, it pastes an empty box character instead of the text. It does the same on any website I visit where I can paste text.

servo url

Activity

  1. added
    P-windows
    on Apr 14, 2017
  2. CodeGradox commented on Apr 15, 2017

    @CodeGradox
    Author

    Looks like pressing CTRL + almost any key on the keyboard inserts either that box, space or what seems to be a tab.

  3. atouchet commented on Jun 2, 2017

    @atouchet
    Contributor

    I tested this out today with #17067 being merged now and I seem to be getting some strange results. If I copy and paste a URL within Servo it pastes the URL twice (ex. copying https://duckduckgo.com/html pastes as https://duckduckgo.com/htmlhttps://duckduckgo.com/html). Also if I try to paste into another application other than Servo nothing shows up. Strangely I can paste into another application just fine but only after closing the Servo browser window. Servo appears to be doing something to interfere with the Windows clipboard. I can't even copy and paste from completely different applications with Servo running now. For example I can't copy text from Firefox to paste into Notepad unless Servo is not running.

  4. est31 commented on Jun 2, 2017

    @est31
    Contributor

    cc @DoumanAsh seems your crate is being used on windows?
    cc @aweinstock314

  5. DoumanAsh commented on Jun 2, 2017

    @DoumanAsh

    @est31 Yes.

    Just to try it out myself @CodeGradox could please paste your url/text
    From what gather there seems to be strange handling of URL... I'll make a quick test.
    But what about text?

    For now i made simple test DoumanAsh/clipboard-win@3dd2519 but it works as expected.

    I need to take a look at how servo set & paste to/from clipboard.

    UPD:
    If possible i would like to see errors that might be generated by warn! macro

    UPD2
    Looking at servo's way of clipboard usage, it seems there might be a problem due to the fact that in version 2.0 I had introduced Clipboard context.
    clipboard library uses this context and therefore servo now(contrary to older clipboard) has it open during life of program.
    But in most cases it might be better to actually open/close it only during operations.
    To verify that I'll need to look around code.
    But as work-around i would try to suggest to use set_clipboard_string and get_clipboard_string in rust-clipboard. This way you can retain original behavior. If it helps, then you might want to ask @aweinstock314 to create new version with these changes.
    But I would like to find out for sure whether it is ok to leave clipboard opened for long on Windows

    UPD3
    My observations

    • Opened clipboard prevents other applications from accessing it (e.g. Firefox)
      • But powershell seems to be able to do it
    • Performing Clipboard operation from another application breaks your opened Clipboard

    So it seems rather... unsafe to open Clipboard for long.
    I'm not sure what could be a reason. I'll ponder about it later on, but for now I suppose we need to change way clipboard is used on windows.
    Simplest way would be to change way rust-clipboard creates context for windows.
    if @aweinstock314 is ok, with it, it would fix for now this issue.

  6. est31 commented on Jun 3, 2017

    @est31
    Contributor

    clipboard library uses this context and therefore servo now(contrary to older clipboard) has it open during life of program.
    But in most cases it might be better to actually open/close it only during operations.

    Interesting, this might be in fact the cause. I'm not sure whether this behaviour is the right one on Linux/Mac, is there a cost in creating a clipboard context on those operating systems?

  7. DoumanAsh commented on Jun 3, 2017

    @DoumanAsh

    In Windows case you only need to call two WinAPI function corresponding to opening clipboard, and then closing it on dropping context.

    In case of Mac you would need to initialize interface toward clipboard server each time.
    I'm not aware of implementation details there, but most likely it is sorta process-communication establishment within a system.
    A bit more costly than Windows, i guess, but I don't think it is critical

    But in case of X11 though you need to do some initialization with spawning thread https://github.com/quininer/x11-clipboard/blob/master/src/lib.rs#L109-L125

  8. est31 commented on Jun 5, 2017

    @est31
    Contributor

    Okay, I've filed an issue report against the rust-clipboard crate. Its better fixed there, as to not confuse other users.

  9. atouchet commented on Jun 11, 2017

    @atouchet
    Contributor

    Just realized that this also impacts print screen which makes it so now I can't take screenshots of Servo.

  10. DoumanAsh commented on Jun 11, 2017

    @DoumanAsh

    @atouchet Hmm... i think it should not. Servo uses only unicode text format when accessing clipboard so it should break only copying\pasting text

  11. atouchet commented on Jun 11, 2017

    @atouchet
    Contributor

    @DoumanAsh well it doesn't appear to be working now and I know that it did work in the past. I am assuming that #17067 started the problem but I have not verified that.

    Edit: I may open a new issue regarding the Windows clipboard as it appears there are more problems than just copying and pasting.

  12. DoumanAsh commented on Jun 11, 2017

    @DoumanAsh

    @atouchet Well, I suppose stopping leaving clipboard open on windows will prevent any kind of conflicts so you should wait for that to be resolved first.

  13. added a commit that references this issue on Jun 19, 2017
    a1e9843
  14. est31 commented on Jun 19, 2017

    @est31
    Contributor

    I've filed #17413 to fix all clipboard issues on windows. I couldn't test it. If any of you can build servo, could you test it? Replies please in the PR thread.

  15. added a commit that references this issue on Jun 20, 2017
    154186f
  16. atouchet commented on Jun 21, 2017

    @atouchet
    Contributor

    I tested this out and now I am able to copy and paste URLs into Servo again. However I am still getting that duplicate URL issue I mentioned in my original post. If I try to load the duplicate URL site Servo seems to still work regardless. I am not sure what is happening there.

    I also tied copying text from https://www.rust-lang.org/en-US/ and pasting it into the Servo address bar which resulted in empty boxes.

  17. DoumanAsh commented on Jun 21, 2017

    @DoumanAsh

    @atouchet Do you by any chance has logs from servo? It is rather strange i would say.

  18. atouchet commented on Jun 21, 2017

    @atouchet
    Contributor

    @DoumanAsh Sorry, I don't have any logs.

  19. DoumanAsh commented on Jun 21, 2017

    @DoumanAsh

    np, I'll try to build servo myself and see if there is any issue with my clipboard library or something else.

  20. changed the title [-]Copy and paste does not work correctly on WIndows 10[/-] [+]Copy and paste does not work correctly on Windows 10[/+] on Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inputP-windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions