From 79b92da0d289d1adcd0bb27c7ee5786be460c166 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 31 Jan 2022 15:27:01 +0100 Subject: vim-patch:partial:f10911e5db16 (#17248) Update runtime files https://github.com/vim/vim/commit/f10911e5db16f1fe6ab519c5d091ad0c1df0d063 --- runtime/autoload/freebasic.vim | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 runtime/autoload/freebasic.vim (limited to 'runtime/autoload/freebasic.vim') diff --git a/runtime/autoload/freebasic.vim b/runtime/autoload/freebasic.vim new file mode 100644 index 0000000000..fe6d2745be --- /dev/null +++ b/runtime/autoload/freebasic.vim @@ -0,0 +1,42 @@ +" Vim filetype plugin file +" Language: FreeBASIC +" Maintainer: Doug Kearns +" Last Change: 2021 Mar 16 + +" Dialects can be one of fb, qb, fblite, or deprecated +" Precedence is forcelang > #lang > lang +function! freebasic#GetDialect() abort + if exists("g:freebasic_forcelang") + return g:freebasic_forcelang + endif + + if exists("g:freebasic_lang") + let dialect = g:freebasic_lang + else + let dialect = "fb" + endif + + " override with #lang directive or metacommand + + let skip = "has('syntax_items') && synIDattr(synID(line('.'), col('.'), 1), 'name') =~ 'Comment$'" + let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"' + + let save_cursor = getcurpos() + call cursor(1, 1) + " let lnum = search(pat, 'n', '', '', skip) " 'skip' needs 8.2.0915 + let lnum = search(pat, 'n', '', '') + call setpos('.', save_cursor) + + if lnum + let word = matchlist(getline(lnum), pat)[1] + if word =~? '\%(fb\|deprecated\|fblite\|qb\)' + let dialect = word + else + echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum) + endif + endif + + return dialect +endfunction + +" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: -- cgit From cdb2c100118ab788772a6a0a1d60f555370fd201 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Tue, 1 Feb 2022 12:44:14 +0000 Subject: vim-patch:8.2.0915: search() cannot skip over matches like searchpair() can Problem: Search() cannot skip over matches like searchpair() can. Solution: Add an optional "skip" argument. (Christian Brabandt, closes vim/vim#861) https://github.com/vim/vim/commit/adc17a5f9d207fd1623fd923457a46efc9214777 Enable skip arg usage in autoload/freebasic.vim evalarg_T doesn't really matter because it's deleted in v8.2.0918 (and reincarnated for Vim9 script in v8.2.1047), but I found out too late :P Anyway: - Port evalarg_T into eval.h and use const char * and Callback fields - Use EVALARG_INIT to initialize - Return bool over OK/FAIL from evalarg functions - Remove check from evalarg_clean as callback_free ignores None callbacks anyway - Move eva_buf field into evalarg_get as a local (not sure what reason it has being in the struct) N/A patches for version.c: vim-patch:8.2.4355: unnecessary call to check_colorcolumn() Problem: Unnecessary call to check_colorcolumn(). Solution: Remove the call. (Sean Dewar, closes vim/vim#9748) https://github.com/vim/vim/commit/0f7ff851cb721bb3c07261adbf82b591229f530d --- runtime/autoload/freebasic.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime/autoload/freebasic.vim') diff --git a/runtime/autoload/freebasic.vim b/runtime/autoload/freebasic.vim index fe6d2745be..428cf1382b 100644 --- a/runtime/autoload/freebasic.vim +++ b/runtime/autoload/freebasic.vim @@ -23,8 +23,7 @@ function! freebasic#GetDialect() abort let save_cursor = getcurpos() call cursor(1, 1) - " let lnum = search(pat, 'n', '', '', skip) " 'skip' needs 8.2.0915 - let lnum = search(pat, 'n', '', '') + let lnum = search(pat, 'n', '', '', skip) call setpos('.', save_cursor) if lnum -- cgit From 662681694bf2e30b1f33ad235274c82a334ff742 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 2 Jul 2022 11:06:03 +0200 Subject: vim-patch:0d878b95d8f9 (#19197) Update runtime files https://github.com/vim/vim/commit/0d878b95d8f9ece2fdba81050f5caba224540f9c --- runtime/autoload/freebasic.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'runtime/autoload/freebasic.vim') diff --git a/runtime/autoload/freebasic.vim b/runtime/autoload/freebasic.vim index 428cf1382b..6c94cd34ea 100644 --- a/runtime/autoload/freebasic.vim +++ b/runtime/autoload/freebasic.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: FreeBASIC " Maintainer: Doug Kearns -" Last Change: 2021 Mar 16 +" Last Change: 2022 June 24 " Dialects can be one of fb, qb, fblite, or deprecated " Precedence is forcelang > #lang > lang @@ -18,17 +18,16 @@ function! freebasic#GetDialect() abort " override with #lang directive or metacommand - let skip = "has('syntax_items') && synIDattr(synID(line('.'), col('.'), 1), 'name') =~ 'Comment$'" let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"' let save_cursor = getcurpos() call cursor(1, 1) - let lnum = search(pat, 'n', '', '', skip) + let lnum = search(pat, 'cn') call setpos('.', save_cursor) if lnum let word = matchlist(getline(lnum), pat)[1] - if word =~? '\%(fb\|deprecated\|fblite\|qb\)' + if word =~? '\<\%(fb\|deprecated\|fblite\|qb\)\>' let dialect = word else echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum) -- cgit