Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paint multiple user selections (Resolves #631) #633

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

matthew-carroll
Copy link
Contributor

Paint multiple user selections (Resolves #631)

The selections are configured as per #604

@matthew-carroll
Copy link
Contributor Author

@roughike @miguelcmedeiros - Do you guys wanna give this PR a try for multi-user selection and see how it works? It's probably a good idea to make sure it works the way you want it to, before investing more effort.

@roughike
Copy link
Contributor

Hey @matthew-carroll, the API looks like exactly what we need - can you rebase the PR so that it would be easier to take it for a test run?

@matthew-carroll
Copy link
Contributor Author

@roughike I just rebased

@roughike
Copy link
Contributor

Played around with this a bit.

  1. Calling setNonPrimarySelection("john", ..) repeatedly with an updated DocumentSelection should change the existing selection for "john", right? This does not seem to be the case.

I wrapped the setNonPrimarySelection("john", ...) part in your example with a periodic timer like this:

    var i = 0;
    Timer.periodic(const Duration(seconds: 1), (_) {
      i++;
      print(i);
      _composer.setNonPrimarySelection(
        "john",
        DocumentSelection(
          base: DocumentPosition(
            nodeId: nodeId,
            nodePosition:
                TextNodePosition.fromTextPosition(TextPosition(offset: i)),
          ),
          extent: DocumentPosition(
            nodeId: nodeId,
            nodePosition:
                TextNodePosition.fromTextPosition(TextPosition(offset: 50)),
          ),
        ),
      );
    });

I expected that the selection start would update every second, but that does not happen.

  1. When focusing an existing non-primary selection, it paints a blinking caret. This causes the document to have two blinking carets - my caret and John's caret (but John's caret is only displayed when his paragraph is focused). As far as I'm aware, we only want to display one blinking caret. See video below of the unexpected behavior:
Nayttotallennus.2022-7-20.kello.14.35.45.mov

@matthew-carroll
Copy link
Contributor Author

@roughike I pushed a fix for the two issues you mentioned. Give it another try and let me know if it works for you.

@roughike
Copy link
Contributor

@matthew-carroll works!

@matthew-carroll matthew-carroll marked this pull request as ready for review July 25, 2022 21:24
matthew-carroll and others added 20 commits July 25, 2022 15:01
…n change re-painting and removed the non-primary caret.
@matthew-carroll
Copy link
Contributor Author

@roughike @miguelcmedeiros - Should we merge these changes, or do you think that we need to implement more multi-user selections in this PR before we can be confident in the changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SuperEditor: Paint multiple user selections
3 participants