Merge pull request !2939 from rhodecode-enterprise-ce fix/slash_in_comment_edit

fix: fixes comment editing removes slash
This commit is contained in:
Andrii Verbytskyi 2026-01-05 13:58:24 +00:00
commit 1906b1960f

View file

@ -23,7 +23,7 @@
// Logger.get('CodeMirror').setLevel(Logger.DEBUG) // Logger.get('CodeMirror').setLevel(Logger.DEBUG)
cmLog = Logger.get('CodeMirror'); cmLog = Logger.get('CodeMirror');
cmLog.setLevel(Logger.OFF); cmLog.setLevel(Logger.ERROR);
//global cache for inline forms //global cache for inline forms
@ -426,8 +426,16 @@ var initCommentBoxCodeMirror = function(CommentForm, textAreaId, triggerActions)
searchText: "note comment", searchText: "note comment",
displayText: _gettext('Note Comment'), displayText: _gettext('Note Comment'),
hint: function(CodeMirror, data, completion) { hint: function(CodeMirror, data, completion) {
CodeMirror.replaceRange("", completion.from || data.from, let from = completion.from || data.from;
completion.to || data.to, "complete"); const to = completion.to || data.to;
// If the replacement range starts at '/', skip it so '/' remains
const line = cm.getLine(from.line);
if (line && line[from.ch] === "/") {
from = { line: from.line, ch: from.ch + 1 };
}
cm.replaceRange("", from, to, "complete");
$(CommentForm.commentType).val('note'); $(CommentForm.commentType).val('note');
}, },