aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2016-06-15 23:45:19 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2016-06-15 23:45:19 -0400
commitb2a88f20460e036012156aa2085114befadfd9af (patch)
treedc3e78c6997f397368899bc1c29d548b43841ce4 /modules
parent58215262ab9c8b104980abe867754af83a978737 (diff)
`textadept.editing.goto_line()` takes 0-based line number.
It used to take a 1-based line number. Mimic Scintilla.
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/bookmarks.lua4
-rw-r--r--modules/textadept/editing.lua5
-rw-r--r--modules/textadept/find.lua2
-rw-r--r--modules/textadept/run.lua4
4 files changed, 8 insertions, 7 deletions
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua
index 24eea717..9f2d1c10 100644
--- a/modules/textadept/bookmarks.lua
+++ b/modules/textadept/bookmarks.lua
@@ -74,7 +74,7 @@ function M.goto_mark(next)
}
if button ~= 1 or not mark then return end
view:goto_buffer(buffers[mark])
- textadept.editing.goto_line(utf8_list[mark]:match('^[^:]+:(%d+):'))
+ textadept.editing.goto_line(utf8_list[mark]:match('^[^:]+:(%d+):') - 1)
else
local f = next and buffer.marker_next or buffer.marker_previous
local current_line = buffer:line_from_position(buffer.current_pos)
@@ -82,7 +82,7 @@ function M.goto_mark(next)
if line == -1 then
line = f(buffer, (next and 0 or buffer.line_count), 2^M.MARK_BOOKMARK)
end
- if line >= 0 then textadept.editing.goto_line(line + 1) end
+ if line >= 0 then textadept.editing.goto_line(line) end
end
end
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index dddbf98a..f3c7223a 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -305,9 +305,10 @@ function M.goto_line(line)
}
line = tonumber(value)
if button ~= 1 or not line then return end
+ line = line - 1
end
- buffer:ensure_visible_enforce_policy(line - 1)
- buffer:goto_line(line - 1)
+ buffer:ensure_visible_enforce_policy(line)
+ buffer:goto_line(line)
end
---
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index 366e4774..cc73964e 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -437,7 +437,7 @@ function M.goto_file_found(line, next)
if not utf8_filename then return end
textadept.editing.select_line()
ui.goto_file(utf8_filename:iconv(_CHARSET, 'UTF-8'), true, preferred_view)
- textadept.editing.goto_line(line_num)
+ textadept.editing.goto_line(line_num - 1)
end
events.connect(events.KEYPRESS, function(code)
if keys.KEYSYMS[code] == '\n' and is_ff_buf(buffer) then
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index f663eb0f..f7119a23 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -372,7 +372,7 @@ function M.goto_error(line, next)
line = (next and math.min or math.max)(wline, eline)
if line == -1 then return end
end
- textadept.editing.goto_line(line + 1) -- ensure visible
+ textadept.editing.goto_line(line) -- ensure visible
-- Goto the warning or error and show an annotation.
local line = buffer:get_line(line):match('^[^\r\n]*')
@@ -381,7 +381,7 @@ function M.goto_error(line, next)
textadept.editing.select_line()
ui.goto_file(cwd..(not WIN32 and '/' or '\\')..error.filename, true,
preferred_view, true)
- textadept.editing.goto_line(error.line)
+ textadept.editing.goto_line(error.line - 1)
if error.column then
buffer:goto_pos(buffer:find_column(error.line - 1, error.column - 1))
end