- Timestamp:
- 03/30/11 16:00:15 (14 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Readline.cc
r10183 r10275 470 470 // 471 471 //! Adds the given string to the history buffer of readline's history by 472 //! calling add_history. If skip is set to true str will be compared 473 //! with the last line added to the history and only be added if it difers. 472 //! calling add_history. 474 473 //! 475 474 //! @param str … … 478 477 //! 479 478 //! @param skip 480 //! If skip is true do not add a new entry if it is identical to 481 //! the last one. 482 // 483 void Readline::AddToHistory(const string &str, bool skip) 484 { 485 if (skip && fLastLine==str) 479 //! If skip is 1 and str matches the last added entry in the history, 480 //! the entry is skipped. If skip==2, all entries matching str are 481 //! removed from the history before the new entry is added as last one. 482 //! <skip==2 is the default> 483 // 484 void Readline::AddToHistory(const string &str, int skip) 485 { 486 if (skip==1 && fLastLine==str) 486 487 return; 487 488 … … 489 490 return; 490 491 492 while (skip==2) 493 { 494 int p = history_search_pos(str.c_str(), 0, 0); 495 if (p<0) 496 break; 497 498 delete remove_history(p); 499 } 500 491 501 add_history(str.c_str()); 492 502 fLastLine = str; 493 503 } 494 504 505 // -------------------------------------------------------------------------- 506 // 507 //! @returns 508 //! a string containing [{fLine}] 509 // 495 510 string Readline::GetLinePrompt() const 496 511 { -
trunk/FACT++/src/Readline.h
r10183 r10275 71 71 std::string GetName() const { return fName; } 72 72 73 void AddToHistory(const std::string &str, bool skip=true);73 void AddToHistory(const std::string &str, int skip=2); 74 74 static bool ClearHistory(); 75 75 std::vector<const char*> GetHistory() const;
Note:
See TracChangeset
for help on using the changeset viewer.