Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
peach-html5-editor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
90fd434
)
page up: cursor to start if scrolled top already
author
Jason Woofenden
<jason@jasonwoof.com>
Wed, 30 Mar 2016 14:00:05 +0000
(10:00 -0400)
committer
Jason Woofenden
<jason@jasonwoof.com>
Wed, 30 Mar 2016 14:00:05 +0000
(10:00 -0400)
editor.coffee
patch
|
blob
|
history
diff --git
a/editor.coffee
b/editor.coffee
index
a7c3c66
..
a0bd0a4
100644
(file)
--- a/
editor.coffee
+++ b/
editor.coffee
@@
-1077,6
+1077,13
@@
class PeachHTML5Editor
@kill_cursor()
return
on_page_up_key: (e) ->
@kill_cursor()
return
on_page_up_key: (e) ->
+ if @wrap2.scrollTop is 0
+ return unless @cursor?
+ new_cursor = first_cursor_position @tree
+ if new_cursor?
+ if new_cursor.n isnt @cursor.n or new_cursor.i isnt @cursor.i
+ @move_cursor new_cursor
+ return
if @cursor?
screen_y = @cursor.y - @wrap2.scrollTop
scroll_amount = @wrap2_height - breathing_room
if @cursor?
screen_y = @cursor.y - @wrap2.scrollTop
scroll_amount = @wrap2_height - breathing_room
@@
-1084,18
+1091,17
@@
class PeachHTML5Editor
if @cursor?
@move_cursor_into_view screen_y + @wrap2.scrollTop
on_page_down_key: (e) ->
if @cursor?
@move_cursor_into_view screen_y + @wrap2.scrollTop
on_page_down_key: (e) ->
- if @cursor?
- screen_y = @cursor.y - @wrap2.scrollTop
- scroll_amount = @wrap2_height - breathing_room
lowest_scrollpos = @wrap2.scrollHeight - @wrap2_height
lowest_scrollpos = @wrap2.scrollHeight - @wrap2_height
- if @wrap2.scrollTop is lowest_scrollpos # already at bottom
+ if @wrap2.scrollTop is lowest_scrollpos
return unless @cursor?
return unless @cursor?
- # move cursor to bottom
new_cursor = last_cursor_position @tree
if new_cursor?
if new_cursor.n isnt @cursor.n or new_cursor.i isnt @cursor.i
@move_cursor new_cursor
return
new_cursor = last_cursor_position @tree
if new_cursor?
if new_cursor.n isnt @cursor.n or new_cursor.i isnt @cursor.i
@move_cursor new_cursor
return
+ if @cursor?
+ screen_y = @cursor.y - @wrap2.scrollTop
+ scroll_amount = @wrap2_height - breathing_room
@wrap2.scrollTop = Math.min lowest_scrollpos, @wrap2.scrollTop + scroll_amount
if @cursor?
@move_cursor_into_view screen_y + @wrap2.scrollTop
@wrap2.scrollTop = Math.min lowest_scrollpos, @wrap2.scrollTop + scroll_amount
if @cursor?
@move_cursor_into_view screen_y + @wrap2.scrollTop