aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/file_types.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2020-03-26 17:37:08 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2020-03-26 17:37:08 -0400
commit940732342827ebe0d3bb98740419f621f9c77391 (patch)
tree32a3a6ac703429ca036e73c5215bac4f87b0818f /modules/textadept/file_types.lua
parent52b0ec63792b3023b4ab42e42d2ce1e1fcb813bc (diff)
downloadtextadept-940732342827ebe0d3bb98740419f621f9c77391.tar.gz
textadept-940732342827ebe0d3bb98740419f621f9c77391.zip
Switched to 1-based indices for buffer positions, lines, and countable entities.
Diffstat (limited to 'modules/textadept/file_types.lua')
-rw-r--r--modules/textadept/file_types.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/textadept/file_types.lua b/modules/textadept/file_types.lua
index 21261093..2889734c 100644
--- a/modules/textadept/file_types.lua
+++ b/modules/textadept/file_types.lua
@@ -44,7 +44,7 @@ end
-- @param buffer The buffer to detect the language of.
-- @return lexer language or nil
local function detect_language(buffer)
- local line = buffer:get_line(0)
+ local line = buffer:get_line(1)
-- Detect from first line.
for patt, lexer in pairs(M.patterns) do
if line:find(patt) then return lexer end
@@ -71,7 +71,7 @@ local function set_lexer(buffer, lang)
if package.searchpath(lang, package.path) then _M[lang] = require(lang) end
if buffer ~= ui.command_entry then events.emit(events.LEXER_LOADED, lang) end
local last_line = buffer.first_visible_line + buffer.lines_on_screen
- buffer:colourise(0, buffer:position_from_line(last_line + 1)) -- refresh
+ buffer:colourise(1, buffer:position_from_line(last_line + 1)) -- refresh
end
-- Gives new buffers lexer-specific functions.