[Aptitude-svn-commit] r3494 - in branches/aptitude-0.3/aptitude: . src/vscreen/config
Daniel Burrows
dburrows@costa.debian.org
Mon, 27 Jun 2005 22:36:13 +0000
Author: dburrows
Date: Mon Jun 27 22:36:11 2005
New Revision: 3494
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/vscreen/config/keybindings.cc
branches/aptitude-0.3/aptitude/src/vscreen/config/keybindings.h
Log:
Fix a bit of stuff about how control keys work.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Mon Jun 27 22:36:11 2005
@@ -1,3 +1,11 @@
+2005-06-27 Daniel Burrows <dburrows@debian.org>
+
+ * src/vscreen/config/keybindings.cc:
+
+ Fix the definition of KEY_CTRL and keyname to be slightly more
+ sane (as sane as is possible given how control keys are
+ handled).
+
2005-06-27 Håvard Korsvoll <korsvoll@skulelinux.no>
* Updated Norwegian nynorsk translation
Modified: branches/aptitude-0.3/aptitude/src/vscreen/config/keybindings.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/config/keybindings.cc (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/config/keybindings.cc Mon Jun 27 22:36:11 2005
@@ -370,10 +370,11 @@
// someday I need to learn the underlying logic, if there is any..
if(k.ch==31 && k.function_key)
return L"C-_";
- // <31 seem to be control-characters? doh...is 32 the amount to add?
- // Daniel is confused..
- if((k.ch&(~31))==0 && !k.function_key)
- return L"C-"+keyname(key(k.ch|64|32, false));
+
+ // Control characters are characters whose 64-place is 0. (what
+ // about others? hm)
+ if(k.ch < 32 && !k.function_key)
+ return L"C-"+keyname(key(k.ch|64, false));
// and 200 seems to be the ALT-character?
else if(k.ch&0x200)
return L"A-"+keyname(key(k.ch&~0x200, false));
Modified: branches/aptitude-0.3/aptitude/src/vscreen/config/keybindings.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/config/keybindings.h (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/config/keybindings.h Mon Jun 27 22:36:11 2005
@@ -147,8 +147,11 @@
// Stolen from pinfo. I don't like the looks of it, but presumably it works
// (in some circumstances). This is a FIXME, btw :)
/* adapted from Midnight Commander */
-#define KEY_CTRL(x) key(((x)&31), true)
-#define KEY_ALT(x) key((0x200 | (x)), true)
+
+// Having read a bit more, it appears that the control modifier
+// clears bits 5 and 4. I think KEY_ALT is utterly broken.
+#define KEY_CTRL(x) key(((x)&~(64|32)), false)
+#define KEY_ALT(x) key((0x200 | (x)), false)
#endif