From 19d8ed4d60ed3f7899cb6702cecd6a2344336d6a Mon Sep 17 00:00:00 2001 From: Dominik Seeger <dominik.seeger@gmx.net> Date: Thu, 21 Feb 2019 14:12:08 +0100 Subject: [PATCH] fixed incorrect block comment highlighting --- frontend/src/store/modules/submission-notes.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/store/modules/submission-notes.ts b/frontend/src/store/modules/submission-notes.ts index 87f35f37..96688676 100644 --- a/frontend/src/store/modules/submission-notes.ts +++ b/frontend/src/store/modules/submission-notes.ts @@ -63,7 +63,12 @@ const submissionGetter = mb.read(function submission (state, getters) { ? getters.submissionType.programmingLanguage : 'c' const highlighted = hljs.highlight(language, state.submission.text || '', true).value + + let commentFlag = false return highlighted.split('\n').reduce((acc: {[k: number]: string}, cur, index) => { + if (cur.includes("/*")) commentFlag = true + cur = commentFlag ? '<span class="hljs-comment">' + cur + '</span>' : cur + if (cur.includes("*/")) commentFlag = false // so that the ending line will also be greyed out acc[index + 1] = cur return acc }, {}) -- GitLab