@@ -225,11 +225,15 @@ declaration and its offset is `swift-mode:basic-offset'."
225
225
(swift-mode:indentation (point ) 0 )))))
226
226
227
227
(defun swift-mode:calculate-indent-of-multiline-string ()
228
- " Return the indentation of the current line inside a multiline string."
228
+ " Return the indentation of the current line inside a multiline string.
229
+
230
+ Also used for regexes."
229
231
(back-to-indentation )
230
232
(let ((string-beginning-position
231
233
(save-excursion (swift-mode:beginning-of-string))))
232
- (if (looking-at " \"\"\" " )
234
+ (if (and (looking-at " \\ (\"\"\" \\ |/\\ )#*" )
235
+ (equal (get-text-property (1- (match-end 0 )) 'syntax-table )
236
+ (string-to-syntax " |" )))
233
237
; ; The last line.
234
238
(progn
235
239
(goto-char string-beginning-position)
@@ -240,13 +244,13 @@ declaration and its offset is `swift-mode:basic-offset'."
240
244
(swift-mode:goto-non-interpolated-expression-bol)
241
245
(back-to-indentation )
242
246
(if (<= (point ) string-beginning-position)
243
- ; ; The cursor was on the 2nd line of the comment , so aligns with
247
+ ; ; The cursor was on the 2nd line of the string , so aligns with
244
248
; ; that line with offset.
245
249
(progn
246
250
(goto-char string-beginning-position)
247
251
(swift-mode:calculate-indent-of-expression
248
252
swift-mode:multiline-statement-offset))
249
- ; ; The cursor was on the 3rd or following lines of the comment , so
253
+ ; ; The cursor was on the 3rd or following lines of the string , so
250
254
; ; aligns with a non-empty preceding line.
251
255
(if (and (bolp ) (eolp ))
252
256
; ; The cursor is on an empty line, so seeks a non-empty-line.
0 commit comments