From 493fbe4abee660d30b4f2aef87b754b0a720213c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Mar 2019 17:16:12 +0100 Subject: [PATCH] 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. --- runtime/autoload/dist/ft.vim | 12 ++++++------ src/version.c | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index de45faa4f..a97bad3b5 100644 --- 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) =~ '\