key Shift+Prior not working for scroll-up in xterm but in urxvt

Thomas Dickey dickey at his.com
Mon Feb 9 09:54:26 UTC 2015


On Fri, Feb 06, 2015 at 02:03:48PM +0100, Matthias Apitz wrote:
> El día Friday, February 06, 2015 a las 04:25:25AM -0500, Thomas Dickey escribió:
> 
> > > I run this 11C on a small netbook (Acer C720) which does not have physical
> > > keys for PG_UP/DOWN; that's why I use xmodmap to define 
> > > 
> > > Mode_switch + UP --> Prior
> > > Mdee_switch + Down --> Next
> > > 
> > > xmodmap -e "keycode 98  =  Up   Up   Prior"
> > > xmodmap -e "keycode 104 =  Down Down Next"
> > > 
> > > When I now do in the terminal urxvt holding down both Mode_switch and
> > > Shift, it scrolls fine with the Up and Down keys as expected: the
> > > terminal window is scrolled up and down.
> > > 
> > > When I do the same, the key is delivered to the xterm itself and I can
> > > see them, for example, with 'od -c' as:
> > > 
> > > $ od -c
> > > ^[[5;2~^[[5;2~
> > > ^[[6;2~^[[6;2~
> > > 0000000  033   [   5   ;   2   ~ 033   [   5   ;   2   ~  \n 033   [   6
> > > 0000020    ;   2   ~ 033   [   6   ;   2   ~  \n                        
> > > 0000032
> > > 
> > > The 033 [ 5 ; 2 ~ for Up and the 033 [ 6 ; 2 ~ for down.
> > > 
> > > Why this does not work in xterm?
> > 
> > That depends on what you want it to do (you did not say).
> 
> I think, I said what I want: that with Mode_switch+Shift+Up/Down it does
> scrolling in xterm as it does in uRxvt.
> 
> I followed your hints an tried configurations in the file
> ~/.Xdefaults-hostname:
> 
> *VT100.translations: #override \
> 	Shift<Key>Up:		scroll-back(1,page) \n\
> 	Shift<Key>Down:		scroll-forw(1,page) \n\
> 	Shift<Key>F9: string("hola")
> 
> (the last line for F9 is only to see if the file works at all).
> 
> With the above config it now scrolls in xterm with Shift-Up/Down. But
> I'm unable to configure that it scrolls with Mode_switch+Shift+Up/Down
> and I want to have this to use the same key sequence in xterm and uRxvt
> and not always have to think where I am.
> 
> Any idea? Thanks

not immediately: my keyboard does not have a mode_switch key
(unless I tinker with xmodmap...).

But here's a guess:

Xt's translations don't know about mode_switch as such, so a fix is
likely to be in xmodmap.  While xmodmap's manpage is vague about the
recognized modifiers, mentioning them by name only once:

       clear MODIFIERNAME
               This removes all entries in the modifier map for the given mod‐
               ifier,  where valid name are: Shift, Lock, Control, Mod1, Mod2,
               Mod3, Mod4, and Mod5 (case does not matter in  modifier  names,
               although  it  does  matter  for all other names).  For example,
               ``clear Lock'' will remove all any keys that were bound to  the
               shift lock modifier.

The source code for the xmodmap program does not have a table of these names.
That is in the library.  The library defines this table:

	static ModifierRec modifiers[] = {
	    {"Shift",	0,	ParseModImmed,ShiftMask},
	    {"Lock",	0,	ParseModImmed,LockMask},
	    {"Ctrl",	0,	ParseModImmed,ControlMask},
	    {"Mod1",	0,	ParseModImmed,Mod1Mask},
	    {"Mod2",	0,	ParseModImmed,Mod2Mask},
	    {"Mod3",	0,	ParseModImmed,Mod3Mask},
	    {"Mod4",	0,	ParseModImmed,Mod4Mask},
	    {"Mod5",	0,	ParseModImmed,Mod5Mask},
	    {"Meta",	0,	ParseModSym,  XK_Meta_L},
	    {"m",       0,      ParseModSym,  XK_Meta_L},
	    {"h",       0,      ParseModSym,  XK_Hyper_L},
	    {"su",      0,      ParseModSym,  XK_Super_L},
	    {"a",       0,      ParseModSym,  XK_Alt_L},
	    {"Hyper",   0,      ParseModSym,  XK_Hyper_L},
	    {"Super",   0,      ParseModSym,  XK_Super_L},
	    {"Alt",     0,      ParseModSym,  XK_Alt_L},
	    {"Button1",	0,	ParseModImmed,Button1Mask},
	    {"Button2",	0,	ParseModImmed,Button2Mask},
	    {"Button3",	0,	ParseModImmed,Button3Mask},
	    {"Button4",	0,	ParseModImmed,Button4Mask},
	    {"Button5",	0,	ParseModImmed,Button5Mask},
	    {"c",	0,	ParseModImmed,ControlMask},
	    {"s",	0,	ParseModImmed,ShiftMask},
	    {"l",	0,	ParseModImmed,LockMask},
	};

and also in the library it treats the mode-switch specially (without naming
it):

InitialI.h:307:    Modifiers mode_switch;          /* keyboard group modifiers */
TMkey.c:451:    pd->mode_switch = 0;
TMkey.c:464:            if ((keysym == XK_Mode_switch) && (i > 2))
TMkey.c:465:            pd->mode_switch |= 1 << i;
TMkey.c:531:    *modifiers_return = (ShiftMask|LockMask) | pd->mode_switch | pd->num_lock;
TMkey.c:541:    if ((per > 2) && (modifiers & pd->mode_switch)) {

So... I think that you could make this work by using xmodmap to assign
one of the mod1-mod5 modifier names to the mode-switch key, and using
that modifier in a translations resource binding for xterm.

-- 
Thomas E. Dickey <dickey at invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20150209/55cc26a7/attachment.sig>


More information about the freebsd-questions mailing list