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

Enhance line numbers #2470

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

guanglinn
Copy link
Contributor

Refactor this feature:

  • Improve line numbers experience
  • Optimize algorithm of drawing line numbers

@guanglinn
Copy link
Contributor Author

guanglinn commented Nov 6, 2024

The line numbers is fixed to the left.

Before

2024-11-07-line-numbers.mp4

Now

2024-11-07-line-numbers-fixed.mp4

{
if (_lineNumbersView.isLineNumbersEnabled()) {
final long time = System.currentTimeMillis();
if (time - _lineNumbersRefreshTime > 125) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why a time based vs a scroll based refresh like we do now?

Copy link
Contributor Author

@guanglinn guanglinn Nov 10, 2024

Choose a reason for hiding this comment

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

The time based code just reduces the refresh rate of line numbers when scrolling.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But we already have a system where the line numbering only redraws after the user has scrolled by some delta (1 page iirc). IMO that is superior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That system is called passively when the view is changed, it works well when the view is EditText, but now this view is TextView. So this code is designed to actively trigger that system to check and determine whether to draw new line numbers.

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