Changed block movement to mimic word movement

This commit is contained in:
rxi
2020-05-28 13:55:25 +01:00
parent 9c652086e8
commit 1b2fda2825
3 changed files with 14 additions and 14 deletions
+8 -8
View File
@@ -85,30 +85,30 @@ function translate.end_of_word(doc, line, col)
end
function translate.previous_start_of_block(doc, line, col)
function translate.previous_block_start(doc, line, col)
while true do
line = line - 1
if line <= 1 then
return 1, 1
end
if doc.lines[line-1]:match("^%s*$")
and not doc.lines[line]:match("^%s*$") then
if doc.lines[line-1]:find("^%s*$")
and not doc.lines[line]:find("^%s*$") then
return line, (doc.lines[line]:find("%S"))
end
end
end
function translate.next_start_of_block(doc, line, col)
function translate.next_block_end(doc, line, col)
while true do
line = line + 1
if line >= #doc.lines then
return #doc.lines, 1
end
if doc.lines[line-1]:match("^%s*$")
and not doc.lines[line]:match("^%s*$") then
return line, (doc.lines[line]:find("%S"))
if doc.lines[line+1]:find("^%s*$")
and not doc.lines[line]:find("^%s*$") then
return line+1, #doc.lines[line+1]
end
line = line + 1
end
end