From e2a2efc4325219d889c59c91329695717ed970bc Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 22 Nov 2020 13:00:10 -0500 Subject: vim-patch:8.2.2032: cabalconfig and cabalproject filetypes not recognized Problem: Cabalconfig and cabalproject filetypes not recognized. Solution: Detect more cabal files. (Marcin Szamotulski, closes vim/vim#7339) https://github.com/vim/vim/commit/dcbab75db3ba5e812f119e08cda6a02c6b028a14 N/A patches for version.c: vim-patch:8.1.1598: update to test file missing Problem: Update to test file missing. Solution: Update the popup window test file. https://github.com/vim/vim/commit/53a95d65840e9d48844fa0798f198eca765176e8 vim-patch:8.1.1601: missing changes to popup window test file Problem: Missing changes to popup window test file. Solution: Add those changes. https://github.com/vim/vim/commit/8da41816316f17382817df3f9449b55df8d39651 --- runtime/filetype.vim | 15 +++++++++++++-- src/nvim/testdir/test_filetype.vim | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 4e617052a9..4e54bcaefd 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -692,12 +692,21 @@ au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc au BufNewFile,BufRead *.haml setf haml " Hamster Classic | Playground files -au BufNewFile,BufRead *.hsc,*.hsm setf hamster +au BufNewFile,BufRead *.hsm setf hamster +au BufNewFile,BufRead *.hsc + \ if match(join(getline(1,10), "\n"), '\%(^\|\n\)\s*\%({-#\_s*LANGUAGE\>\|\\)') != -1 | + \ setf haskell | + \ else | + \ setf hamster | + \ endif " Haskell au BufNewFile,BufRead *.hs,*.hs-boot setf haskell au BufNewFile,BufRead *.lhs setf lhaskell au BufNewFile,BufRead *.chs setf chaskell +au BufNewFile,BufRead cabal.project setf cabalproject +au BufNewFile,BufRead $HOME/.cabal/config setf cabalconfig +au BufNewFile,BufRead cabal.config setf cabalconfig " Haste au BufNewFile,BufRead *.ht setf haste @@ -2042,12 +2051,14 @@ au BufNewFile,BufRead bzr_log.* setf bzr " Bazel build file if !has("fname_case") - au BufNewFile,BufRead *.BUILD,BUILD setf bzl + au BufNewFile,BufRead *.BUILD,BUILD setf bzl endif " BIND zone au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone') +au BufNewFile,BufRead cabal.project.* call s:StarSetf('cabalproject') + " Calendar au BufNewFile,BufRead */.calendar/*, \*/share/calendar/*/calendar.*,*/share/calendar/calendar.* diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index af8482bdbe..ed75bda7a5 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -86,6 +86,8 @@ let s:filename_checks = { \ 'bzr': ['bzr_log.any'], \ 'c': ['enlightenment/file.cfg', 'file.qc', 'file.c'], \ 'cabal': ['file.cabal'], + \ 'cabalconfig': ['cabal.config'], + \ 'cabalproject': ['cabal.project', 'cabal.project.local'], \ 'calendar': ['calendar'], \ 'catalog': ['catalog', 'sgml.catalogfile'], \ 'cdl': ['file.cdl'], -- cgit From 15e5acada97685d11cf93af705df0f093abd271a Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 22 Nov 2020 14:52:16 -0500 Subject: vim-patch:8.1.2332: missing file in refactoring Problem: Missing file in refactoring. Solution: Update missing file. https://github.com/vim/vim/commit/556ae8ea28b4e3e9fc47ad130795009a3080146e --- src/nvim/option.c | 40 ----------------------------------- src/nvim/search.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 49 deletions(-) diff --git a/src/nvim/option.c b/src/nvim/option.c index 0a91687352..146bce8cc0 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -7173,46 +7173,6 @@ int get_sts_value(void) return (int)result; } -/// Check matchpairs option for "*initc". -/// If there is a match set "*initc" to the matching character and "*findc" to -/// the opposite character. Set "*backwards" to the direction. -/// When "switchit" is true swap the direction. -void find_mps_values(int *initc, int *findc, int *backwards, int switchit) -{ - char_u *ptr = curbuf->b_p_mps; - - while (*ptr != NUL) { - if (utf_ptr2char(ptr) == *initc) { - if (switchit) { - *findc = *initc; - *initc = utf_ptr2char(ptr + utfc_ptr2len(ptr) + 1); - *backwards = true; - } else { - *findc = utf_ptr2char(ptr + utfc_ptr2len(ptr) + 1); - *backwards = false; - } - return; - } - char_u *prev = ptr; - ptr += utfc_ptr2len(ptr) + 1; - if (utf_ptr2char(ptr) == *initc) { - if (switchit) { - *findc = *initc; - *initc = utf_ptr2char(prev); - *backwards = false; - } else { - *findc = utf_ptr2char(prev); - *backwards = true; - } - return; - } - ptr += utfc_ptr2len(ptr); - if (*ptr == ',') { - ptr++; - } - } -} - /// This is called when 'breakindentopt' is changed and when a window is /// initialized static bool briopt_check(win_T *wp) diff --git a/src/nvim/search.c b/src/nvim/search.c index f979889540..90e1e25de2 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1658,6 +1658,48 @@ static bool find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos) return found; } +/// Check matchpairs option for "*initc". +/// If there is a match set "*initc" to the matching character and "*findc" to +/// the opposite character. Set "*backwards" to the direction. +/// When "switchit" is true swap the direction. +static void find_mps_values(int *initc, int *findc, bool *backwards, + bool switchit) + FUNC_ATTR_NONNULL_ALL +{ + char_u *ptr = curbuf->b_p_mps; + + while (*ptr != NUL) { + if (utf_ptr2char(ptr) == *initc) { + if (switchit) { + *findc = *initc; + *initc = utf_ptr2char(ptr + utfc_ptr2len(ptr) + 1); + *backwards = true; + } else { + *findc = utf_ptr2char(ptr + utfc_ptr2len(ptr) + 1); + *backwards = false; + } + return; + } + char_u *prev = ptr; + ptr += utfc_ptr2len(ptr) + 1; + if (utf_ptr2char(ptr) == *initc) { + if (switchit) { + *findc = *initc; + *initc = utf_ptr2char(prev); + *backwards = false; + } else { + *findc = utf_ptr2char(prev); + *backwards = true; + } + return; + } + ptr += utfc_ptr2len(ptr); + if (*ptr == ',') { + ptr++; + } + } +} + /* * findmatchlimit -- find the matching paren or brace, if it exists within * maxtravel lines of the cursor. A maxtravel of 0 means search until falling @@ -1684,7 +1726,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel) static pos_T pos; // current search position int findc = 0; // matching brace int count = 0; // cumulative number of braces - int backwards = false; // init for gcc + bool backwards = false; // init for gcc bool raw_string = false; // search for raw string bool inquote = false; // true when inside quotes char_u *ptr; @@ -1729,9 +1771,10 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel) raw_string = (initc == 'R'); initc = NUL; } else if (initc != '#' && initc != NUL) { - find_mps_values(&initc, &findc, &backwards, TRUE); - if (findc == NUL) + find_mps_values(&initc, &findc, &backwards, true); + if (findc == NUL) { return NULL; + } } else { /* * Either initc is '#', or no initc was given and we need to look @@ -1759,20 +1802,20 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel) else if (linep[pos.col] == '/') { if (linep[pos.col + 1] == '*') { comment_dir = FORWARD; - backwards = FALSE; + backwards = false; pos.col++; } else if (pos.col > 0 && linep[pos.col - 1] == '*') { comment_dir = BACKWARD; - backwards = TRUE; + backwards = true; pos.col--; } } else if (linep[pos.col] == '*') { if (linep[pos.col + 1] == '/') { comment_dir = BACKWARD; - backwards = TRUE; + backwards = true; } else if (pos.col > 0 && linep[pos.col - 1] == '/') { comment_dir = FORWARD; - backwards = FALSE; + backwards = false; } } } @@ -1794,9 +1837,10 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel) if (initc == NUL) break; - find_mps_values(&initc, &findc, &backwards, FALSE); - if (findc) + find_mps_values(&initc, &findc, &backwards, false); + if (findc) { break; + } pos.col += utfc_ptr2len(linep + pos.col); } if (!findc) { -- cgit