[Aptitude-devel] r3141 - in branches/aptitude-0.3/aptitude: . src/vscreen/config
Daniel Burrows
dburrows@costa.debian.org
Wed, 27 Apr 2005 12:41:05 +0000
Author: dburrows
Date: Wed Apr 27 12:41:02 2005
New Revision: 3141
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:
Add a separate function to generate keynames for human consumption.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Wed Apr 27 12:41:02 2005
@@ -1,5 +1,10 @@
2005-04-27 Daniel Burrows <dburrows@debian.org>
+ * src/vscreen/config/keybindings.cc, src/vscreen/config/keybindings.h:
+
+ Add a 'readable_keyname' function, whose current useful feature
+ is that it maps ',' to ',' instead of 'comma'.
+
* src/pkg_item.cc:
Reflow some manually wrapped messages.
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 Wed Apr 27 12:41:02 2005
@@ -1,6 +1,6 @@
// keybindings.h, -*-c++-*-
//
-// Copyright 1999,2000 Daniel Burrows
+// Copyright 1999-2001, 2004-2005 Daniel Burrows
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -396,3 +396,18 @@
else
return "";
}
+
+string keybindings::readable_keyname(string tag)
+{
+ hash_map<string, keybinding>::iterator found=keymap.find(tag);
+
+ if(found != keymap.end())
+ {
+ if(found->second.front() == ',')
+ return ",";
+ else
+ return ::keyname(found->second.front());
+ }
+ else
+ return "";
+}
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 Wed Apr 27 12:41:02 2005
@@ -1,6 +1,6 @@
// keybindings.h, -*-c++-*-
//
-// Copyright 1999,2000 Daniel Burrows
+// Copyright 1999-2001, 2003-2005 Daniel Burrows
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -91,6 +91,11 @@
std::string keyname(chtype ch);
// Returns a string identifying the given keystroke.
+/** \return a human-readable string identifying the given keystroke
+ * (as opposed to 'keyname', which is a strict reverse mapping).
+ */
+std::string readable_keyname(chtype ch);
+
extern keybindings global_bindings;
// For now, this is where the global bindings are stored (I might want to move
// it in the future, hmmm..)