-
Notifications
You must be signed in to change notification settings - Fork 152
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 newline at start or end of section #53
Conversation
1c61002
to
db8690f
Compare
} else { | ||
// start of section, remove the existing marker and add a blank one | ||
section.markers.remove(marker); | ||
section.markers.append(this.builder.createBlankMarker()); |
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.
Not needed, but alternatively:
section.markers.splice(marker, 1, [this.builder.createBlankMarker()]);
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.
Oh I'm sorry, I misread this. You're removing a marker from some arbitrary place and only appending the blank marker, all the time.
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'm confused- shouldn't the blank marker be in a new section?
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.
Yeah, agreed, this is fairly confusing. I'm reworking this to be a bit more declarative.
hold off on merging for the moment. I'm reworking |
* simplify section#splitMarker * tests for hitting enter in middle and end of section * add test for hitting enter in first section * fix bug with PostNodeBuilder not assigning a builder to the blank marker fixes #39
db8690f
to
3f113b3
Compare
@mixonic this is ready now if you want to look it over |
*/ | ||
coalesceMarkers() { | ||
forEach( | ||
filter(this.markers, m => m.empty()), |
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.
m.empty
should probably be m.isEmpty
Also doing a filter only to pass it to another iterator seems wasteful- this could be done in a single pass with an if
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.
changed the loop on master, we can ponder empty
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.
@mixonic removing markers while iterating them causes the iteration to skip (item.next
is something different before/after the callback). I have a PR coming to fix iteration of the linkedlist
Handle newline at start or end of section
Handle newline at start of section
fixes #39