[Aptitude-svn-commit] r3482 - in branches/aptitude-0.3/aptitude: . src/vscreen

Daniel Burrows dburrows@costa.debian.org
Mon, 27 Jun 2005 21:28:59 +0000


Author: dburrows
Date: Mon Jun 27 21:28:56 2005
New Revision: 3482

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vs_editline.cc
   branches/aptitude-0.3/aptitude/src/vscreen/vs_editline.h
Log:
Update vs_editline::handle_char to vs_editline::handle_key.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Jun 27 21:28:56 2005
@@ -1,5 +1,9 @@
 2005-06-27  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/vs_editline.cc, src/vscreen/vs_editline.h:
+
+	  Convert vs_editline::handle_char to vs_editline::handle_key.
+
 	* src/vscreen/vs_button.cc, src/vscreen/vs_button.h:
 
 	  Convert vs_button::handle_char to vs_button::handle_key.

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_editline.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_editline.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_editline.cc	Mon Jun 27 21:28:56 2005
@@ -119,9 +119,9 @@
   return true;
 }
 
-bool vs_editline::handle_char(chtype ch)
+bool vs_editline::handle_key(const key &k)
 {
-  if(bindings->key_matches(ch, "DelBack"))
+  if(bindings->key_matches(k, "DelBack"))
     {
       if(curloc>0)
 	{
@@ -137,7 +137,7 @@
 	}
       return true;
     }
-  else if(bindings->key_matches(ch, "DelForward"))
+  else if(bindings->key_matches(k, "DelForward"))
     {
       if(curloc<text.size())
 	{
@@ -153,14 +153,14 @@
 	}
       return true;
     }
-  else if(bindings->key_matches(ch, "Confirm"))
+  else if(bindings->key_matches(k, "Confirm"))
     {
       // I create a new string here because otherwise modifications to
       // "text" are seen by the widgets! (grr, sigc++)
       entered(wstring(text));
       return true;
     }
-  else if(bindings->key_matches(ch, "Left"))
+  else if(bindings->key_matches(k, "Left"))
     {
       if(curloc>0)
 	{
@@ -175,7 +175,7 @@
 	}
       return true;
     }
-  else if(bindings->key_matches(ch, "Right"))
+  else if(bindings->key_matches(k, "Right"))
     {
       if(curloc<text.size())
 	{
@@ -190,7 +190,7 @@
 	}
       return true;
     }
-  else if(bindings->key_matches(ch, "Begin"))
+  else if(bindings->key_matches(k, "Begin"))
     {
       curloc=0;
       startloc=0;
@@ -198,14 +198,14 @@
       vscreen_update();
       return true;
     }
-  else if(bindings->key_matches(ch, "End"))
+  else if(bindings->key_matches(k, "End"))
     {
       curloc=text.size();
       normalize_cursor();
       vscreen_update();
       return true;
     }
-  else if(bindings->key_matches(ch, "DelEOL"))
+  else if(bindings->key_matches(k, "DelEOL"))
     {
       text.erase(curloc);
       normalize_cursor();
@@ -213,7 +213,7 @@
       vscreen_update();
       return true;
     }
-  else if(bindings->key_matches(ch, "DelBOL"))
+  else if(bindings->key_matches(k, "DelBOL"))
     {
       text.erase(0, curloc);
       curloc=0;
@@ -222,7 +222,7 @@
       vscreen_update();
       return true;
     }
-  else if(history && bindings->key_matches(ch, "HistoryPrev"))
+  else if(history && bindings->key_matches(k, "HistoryPrev"))
     {
       if(history->size()==0)
 	return true;
@@ -248,7 +248,7 @@
 
       return true;
     }
-  else if(history && bindings->key_matches(ch, "HistoryNext"))
+  else if(history && bindings->key_matches(k, "HistoryNext"))
     {
       if(history->size()==0 || !using_history)
 	return true;
@@ -284,13 +284,13 @@
       else
 	return true;
     }
-  else if(ch>255)
-    return vscreen_widget::handle_char(ch);
-  else if(ch=='\t') // HACK
+  else if(k.function_key)
+    return vscreen_widget::handle_key(k);
+  else if(k.ch=='\t') // HACK
     return false;
   else
     {
-      text.insert(curloc++, 1, (char) ch);
+      text.insert(curloc++, 1, k.ch);
       normalize_cursor();
       text_changed(wstring(text));
       vscreen_update();
@@ -368,8 +368,8 @@
 {
   bindings=new keybindings(&global_bindings);
 
-  bindings->set("Left", KEY_LEFT);
-  bindings->set("Right", KEY_RIGHT);
+  bindings->set("Left", key(KEY_LEFT, true));
+  bindings->set("Right", key(KEY_RIGHT, true));
   // Override these for the case where left and right have multiple bindings
   // in the global keymap
 }

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_editline.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_editline.h	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_editline.h	Mon Jun 27 21:28:56 2005
@@ -39,7 +39,7 @@
 
   void normalize_cursor();
 protected:
-  bool handle_char(chtype ch);
+  bool handle_key(const key &k);
 public:
   vs_editline(std::wstring _prompt, std::wstring _text=L"",
 	      history_list *history=NULL);