@@ -249,29 +249,25 @@ indentation points to the right, we switch going to the left."
249249 ; ; try to repeat
250250 (when (not (haskell-indentation-indent-line-repeat))
251251 (setq haskell-indentation-dyn-last-direction nil )
252- ; ; do nothing if we're inside a string or comment
253- (unless (save-excursion
254- (beginning-of-line )
255- (nth 8 (syntax-ppss )))
256- ; ; parse error is intentionally not cought here, it may come from
257- ; ; `haskell-indentation-find-indentations' , but escapes the scope
258- ; ; and aborts the opertaion before any moving happens
259- (let* ((cc (current-column ))
260- (ci (haskell-indentation-current-indentation))
261- (inds (save-excursion
262- (move-to-column ci)
263- (or (haskell-indentation-find-indentations)
264- '(0 ))))
265- (valid (memq ci inds))
266- (cursor-in-whitespace (< cc ci)))
267-
268- (if (and valid cursor-in-whitespace)
269- (move-to-column ci)
270- (haskell-indentation-reindent-to
271- (haskell-indentation-next-indentation ci inds 'nofail )
272- cursor-in-whitespace))
273- (setq haskell-indentation-dyn-last-direction 'right
274- haskell-indentation-dyn-last-indentations inds)))))
252+ ; ; parse error is intentionally not cought here, it may come from
253+ ; ; `haskell-indentation-find-indentations' , but escapes the scope
254+ ; ; and aborts the opertaion before any moving happens
255+ (let* ((cc (current-column ))
256+ (ci (haskell-indentation-current-indentation))
257+ (inds (save-excursion
258+ (move-to-column ci)
259+ (or (haskell-indentation-find-indentations)
260+ '(0 ))))
261+ (valid (memq ci inds))
262+ (cursor-in-whitespace (< cc ci)))
263+
264+ (if (and valid cursor-in-whitespace)
265+ (move-to-column ci)
266+ (haskell-indentation-reindent-to
267+ (haskell-indentation-next-indentation ci inds 'nofail )
268+ cursor-in-whitespace))
269+ (setq haskell-indentation-dyn-last-direction 'right
270+ haskell-indentation-dyn-last-indentations inds))))
275271
276272(defun haskell-indentation-indent-line-repeat ()
277273 " Cycle though indentation positions."
@@ -453,7 +449,20 @@ indentation points to the right, we switch going to the left."
453449 (let ((ppss (syntax-ppss )))
454450 (cond
455451 ((nth 3 ppss)
456- (haskell-indentation-first-indentation))
452+ (if (save-excursion
453+ (and (forward-line -1 )
454+ (< (nth 8 ppss) (point ))))
455+ ; ; if this string goes over more than one line we want to
456+ ; ; sync with the last line, not the first one
457+ (list (save-excursion
458+ (forward-line -1 )
459+ (current-indentation )))
460+
461+ (append
462+ (haskell-indentation-first-indentation)
463+ (list (save-excursion
464+ (goto-char (nth 8 ppss))
465+ (current-column ))))))
457466 ((nth 4 ppss)
458467 (if (save-excursion
459468 (and (skip-syntax-forward " -" )
0 commit comments