From fa50d03562fe41489a8e00de14572bfc29361c0a Mon Sep 17 00:00:00 2001
From: andreas <andreas@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Fri, 14 May 2010 16:05:13 +0000
Subject: [PATCH] added missing files from last new_shell commit

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/branches/new_shell@2260 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 modules/gui/src/python_shell/shell_history.cc | 35 ++++++++++---------
 modules/gui/src/python_shell/shell_history.hh |  6 ++--
 2 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/modules/gui/src/python_shell/shell_history.cc b/modules/gui/src/python_shell/shell_history.cc
index a761cd86f..14ce28eaf 100644
--- a/modules/gui/src/python_shell/shell_history.cc
+++ b/modules/gui/src/python_shell/shell_history.cc
@@ -19,7 +19,6 @@
 /*
   Author: Andreas Schenk
  */
-
 #include "shell_history.hh"
 
 namespace ost { namespace gui {
@@ -77,29 +76,33 @@ bool ShellHistory::AtEnd()
   return index_>=history_list_.size();
 }
 
-void ShellHistory::operator--()
+void ShellHistory::MoveToPreviousMatch()
 {
-  if(index_>0){
-    --index_;
+  int newindex=index_-1;
+  while(newindex>=0){
+    if(history_list_[newindex].first.indexOf(current_)==0 || current_.size()==0){
+      index_=newindex;
+      break;
+    }
+    --newindex;
   }
 }
 
-void ShellHistory::operator--(int)
-{
-  operator--();
-}
-
-void ShellHistory::operator++()
+void ShellHistory::MoveToNextMatch()
 {
-  if(index_<history_list_.size()){
-    ++index_;
+  int newindex=index_+1;
+  while(newindex<history_list_.size()){
+    if(history_list_[newindex].first.indexOf(current_)==0 || current_.size()==0){
+      index_=newindex;
+      break;
+    }
+    ++newindex;
+  }
+  if(newindex!=index_){
+    index_=history_list_.size();
   }
 }
 
-void ShellHistory::operator++(int)
-{
-  operator++();
-}
 
 }}//ns
 
diff --git a/modules/gui/src/python_shell/shell_history.hh b/modules/gui/src/python_shell/shell_history.hh
index 653650fb2..a04bd8469 100644
--- a/modules/gui/src/python_shell/shell_history.hh
+++ b/modules/gui/src/python_shell/shell_history.hh
@@ -38,10 +38,8 @@ public:
  QString GetCommand();
  BlockEditMode GetCommandMode();
  bool AtEnd();
- void operator--();
- void operator--(int);
- void operator++();
- void operator++(int);
+ void MoveToPreviousMatch();
+ void MoveToNextMatch();
 protected:
  std::vector<std::pair<QString,BlockEditMode> > history_list_;
  QString current_;
-- 
GitLab