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

Hide decorations for selections that are larger than the viewport #403

Merged
merged 7 commits into from
Jan 6, 2022

Conversation

AndreasArvidsson
Copy link
Member

Just work around so that crown file don't flash entire screen. Large functions that cover most of the viewport will have a similar effect but now at least we can get rid of those cases when the entire viewport would flash.

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I love the idea of having no visual feedback. Maybe we could just make the color less dramatic?

@AndreasArvidsson
Copy link
Member Author

You still get the visual feedback of the window actually scrolling. I think that decorating the entire viewport gives us no extra information. The point of the decoration is for the user to get a feedback on which part of the text was actually affected/referenced. This is useful because you might not always know the bounds of a statement. If we just highlight the entire viewport you have no information about the exact range of the selection/reference and I then would argue that flashing the entire viewport is just irritating and gives the user no relevant feedback.

@pokey
Copy link
Member

pokey commented Dec 19, 2021

That's fair. I'll pull it to get a feel for it

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this one locally but it doesn't work. I said "crown file", and it still highlighted everything

@AndreasArvidsson
Copy link
Member Author

It only excludes selections that are larger than the viewport. The reason for this is that if you have a small file that maybe only contains a single function it still might be a good idea to be able to highlight the entire document. You need to have a file with more rows than you can fit in the viewport/editor for this fix to take effect.

@pokey
Copy link
Member

pokey commented Jan 4, 2022

It only excludes selections that are larger than the viewport. The reason for this is that if you have a small file that maybe only contains a single function it still might be a good idea to be able to highlight the entire document. You need to have a file with more rows than you can fit in the viewport/editor for this fix to take effect.

I tested it on a file that had more rows than fit in my viewport, and it still highlighted it

@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Jan 4, 2022

Where you scrolled down? If your selection are matching the start or the end of the viewport it will still show.
Opening a large file and scrolling down will not highlight for me.

I could probably be a little more specific about the requirements

@pokey
Copy link
Member

pokey commented Jan 4, 2022

But you check if the start matches after you've already scrolled, so you will always be at the start. I'm surprised it works for you

@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Jan 4, 2022

Worked for me but I only tested with center probably. I will have another look at it tomorrow.

@AndreasArvidsson
Copy link
Member Author

Have another look at it now

src/actions/Scroll.ts Outdated Show resolved Hide resolved
@pokey pokey merged commit 09f0e48 into main Jan 6, 2022
@pokey pokey deleted the scroll_decorations_filter branch January 6, 2022 14:22
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.

2 participants