about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-29 23:42:12 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-29 23:42:12 -0700
commit5cde7d513e7c228dba61729ae1c25b2e119fb5f8 (patch)
treea45402f42c596b9dc54201291e9fb29313e0221d
parenta9b3d6ed96c18df8324e89be315e5db8f7b72899 (diff)
downloadmu-5cde7d513e7c228dba61729ae1c25b2e119fb5f8.tar.gz
2112 - avoid repaint when page-up/down hit edge of text
-rw-r--r--edit.mu17
1 files changed, 17 insertions, 0 deletions
diff --git a/edit.mu b/edit.mu
index 861322c5..4989fe41 100644
--- a/edit.mu
+++ b/edit.mu
@@ -3979,9 +3979,13 @@ after +handle-special-character [
   {
     page-down?:boolean <- equal *c, 6/ctrl-f
     break-unless page-down?
+    top-of-screen:address:address:duplex-list <- get-address *editor, top-of-screen:offset
+    old-top:address:duplex-list <- copy *top-of-screen
     +move-cursor-start
     page-down editor
     +move-cursor-end
+    no-movement?:boolean <- equal *top-of-screen, old-top
+    reply-if no-movement?, screen/same-as-ingredient:0, editor/same-as-ingredient:1, 0/no-more-render
     reply screen/same-as-ingredient:0, editor/same-as-ingredient:1, 1/go-render
   }
 ]
@@ -3990,9 +3994,13 @@ after +handle-special-key [
   {
     page-down?:boolean <- equal *k, 65518/page-down
     break-unless page-down?
+    top-of-screen:address:address:duplex-list <- get-address *editor, top-of-screen:offset
+    old-top:address:duplex-list <- copy *top-of-screen
     +move-cursor-start
     page-down editor
     +move-cursor-end
+    no-movement?:boolean <- equal *top-of-screen, old-top
+    reply-if no-movement?, screen/same-as-ingredient:0, editor/same-as-ingredient:1, 0/no-more-render
     reply screen/same-as-ingredient:0, editor/same-as-ingredient:1, 1/go-render
   }
 ]
@@ -4162,9 +4170,13 @@ after +handle-special-character [
   {
     page-up?:boolean <- equal *c, 2/ctrl-b
     break-unless page-up?
+    top-of-screen:address:address:duplex-list <- get-address *editor, top-of-screen:offset
+    old-top:address:duplex-list <- copy *top-of-screen
     +move-cursor-start
     editor <- page-up editor, screen-height
     +move-cursor-end
+    no-movement?:boolean <- equal *top-of-screen, old-top
+    reply-if no-movement?, screen/same-as-ingredient:0, editor/same-as-ingredient:1, 0/no-more-render
     reply screen/same-as-ingredient:0, editor/same-as-ingredient:1, 1/go-render
   }
 ]
@@ -4173,9 +4185,14 @@ after +handle-special-key [
   {
     page-up?:boolean <- equal *k, 65519/page-up
     break-unless page-up?
+    top-of-screen:address:address:duplex-list <- get-address *editor, top-of-screen:offset
+    old-top:address:duplex-list <- copy *top-of-screen
     +move-cursor-start
     editor <- page-up editor, screen-height
     +move-cursor-end
+    no-movement?:boolean <- equal *top-of-screen, old-top
+    # don't bother re-rendering if nothing changed. todo: test this
+    reply-if no-movement?, screen/same-as-ingredient:0, editor/same-as-ingredient:1, 0/no-more-render
     reply screen/same-as-ingredient:0, editor/same-as-ingredient:1, 1/go-render
   }
 ]