Merge pull request #370 from adamharrison/home-fixes
Changed behaviour of home.
This commit is contained in:
commit
f3a8e264fe
|
@ -418,6 +418,7 @@ local translations = {
|
|||
["start-of-line"] = translate.start_of_line,
|
||||
["end-of-line"] = translate.end_of_line,
|
||||
["start-of-word"] = translate.start_of_word,
|
||||
["start-of-indentation"] = translate.start_of_indentation,
|
||||
["end-of-word"] = translate.end_of_word,
|
||||
["previous-line"] = DocView.translate.previous_line,
|
||||
["next-line"] = DocView.translate.next_line,
|
||||
|
|
|
@ -117,6 +117,10 @@ function translate.start_of_line(doc, line, col)
|
|||
return line, 1
|
||||
end
|
||||
|
||||
function translate.start_of_indentation(doc, line, col)
|
||||
local s, e = doc.lines[line]:find("^%s*")
|
||||
return line, col > e + 1 and e + 1 or 1
|
||||
end
|
||||
|
||||
function translate.end_of_line(doc, line, col)
|
||||
return line, math.huge
|
||||
|
|
|
@ -80,7 +80,7 @@ local function keymap_macos(keymap)
|
|||
["cmd+right"] = "doc:move-to-next-word-end",
|
||||
["cmd+["] = "doc:move-to-previous-block-start",
|
||||
["cmd+]"] = "doc:move-to-next-block-end",
|
||||
["home"] = "doc:move-to-start-of-line",
|
||||
["home"] = "doc:move-to-start-of-indentation",
|
||||
["end"] = "doc:move-to-end-of-line",
|
||||
["cmd+home"] = "doc:move-to-start-of-doc",
|
||||
["cmd+end"] = "doc:move-to-end-of-doc",
|
||||
|
@ -95,7 +95,7 @@ local function keymap_macos(keymap)
|
|||
["cmd+shift+right"] = "doc:select-to-next-word-end",
|
||||
["cmd+shift+["] = "doc:select-to-previous-block-start",
|
||||
["cmd+shift+]"] = "doc:select-to-next-block-end",
|
||||
["shift+home"] = "doc:select-to-start-of-line",
|
||||
["shift+home"] = "doc:select-to-start-of-indentation",
|
||||
["shift+end"] = "doc:select-to-end-of-line",
|
||||
["cmd+shift+home"] = "doc:select-to-start-of-doc",
|
||||
["cmd+shift+end"] = "doc:select-to-end-of-doc",
|
||||
|
|
|
@ -184,7 +184,7 @@ keymap.add_direct {
|
|||
["ctrl+right"] = "doc:move-to-next-word-end",
|
||||
["ctrl+["] = "doc:move-to-previous-block-start",
|
||||
["ctrl+]"] = "doc:move-to-next-block-end",
|
||||
["home"] = "doc:move-to-start-of-line",
|
||||
["home"] = "doc:move-to-start-of-indentation",
|
||||
["end"] = "doc:move-to-end-of-line",
|
||||
["ctrl+home"] = "doc:move-to-start-of-doc",
|
||||
["ctrl+end"] = "doc:move-to-end-of-doc",
|
||||
|
@ -199,7 +199,7 @@ keymap.add_direct {
|
|||
["ctrl+shift+right"] = "doc:select-to-next-word-end",
|
||||
["ctrl+shift+["] = "doc:select-to-previous-block-start",
|
||||
["ctrl+shift+]"] = "doc:select-to-next-block-end",
|
||||
["shift+home"] = "doc:select-to-start-of-line",
|
||||
["shift+home"] = "doc:select-to-start-of-indentation",
|
||||
["shift+end"] = "doc:select-to-end-of-line",
|
||||
["ctrl+shift+home"] = "doc:select-to-start-of-doc",
|
||||
["ctrl+shift+end"] = "doc:select-to-end-of-doc",
|
||||
|
|
Loading…
Reference in New Issue