File tree Expand file tree Collapse file tree 2 files changed +29
-8
lines changed Expand file tree Collapse file tree 2 files changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -2168,6 +2168,35 @@ type Foo<T> where T: Copy = Box<T>;
2168
2168
'((10 11 ))
2169
2169
'(7 9 ))))
2170
2170
2171
+
2172
+ (ert-deftest font-lock-extend-region-in-string ()
2173
+
2174
+ (with-temp-buffer
2175
+ (rust-mode )
2176
+ (insert "
2177
+ fn foo() {
2178
+ let x = r\"
2179
+ Fontification needs to include this whole string or none of it.
2180
+ \"
2181
+ }" )
2182
+ (font-lock-fontify-buffer )
2183
+ (let ((font-lock-beg 13 )
2184
+ (font-lock-end 42 ))
2185
+ (rust-font-lock-extend-region)
2186
+ (should (<= font-lock-beg 13 ))
2187
+ (should (>= font-lock-end 106 ))
2188
+ )
2189
+ (let ((font-lock-beg 42 )
2190
+ (font-lock-end 108 ))
2191
+ (rust-font-lock-extend-region)
2192
+ (should (<= font-lock-beg 25 ))
2193
+ (should (>= font-lock-end 108 )))
2194
+ (let ((font-lock-beg 1 )
2195
+ (font-lock-end 12 ))
2196
+ (rust-font-lock-extend-region)
2197
+ (should (<= font-lock-beg 1 ))
2198
+ (should (>= font-lock-end 12 )))))
2199
+
2171
2200
; ; If electric-pair-mode is available, load it and run the tests that use it. If not,
2172
2201
; ; no error--the tests will be skipped.
2173
2202
(require 'elec-pair nil t )
Original file line number Diff line number Diff line change 459
459
(goto-char (nth 8 end-ppss))
460
460
(ignore-errors (forward-sexp ))
461
461
(setq font-lock-end (max font-lock-end (point )))))
462
-
463
- ; ; If we have the beginning of a raw string in the region, make sure we have the end of
464
- ; ; it.
465
- (when (or beg-in-str end-in-str)
466
- (save-excursion
467
- (goto-char font-lock-beg)
468
- (while (and (< (point ) font-lock-end) (ignore-errors (rust-look-for-raw-string (buffer-end 1 )))))
469
- (setq font-lock-end (max font-lock-end (point )))))
470
462
)))
471
463
472
464
(or (/= font-lock-beg orig-beg)
You can’t perform that action at this time.
0 commit comments