branch: elpa/swift-mode commit 5074a028a2047bef61f395a67c37756b5dcd3878 Author: taku0 <mxxouy6x3m_git...@tatapa.org> Commit: taku0 <mxxouy6x3m_git...@tatapa.org>
Fix font-lock of successive identifiers Example: ```swift enum Foo: Error { .foo } ``` `Foo` was not fontified with `swift-mode:function-name-face`. --- swift-mode-font-lock.el | 4 ++-- test/swift-files/font-lock/font-lock.swift | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/swift-mode-font-lock.el b/swift-mode-font-lock.el index 3e403f3..2cd1106 100644 --- a/swift-mode-font-lock.el +++ b/swift-mode-font-lock.el @@ -361,8 +361,8 @@ The predicate MATCH-P is called with two arguments: (let ((result nil)) (while (and (< (point) limit) - (re-search-forward "\\<\\(\\sw\\|\\s_\\)+\\>" limit t) - (not result)) + (not result) + (re-search-forward "\\<\\(\\sw\\|\\s_\\)+\\>" limit t)) (when (save-excursion (save-match-data (funcall match-p (match-beginning 0) limit))) diff --git a/test/swift-files/font-lock/font-lock.swift b/test/swift-files/font-lock/font-lock.swift index 8669dd4..4113d74 100644 --- a/test/swift-files/font-lock/font-lock.swift +++ b/test/swift-files/font-lock/font-lock.swift @@ -30,11 +30,11 @@ foo != bar // "foo != bar" foo !== bar // "foo !== bar" -a.b.c! // #("a.b.c!" 4 5 (face swift-mode:property-access-face)) +a.b.c! // #("a.b.c!" 2 3 (face swift-mode:property-access-face) 4 5 (face swift-mode:property-access-face)) -a.b.c_! // #("a.b.c_!" 4 5 (face swift-mode:property-access-face)) +a.b.c_! // #("a.b.c_!" 2 3 (face swift-mode:property-access-face) 4 5 (face swift-mode:property-access-face)) -a.b.aあ! // #("a.b.a\343\201\202!" 4 8 (face swift-mode:property-access-face)) +a.b.aあ! // #("a.b.a\343\201\202!" 2 3 (face swift-mode:property-access-face) 4 8 (face swift-mode:property-access-face)) init! {} // #("init! {}" 0 4 (face swift-mode:keyword-face)) @@ -45,7 +45,13 @@ let x = foo()! // #("let x = foo()!" 0 3 (face swift-mode:keyword-face) 8 11 (fa let x = foo[0]! // #("let x = foo[0]!" 0 3 (face swift-mode:keyword-face)) // Identifiers can be quoted. -a.b.`c`! // #("a.b.`c`!" 4 7 (face font-lock-string-face)) +a.b.`c`! // #("a.b.`c`!" 2 3 (face swift-mode:property-access-face) 4 7 (face font-lock-string-face)) // Custom operators. foo +!+!+!+!+ bbb // "foo +!+!+!+!+ bbb" + +// +// Regression tests. +// + +enum Foo: Error { .foo } // #("enum Foo: Error { .foo }" 0 4 (face swift-mode:keyword-face) 5 8 (face swift-mode:function-name-face) 10 15 (face swift-mode:builtin-type-face) 19 22 (face swift-mode:property-access-face))