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

Don't insert * after new line in multi-line comment if previous line … #3392

Merged
merged 2 commits into from
Feb 17, 2023

Conversation

ntrel
Copy link
Member

@ntrel ntrel commented Feb 8, 2023

…doesn't start with *

Fixes #3386.

Note: This was already the case when the previous line is blank, but a * was inserted when it is not blank.

if (style == SCE_D_COMMENTNESTED)
continuation = "+"; /* for nested comments in D */

else if (!(g_str_has_prefix(previous_line + i, continuation) &&
Copy link
Member

Choose a reason for hiding this comment

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

I'd just suggest inverting the condition (i.e. removing the initial !) and adding the 3 lines after this block inside the block. This way you avoid the duplicated g_free(previous_line); and the extra return.

Copy link
Member

Choose a reason for hiding this comment

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

Apart from that the PR looks fine to me and is useful, I also did run into this issue in the past.

Copy link
Member Author

Choose a reason for hiding this comment

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

That would break the first if clause before the else if on this line.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, right, sorry, I didn't think about that.

Copy link
Member Author

Choose a reason for hiding this comment

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

No problem, thanks for reviewing.

doc/geany.txt Outdated Show resolved Hide resolved
Copy link
Member

@b4n b4n left a comment

Choose a reason for hiding this comment

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

Looks good and works well 👍

@b4n b4n merged commit 00aaf37 into geany:master Feb 17, 2023
@b4n b4n added this to the 1.39/2.0 milestone Feb 17, 2023
@ntrel ntrel deleted the smart-continue-comment branch February 18, 2023 15:42
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.

Don't insert * on comment continuation if previous line doesn't start with *
4 participants