Skip to content

Commit

Permalink
automatically add terminator for doxygen comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Dec 10, 2012
1 parent 90e8082 commit bd8b016
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gwt/acesupport/acemode/c_cpp.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,15 @@ oop.inherits(Mode, TextMode);
this.transformAction = function(state, action, editor, session, text) {
if (action === 'insertion') {
if (text === "\n") {
// If newline in a doxygen comment, continue the comment
// If beginning of doxygen comment, provide the end
var pos = editor.getSelectionRange().start;
var match = /^((\s*\/\/+')\s*)/.exec(session.doc.getLine(pos.row));
var match = /^(\/\*[\*\!]\s*)/.exec(session.doc.getLine(pos.row));
if (match && editor.getSelectionRange().start.column >= match[1].length) {
return {text: "\n * \n */\n",
selection: [1, 3, 1, 3]};
}
// If newline in a doxygen comment, continue the comment
match = /^((\s*\/\/+')\s*)/.exec(session.doc.getLine(pos.row));
if (match && editor.getSelectionRange().start.column >= match[2].length) {
return {text: "\n" + match[1]};
}
Expand Down

0 comments on commit bd8b016

Please sign in to comment.