-
Notifications
You must be signed in to change notification settings - Fork 199
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
Handle return in ordered lists context #326
Conversation
ReText/editor.py
Outdated
# Reset the cursor | ||
cursor = self.textCursor() | ||
cursor.insertText(('\n' + text[:pos]) if pos < length else '\n') | ||
match = re.search("^[\\s]*([*>-]|\\d+\\.) ", text) |
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.
Please pre-compile the regexes for performance using re.compile.
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.
Done 👍
ReText/editor.py
Outdated
if len(matchedText) == length: | ||
cursor.removeSelectedText() | ||
matchedText = '' | ||
else : |
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.
Please remove spaces after else
.
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.
Done 👍
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.
Sorry but here it is not done…
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.
Oups Sorry 'bout that
4dc8677
to
c2fd36d
Compare
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.
Just a couple more nits and I will merge it.
ReText/editor.py
Outdated
if len(matchedText) == length: | ||
cursor.removeSelectedText() | ||
matchedText = '' | ||
else : |
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.
Sorry but here it is not done…
ReText/editor.py
Outdated
@@ -105,6 +105,8 @@ def __init__(self, parent): | |||
self.infoArea = LineInfoArea(self) | |||
self.statistics = (0, 0, 0) | |||
self.statsArea = TextInfoArea(self) | |||
self.returnBlockPattern = re.compile("^[\\s]*([*>-]|\\d+\\.) ") | |||
self.orderedListPattern = re.compile("^([\\s]*)(\\d+)\\. $") |
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.
I would move it to class level (below the scrollLimitReached = pyqtSignal(QWheelEvent)
line) for even more performance :)
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.
Done :)
This allows to continue an ordered list by pressing return, the same way unordered lists and quote blocks are handled. I changed the detection to use a regex that might ease other supports
c2fd36d
to
9ea6ca8
Compare
Merged. Thanks a lot! |
This allows to continue an ordered list by pressing return, the same way
unordered lists and quote blocks are handled.
I changed the detection to use a regex that might ease other supports