Skip to content
Browse files

fix bug

  • Loading branch information...
1 parent 1362960 commit 2e6b8f93a264ff7713b5436085b8b39128ef23d1 @halida committed Jan 6, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 views/vim.coffee
View
12 views/vim.coffee
@@ -5,9 +5,9 @@
pre_g = false
scroll_size = 100
-window.init_vim_key = (target)->
- target = window unless target
- target = $(target)
+window.init_vim_key = (div)->
+ div = document unless div
+ target = $(div)
$(document).keypress (e)->
if (e.keyCode == 107) # k
target.scrollTop(target.scrollTop()-scroll_size)
@@ -67,7 +67,11 @@ window.init_vim_key = (target)->
help.appendTo('body')
if (e.keyCode == 71 and e.shiftKey) # G
- target.scrollTop($(document).height())
+ if div == document
+ total_height = target.height()
+ else
+ total_height = target[0].scrollHeight
+ target.scrollTop(total_height)
e.preventDefault()
return

0 comments on commit 2e6b8f9

Please sign in to comment.
Something went wrong with that request. Please try again.