-
Notifications
You must be signed in to change notification settings - Fork 372
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
Improve line numbers #2470
base: master
Are you sure you want to change the base?
Improve line numbers #2470
Conversation
The line numbers is fixed to the left. Before 2024-11-07-line-numbers.mp4Now 2024-11-07-line-numbers-fixed.mp4 |
app/src/main/java/net/gsantner/markor/frontend/textview/LineNumbersTextView.java
Show resolved
Hide resolved
app/src/main/java/net/gsantner/markor/activity/DocumentEditAndViewFragment.java
Outdated
Show resolved
Hide resolved
{ | ||
if (_lineNumbersView.isLineNumbersEnabled()) { | ||
final long time = System.currentTimeMillis(); | ||
if (time - _lineNumbersRefreshTime > 125) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Refactor this feature: