diff -urN golded+cvs20090710-src/goldlib/gall/gkbdbase.cpp golded+cvs20090710-src.keys/goldlib/gall/gkbdbase.cpp
--- golded+cvs20090710-src/goldlib/gall/gkbdbase.cpp	2006-05-13 20:13:48.000000000 +0400
+++ golded+cvs20090710-src.keys/goldlib/gall/gkbdbase.cpp	2010-05-08 17:23:23.000000000 +0400
@@ -59,6 +59,8 @@
 #if defined(__linux__)
 #include <sys/ioctl.h>
 #include <stdio.h>
+#include <linux/kd.h>
+#include <linux/keyboard.h>
 #endif
 
 #if defined(__BEOS__)
@@ -94,6 +96,150 @@
 
 bool right_alt_same_as_left = false;
 
+
+#if defined(__linux__)
+int set_kb_entry( unsigned short table, unsigned short keycode, 
+                  unsigned short value, unsigned short *oldvalue ) {
+
+   struct kbentry ke;
+
+   ke.kb_table = table;
+   ke.kb_index = keycode;
+
+   if( ioctl( fileno(stdin), KDGKBENT, &ke ) )
+      return -1;
+
+   if( oldvalue ) *oldvalue = ke.kb_value;
+
+   ke.kb_value = value; 
+
+   if( ioctl( fileno(stdin), KDSKBENT, &ke ) )
+      return -1;
+
+   return 0;
+}
+
+
+unsigned short scroll_forward = 0;
+unsigned short scroll_backward = 0;
+
+
+#define SHIFT_TABLE          1
+#define PAGE_UP_KEYCODE    104
+#define PAGE_DOWN_KEYCODE  109
+#define PAGE_UP_ACTION     0x0118 /* Prior */
+#define PAGE_DOWN_ACTION   0x0119 /* Next  */
+
+static void restore_scrollback() {
+
+   if( scroll_backward )
+      set_kb_entry( SHIFT_TABLE, PAGE_UP_KEYCODE, 
+                    scroll_backward, 0 );
+
+   if( scroll_forward )
+      set_kb_entry( SHIFT_TABLE, PAGE_DOWN_KEYCODE, 
+                    scroll_forward, 0 );
+}
+
+int disable_scrollback() {
+
+   if( set_kb_entry( SHIFT_TABLE, PAGE_UP_KEYCODE, 
+                     PAGE_UP_ACTION, &scroll_backward ) )
+      return -1;
+
+   if( set_kb_entry( SHIFT_TABLE, PAGE_DOWN_KEYCODE, 
+                     PAGE_DOWN_ACTION, &scroll_forward ) )
+      return -1;
+
+   atexit( restore_scrollback );
+
+   return 0;
+}
+#endif
+
+#if defined(__USE_NCURSES__)
+
+struct extkey {
+  int key;
+  const char *name;
+  int keycode;
+};
+
+struct extkey gkbd_cursexttable[] = {
+
+   { Key_S_Up, "kUP2", -1 },
+   { Key_A_Up, "kUP3", -1 },
+   { Key_C_Up, "kUP5", -1 },
+
+   { Key_S_Dwn, "kDN2", -1 },
+   { Key_A_Dwn, "kDN3", -1 },
+   { Key_C_Dwn, "kDN5", -1 },
+
+   { Key_S_Rgt, "kRIT2", -1 },
+   { Key_A_Rgt, "kRIT3", -1 },
+   { Key_C_Rgt, "kRIT5", -1 },
+
+   { Key_S_Lft, "kLFT2", -1 },
+   { Key_A_Lft, "kLFT3", -1 },
+   { Key_C_Lft, "kLFT5", -1 },
+
+   { Key_S_Home, "kHOM2", -1 },
+   { Key_A_Home, "kHOM3", -1 },
+   { Key_C_Home, "kHOM5", -1 },
+
+   { Key_S_End, "kEND2", -1 },
+   { Key_A_End, "kEND3", -1 },
+   { Key_C_End, "kEND5", -1 },
+
+   { Key_S_PgDn, "kNXT2", -1 },
+   { Key_A_PgDn, "kNXT3", -1 },
+   { Key_C_PgDn, "kNXT5", -1 },
+
+   { Key_S_PgUp, "kPRV2", -1 },
+   { Key_A_PgUp, "kPRV3", -1 },
+   { Key_C_PgUp, "kPRV5", -1 },
+
+  { 0, 0, 0 }
+};
+
+
+int gkbd_findextkey(int keycode)
+{
+  int j;
+  
+  for (j = 0; gkbd_cursexttable[j].name; ++j)
+  {
+    if (gkbd_cursexttable[j].keycode == keycode)
+      return gkbd_cursexttable[j].key;
+  }
+  return 0;
+}
+
+void gkbd_initextkeys()
+{
+  int j;
+  
+  for (j = 0; gkbd_cursexttable[j].name; ++j)
+  {
+    if (gkbd_cursexttable[j].keycode == -1)
+    {
+      const char *keyname = gkbd_cursexttable[j].name;
+
+      if (keyname)
+      {
+       char *s = tigetstr(keyname);
+       if (s && (long)(s) != -1)
+       {
+         int code = key_defined(s);
+         if (code > 0)
+           gkbd_cursexttable[j].keycode = code;
+       }
+      }
+    }
+  }
+}
+#endif
+
 //  ------------------------------------------------------------------
 //  Keyboard Class Initializer
 
@@ -109,6 +255,10 @@
     nonl();
     intrflush(stdscr, FALSE);
     keypad(stdscr, TRUE);
+    gkbd_initextkeys();
+  #if defined(__linux__)
+    disable_scrollback();
+  #endif
   }
 
   // WARNING: this might break with an old version of ncurses, or
@@ -116,6 +266,7 @@
   // it is quote useful most of the time :-) For other implementations of
   // curses, you might have to compile curses yourself to achieve this.  -jt
   #if defined(NCURSES_VERSION)
+  use_extended_names(TRUE);
   if(not getenv("ESCDELAY")) // If not specified by user via environment, set
     ESCDELAY = 50; // ms, slow for a 300bps terminal, fast for humans :-)
   #endif
@@ -735,9 +886,9 @@
   Key_S_Lft, //  KEY_SLEFT
   -1,        //  KEY_SMESSAGE
   -1,        //  KEY_SMOVE
-  -1,        //  KEY_SNEXT
+  Key_S_PgDn,//  KEY_SNEXT
   -1,        //  KEY_SOPTIONS
-  -1,        //  KEY_SPREVIOUS
+  Key_S_PgUp,//  KEY_SPREVIOUS
   -1,        //  KEY_SPRINT
   -1,        //  KEY_SREDO
   -1,        //  KEY_SREPLACE
@@ -1078,6 +1229,7 @@
 
   // Get keystroke
   key = gkbd_cursgetch(mode);
+
   if(key == ERR)
     return 0;
 
@@ -1111,6 +1263,7 @@
       ungetch(key2);
   }
   // Curses sequence; lookup in nice table above
+  else if (k = gkbd_findextkey(key));
   else if((key >= KEY_MIN) and (key <= KEY_MIN+sizeof(gkbd_curstable)/sizeof(int)))
     k = (gkbd_curstable[key - KEY_MIN]);
   else if(key == '\015')
