Hi,

I started recently to modify the terminal behaviour for
shift+pageup/pagedown key presses in alternate screen mode. Since
alternate screen has exact size as visible part of terminal screen,
these key combintations doesn't have that good reason for history
scrolling. On the other hand it makes sense to send this event to
application running inside terminal. I see this as possibility for
programs like screen and tmux that they can provide history of their
terminal more naturally.

I'm attaching simple patch which introduces secondarySendScroll
resource support, which mostly does what I would like. Currently it
sends some bogus escape sequence until I find something better (any
ideas?). It is also enabled by default - I didn't find why and
shift+up/down doesn't work at all. I hope that the idea is clear.

I also sent patch for xterm, create bug reports for VTE (used by
gnome-terminal, xfce-terminal, ...) and for konsole. Linux virtual
terminal emulator doesn't support even alternate screen yet, but I'm
also working on that. I also contacted tmux lead developer and gnu
screen guys through mailing list.

I hope you're interested in such feature.


Best regards,

Tomas Cech
diff --git a/command.C b/command.C
index 9a99c29..9abc29d 100644
--- a/command.C
+++ b/command.C
@@ -509,13 +509,23 @@ rxvt_term::key_press (XKeyEvent &ev)
 #endif
               if (keysym == XK_Prior)
                 {
-                  scr_page (UP, lnsppg);
-                  return;
-                }
+				  if (current_screen == SECONDARY && option(Opt_secondarySendScroll)) {
+					tt_write ("\033[1j", strlen("\033[1j"));
+					return;
+				  } else {
+                    scr_page (UP, lnsppg);
+                    return;
+                  }
+				}
               else if (keysym == XK_Next)
                 {
-                  scr_page (DN, lnsppg);
-                  return;
+				  if (current_screen == SECONDARY && option(Opt_secondarySendScroll)) {
+					tt_write ("\033[0j", strlen("\033[0j"));
+					return;
+				  } else {
+                    scr_page (DN, lnsppg);
+                    return;
+				  }
                 }
             }
 #ifdef SCROLL_ON_UPDOWN_KEYS
@@ -523,13 +533,23 @@ rxvt_term::key_press (XKeyEvent &ev)
             {
               if (keysym == XK_Up)
                 {
-                  scr_page (UP, 1);
-                  return;
+				  if (current_screen == SECONDARY && option(Opt_secondarySendScroll)) {
+					tt_write ("\033[3j", strlen("\033[3j"));
+					return;
+				  } else {
+                    scr_page (UP, 1);
+                    return;
+				  }
                 }
               else if (keysym == XK_Down)
                 {
-                  scr_page (DN, 1);
-                  return;
+				  if (current_screen == SECONDARY && option(Opt_secondarySendScroll)) {
+					tt_write ("\033[2j", strlen("\033[2j"));
+					return;
+				  } else {
+                    scr_page (DN, 1);
+                    return;
+				  }
                 }
             }
 #endif
diff --git a/init.C b/init.C
index 6c9e640..922c626 100644
--- a/init.C
+++ b/init.C
@@ -307,6 +307,7 @@ rxvt_term::init_vars ()
   set_option (Opt_skipScroll);
   set_option (Opt_secondaryScreen);
   set_option (Opt_secondaryScroll);
+  set_option (Opt_secondarySendScroll);
   set_option (Opt_pastableTabs);
   set_option (Opt_intensityStyles);
   set_option (Opt_iso14755_52);
diff --git a/optinc.h b/optinc.h
index 4492d82..b864b3e 100644
--- a/optinc.h
+++ b/optinc.h
@@ -63,3 +63,5 @@
  nodef(buffered)
 #endif
 
+ def(secondarySendScroll,  35)
+
diff --git a/rsinc.h b/rsinc.h
index 903a771..a36d4d8 100644
--- a/rsinc.h
+++ b/rsinc.h
@@ -100,6 +100,7 @@
 #ifndef NO_SECONDARY_SCREEN
   def (secondaryScreen)
   def (secondaryScroll)
+  def (secondarySendScroll)
 #endif
 #ifdef OFF_FOCUS_FADING
   def (fade)
diff --git a/xdefaults.C b/xdefaults.C
index 1b654c5..bdc9d80 100644
--- a/xdefaults.C
+++ b/xdefaults.C
@@ -251,6 +251,7 @@ optList[] = {
 #ifndef NO_SECONDARY_SCREEN
               BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, 0, "enable secondary screen"),
               BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, 0, "enable secondary screen scroll"),
+              BOOL (Rs_secondarySendScroll, "secondarySendScroll", "sssr", Opt_secondarySendScroll, 0, "enable send scroll to application when using secondary screen"),
 #endif
 #if ENABLE_PERL
               RSTRG (Rs_perl_lib, "perl-lib", "string"), //, "colon-separated directories with extension scripts"),TODO
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to