# HG changeset patch # User Bram Moolenaar # Date 1552840214 -3600 # Node ID 7fd3a9eaeedb7f7fbf173682f27bb50d47880c4c # Parent dc766e1b0c954f1adea9556671ae2a5b77d9f8d1 patch 8.1.1017: off-by-one error in filetype detection commit https://github.com/vim/vim/commit/493fbe4abee660d30b4f2aef87b754b0a720213c Author: Bram Moolenaar Date: Sun Mar 17 17:16:12 2019 +0100 patch 8.1.1017: off-by-one error in filetype detection Problem: Off-by-one error in filetype detection. Solution: Also check the last line of the file. diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -197,7 +197,7 @@ func dist#ft#FTe() exe 'setf ' . g:filetype_euphoria else let n = 1 - while n < 100 && n < line("$") + while n < 100 && n <= line("$") if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$" setf specman return @@ -211,7 +211,7 @@ endfunc " Distinguish between HTML, XHTML and Django func dist#ft#FThtml() let n = 1 - while n < 10 && n < line("$") + while n < 10 && n <= line("$") if getline(n) =~ '\