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

Add an option to display relative line numbers #270

Merged
merged 1 commit into from
Mar 15, 2017

Conversation

xgouchet
Copy link
Contributor

@xgouchet xgouchet commented Mar 9, 2017

With this new option, the line numbers are counted as relative from the
current line.

Fixes #265

Copy link
Member

@mitya57 mitya57 left a comment

Choose a reason for hiding this comment

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

The code to calculate line number area width is wrong. See for example the following screenshot where the minuses aren’t displayed.

retext

@@ -96,7 +97,6 @@ def getBundledIcon(iconName):
'useWebKit': False,
'windowGeometry': QByteArray(),
}

Copy link
Member

Choose a reason for hiding this comment

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

Please do not remove whitespace here.

ReText/editor.py Outdated
while not atEnd:
rect = self.editor.cursorRect(cursor)
block = cursor.block()
if block.isVisible():
number = str(cursor.blockNumber() + 1)
number = str(cursor.blockNumber() - relativeTo)
Copy link
Member

Choose a reason for hiding this comment

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

Can you maybe use a proper typographic minus (−) here? I.e. add .replace('-', '−') to this string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

With this new option, the line numbers are counted as relative from the
current line.

Fixes retext-project#265
@mitya57 mitya57 merged commit bde17b9 into retext-project:master Mar 15, 2017
@mitya57
Copy link
Member

mitya57 commented Mar 15, 2017

Merged, thanks!

@xgouchet xgouchet deleted the relative_line_number branch September 14, 2017 06:27
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.

None yet

2 participants