Changeset View
Changeset View
Standalone View
Standalone View
src/script/data/indentation/cstyle.js
Context not available. | |||||
261 | */ | 261 | */ | ||
---|---|---|---|---|---|
262 | function tryCComment(line) | 262 | function tryCComment(line) | ||
263 | { | 263 | { | ||
264 | dbg("tryCComment line: " + line); | ||||
264 | var currentLine = document.prevNonEmptyLine(line - 1); | 265 | var currentLine = document.prevNonEmptyLine(line - 1); | ||
265 | if (currentLine < 0) | 266 | if (currentLine < 0) | ||
266 | return -1; | 267 | return -1; | ||
Context not available. | |||||
756 | var prevFirstPos = document.firstColumn(line - 1); | 757 | var prevFirstPos = document.firstColumn(line - 1); | ||
757 | var lastPos = document.lastColumn(line); | 758 | var lastPos = document.lastColumn(line); | ||
758 | 759 | | |||
759 | dbg("firstPos: " + firstPos); | 760 | dbg("firstPos: " + firstPos); | ||
760 | dbg("column..: " + column); | 761 | dbg("column..: " + column); | ||
762 | dbg("char : " + c); | ||||
761 | 763 | | |||
762 | if (firstPos == column - 1 && c == '{') { | 764 | if (firstPos == column - 1 && c == '{') { | ||
763 | // todo: maybe look for if etc. | 765 | // todo: maybe look for if etc. | ||
Context not available. | |||||
785 | } else if (cfgSnapSlash && c == '/' && lastPos == column - 1) { | 787 | } else if (cfgSnapSlash && c == '/' && lastPos == column - 1) { | ||
786 | // try to snap the string "* /" to "*/" | 788 | // try to snap the string "* /" to "*/" | ||
787 | var currentString = document.line(line); | 789 | var currentString = document.line(line); | ||
788 | if (currentString.search(/^(\s*)\*\s+\/\s*$/) != -1) { | 790 | var regex = /^(\s*)\*\s+\/\s*$/; | ||
791 | if (regex.test(currentString)) { | ||||
789 | currentString = RegExp.$1 + "*/"; | 792 | currentString = RegExp.$1 + "*/"; | ||
790 | document.editBegin(); | 793 | document.editBegin(); | ||
791 | document.removeLine(line); | 794 | document.removeLine(line); | ||
Context not available. |