runtime(ssa): improve syntax file performance (#14654)
Commit:
https://github.com/vim/vim/commit/f351fd82920427b33a160cab9fdbc35ac1deb681
Author: ObserverOfTime <[email protected]>
Date: Sun Apr 28 17:22:55 2024 +0300
runtime(ssa): improve syntax file performance
(https://github.com/vim/vim/issues/14654)
fixes: https://github.com/vim/vim/issues/14653
Signed-off-by: ObserverOfTime <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/syntax/ssa.vim b/runtime/syntax/ssa.vim
index a5dbf37c3..3cfae816f 100644
--- a/runtime/syntax/ssa.vim
+++ b/runtime/syntax/ssa.vim
@@ -2,7 +2,7 @@
" Language: SubStation Alpha
" Maintainer: ObserverOfTime <[email protected]>
" Filenames: *.ass,*.ssa
-" Last Change: 2022 Oct 10
+" Last Change: 2024 Apr 28
if exists('b:current_syntax')
finish
@@ -20,16 +20,20 @@ syn match ssaSection /^\[[a-zA-Z0-9+ ]\+\]$/
syn match ssaHeader /^[^;!:]\+:/ skipwhite nextgroup=ssaField
" Fields
-syn match ssaField /[^,]*/ contained skipwhite nextgroup=ssaDelimiter
+syn match ssaField /[^,]*\(,\|$\)/ contained skipwhite
contains=ssaDelimiter,ssaTime nextgroup=ssaField
" Time
-syn match ssaTime /\d:\d\d:\d\d\.\d\d/ contained skipwhite
nextgroup=ssaDelimiter
+syn match ssaTime /\d:\d\d:\d\d\.\d\d/ contained
" Delimiter
-syn match ssaDelimiter /,/ contained skipwhite
nextgroup=ssaField,ssaTime,ssaText
+syn match ssaDelimiter /,/ contained
+
+" Dialogue
+syn match ssaDialogue /^Dialogue:/ transparent skipwhite
nextgroup=ssaDialogueFields
+syn match ssaDialogueFields /\([^,]*,\)\{9\}/ contained transparent skipwhite
contains=ssaField,ssaDelimiter nextgroup=ssaText
" Text
-syn match ssaText /\(^Dialogue:\(.*,\)\{9}\)\@<=.*$/ contained
contains=@ssaTags,@Spell
+syn match ssaText /.*$/ contained contains=@ssaTags,@Spell
syn cluster ssaTags
contains=ssaOverrideTag,ssaEscapeChar,ssaTextComment,ssaItalics,ssaBold,ssaUnderline,ssaStrikeout
" Override tags
@@ -60,4 +64,4 @@ hi ssaItalics cterm=italic gui=italic
hi ssaStrikeout cterm=strikethrough gui=strikethrough
hi ssaUnderline cterm=underline gui=underline
-let b:current_syntax = 'srt'
+let b:current_syntax = 'ssa'
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1s15Xf-002h4m-4b%40256bit.org.