-
Notifications
You must be signed in to change notification settings - Fork 5.3k
fix: don't add additional asterisks in c style docs #5323
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
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #5323 +/- ##
=======================================
Coverage 87.38% 87.38%
=======================================
Files 574 574
Lines 45534 45542 +8
Branches 6935 6935
=======================================
+ Hits 39788 39796 +8
Misses 5746 5746
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
@@ -311,7 +311,8 @@ var CstyleBehaviour = function(options) { | |||
var line = session.doc.getLine(cursor.row); | |||
var nextLine = session.doc.getLine(cursor.row + 1); | |||
var indent = this.$getIndent(line); | |||
if (/\s*\*/.test(nextLine)) { | |||
const beforeCursor = line.substring(0, cursor.column); | |||
if (/\s*\*/.test(nextLine) && /\*/.test(beforeCursor)) { |
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.
Wouldn't this match a * b /**comment*/
with cursor before the comment ?
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.
Hmm, I don't think so because we still check if there is an *
in next line, so I guess it would match:
a * b /**<cursor>comment*/
*
Which would be turned into
a * b /**
* <cursor>comment*/
*
I think, but let me double check this. Nice test example!!
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 so actually nothing cool happens because state is not "doc-start"
, so it just goes into new line.
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, my bad for including */
in the end of the example. In default js example of this pull request https://raw.githack.com/ajaxorg/ace/d52d9b32e5eb23a2a1981bf2b10344ede05b2214/kitchen-sink.html, if i press enter at the start of the file, the bug is indeed fixed, but if i type *
at the start and only then press enter the comment indentation is applied.
We either need to test for a more specific pattern, or compute the state in the middle of line like outdent does.
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.
@marinsokol5 I could reproduce the issue highlighted by @nightwing, could you please take a look into it and update your PR to address it?
#5571 which fixes the same issue was merged, I am closing this one |
Issue #, if available:
#5320
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.