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

Fix spaces before \middle #689

Merged
merged 1 commit into from
May 12, 2017
Merged

Fix spaces before \middle #689

merged 1 commit into from
May 12, 2017

Conversation

kohler
Copy link
Collaborator

@kohler kohler commented Apr 30, 2017

Shift spaces back into the replacement middle delimiter. Fix #683.

Shift spaces back into the replacement middle delimiter.
Copy link
Member

@edemaine edemaine left a comment

Choose a reason for hiding this comment

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

Overall, this looks like a nice fix. I didn't realize that you could have multiple \middles, so this is clearly the right approach. I like the refactoring into spliceSpaces. I have just a few small suggestions.

* a space.
*/
const spliceSpaces = function(children, i) {
let j = i;
Copy link
Member

@edemaine edemaine May 10, 2017

Choose a reason for hiding this comment

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

Perhaps it would be more intuitive to give i a default value of 0, via let j = i || 0? (as in, e.g., String.prototype.includes)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, thanks.

i--;
} else if (spaces) {
const spaces = spliceSpaces(groups, i);
if (spaces && i < groups.length) {
Copy link
Member

Choose a reason for hiding this comment

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

if (spaces && ...) else if (spaces) ... seems a little weird / hard to understand.
How about if (spaces) { if (i < groups.length) ... else ... }?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, thanks.

Copy link
Member

Choose a reason for hiding this comment

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

Really? Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If I thought the code was clearer the way you suggested I would have written it that way. I don't like deeply nested if statements. And it is clearly a matter of taste.

You are asking me for ten minutes or so of work for trivial changes. Like five seconds of typing then ten minutes to rerun the tests just to verify nothing broke, jank around with the GitHub PR, etc. I already spent a lot of time making the fix. As well as writing the original feature—not because I needed it myself, but because I was grateful for KaTeX and wanted to help out with features the main developers wanted.

Projects that want contributions walk a balance between enforcing standards and respecting their contributors' time. As a contributor, I see no standards involved with your comments, and I consider these particular requests less than respectful of my time.

Copy link
Member

Choose a reason for hiding this comment

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

I'm sorry that you felt your time was disrespected -- not my intent. We certainly appreciate the time you've spent in fixing this bug (and in implementing the original feature). I'll move this agreed-to-be stylistic issue to a separate PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks very much for understanding. I absolutely appreciate your work also, and hope there's no hard feelings. I think it's important that code reviewers for open-source projects understand when they're asking for important functionality changes vs. important stylistic changes vs. tweaks on matters of taste, and thus hope this exchange has been useful for both of us.

middleDelim.isMiddle.value, innerHeight, innerDepth,
middleDelim.isMiddle.options, group.mode, []);
// Add back spaces shifted into the delimiter
const spaces = spliceSpaces(middleDelim.children, 0);
Copy link
Member

Choose a reason for hiding this comment

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

Could use default 0 value of i here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Does not seem important.

@edemaine edemaine changed the title Fix #683. Fix spaces before \middle May 10, 2017
@edemaine edemaine merged commit 7192bd6 into KaTeX:master May 12, 2017
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