diff options
Diffstat (limited to 'util/fbrun')
-rw-r--r-- | util/fbrun/FbRun.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc index 385f2b1..281b35f 100644 --- a/util/fbrun/FbRun.cc +++ b/util/fbrun/FbRun.cc | |||
@@ -145,7 +145,7 @@ void FbRun::run(const std::string &command) { | |||
145 | // now m_current_history_item points at the duplicate, or | 145 | // now m_current_history_item points at the duplicate, or |
146 | // at m_history.size() if no duplicate | 146 | // at m_history.size() if no duplicate |
147 | if (m_current_history_item != m_history.size()) { | 147 | if (m_current_history_item != m_history.size()) { |
148 | int i = 0; | 148 | unsigned int i = 0; |
149 | // read past history items before current | 149 | // read past history items before current |
150 | for (; inoutfile.good() && i < m_current_history_item; i++) | 150 | for (; inoutfile.good() && i < m_current_history_item; i++) |
151 | inoutfile.ignore(1, '\n'); | 151 | inoutfile.ignore(1, '\n'); |
@@ -342,16 +342,16 @@ void FbRun::tabCompleteHistory() { | |||
342 | XBell(m_display, 0); | 342 | XBell(m_display, 0); |
343 | } else { | 343 | } else { |
344 | unsigned int nr= 0; | 344 | unsigned int nr= 0; |
345 | int history_item = m_current_history_item - 1; | 345 | unsigned int history_item = m_current_history_item - 1; |
346 | string prefix = text().substr(0, textStartPos() + cursorPosition()); | 346 | string prefix = text().substr(0, textStartPos() + cursorPosition()); |
347 | while (history_item != m_current_history_item && nr++ < m_history.size()) { | 347 | while (history_item != m_current_history_item && nr++ < m_history.size()) { |
348 | if (history_item <= -1 ) | ||
349 | history_item= m_history.size() - 1; | ||
350 | if (m_history[history_item].find(prefix) == 0) { | 348 | if (m_history[history_item].find(prefix) == 0) { |
351 | m_current_history_item = history_item; | 349 | m_current_history_item = history_item; |
352 | setText(m_history[m_current_history_item]); | 350 | setText(m_history[m_current_history_item]); |
353 | break; | 351 | break; |
354 | } | 352 | } |
353 | if (history_item == 0) // loop | ||
354 | history_item = m_history.size(); | ||
355 | history_item--; | 355 | history_item--; |
356 | } | 356 | } |
357 | if (history_item == m_current_history_item) XBell(m_display, 0); | 357 | if (history_item == m_current_history_item) XBell(m_display, 0); |