@@ -1188,25 +1188,24 @@ void TextEditInput::editEnter() {
1188
1188
1189
1189
if (prevLineStart || _cursorLine == 1 ) {
1190
1190
char spaces[LINE_BUFFER_SIZE];
1191
- int indent = getIndent (spaces, sizeof (spaces), prevLineStart);
1192
- if (indent) {
1193
- // check whether the previous line was a comment
1194
- if (prevLineStart) {
1195
- char *buf = lineText (prevLineStart);
1196
- int pos = 0 ;
1197
- while (buf && (buf[pos] == ' ' || buf[pos] == ' \t ' )) {
1198
- pos++;
1199
- }
1200
- if ((buf[pos] == ' #' || buf[pos] == ' \' ' ) && indent + 2 < LINE_BUFFER_SIZE) {
1201
- spaces[indent] = buf[pos];
1202
- spaces[++indent] = ' ' ;
1203
- spaces[++indent] = ' \0 ' ;
1204
- } else if (strncasecmp (buf + pos, " rem" , 3 ) == 0 ) {
1205
- indent = strlcat (spaces, " rem " , LINE_BUFFER_SIZE);
1206
- }
1207
- free (buf);
1208
- }
1191
+ int indent = getIndent (spaces, LINE_BUFFER_SIZE, prevLineStart);
1209
1192
1193
+ // check whether the previous line was a comment
1194
+ char *buf = lineText (prevLineStart);
1195
+ int pos = 0 ;
1196
+ while (buf && (buf[pos] == ' ' || buf[pos] == ' \t ' )) {
1197
+ pos++;
1198
+ }
1199
+ if ((buf[pos] == ' #' || buf[pos] == ' \' ' ) && indent + 2 < LINE_BUFFER_SIZE) {
1200
+ spaces[indent] = buf[pos];
1201
+ spaces[++indent] = ' ' ;
1202
+ spaces[++indent] = ' \0 ' ;
1203
+ } else if (strncasecmp (buf + pos, " rem" , 3 ) == 0 ) {
1204
+ indent = strlcat (spaces, " rem " , LINE_BUFFER_SIZE);
1205
+ }
1206
+ free (buf);
1207
+
1208
+ if (indent) {
1210
1209
_buf.insertChars (_state.cursor , spaces, indent);
1211
1210
stb_text_makeundo_insert (&_state, _state.cursor , indent);
1212
1211
_state.cursor += indent;
0 commit comments