diff options
Diffstat (limited to 'util/fbrun')
-rw-r--r-- | util/fbrun/FbRun.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc index 47e35bf..e32e101 100644 --- a/util/fbrun/FbRun.cc +++ b/util/fbrun/FbRun.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbRun.cc,v 1.24 2004/02/25 18:37:47 fluxgen Exp $ | 22 | // $Id: FbRun.cc,v 1.25 2004/02/28 10:43:20 fluxgen Exp $ |
23 | 23 | ||
24 | #include "FbRun.hh" | 24 | #include "FbRun.hh" |
25 | 25 | ||
@@ -314,14 +314,15 @@ void FbRun::lastHistoryItem() { | |||
314 | } | 314 | } |
315 | 315 | ||
316 | void FbRun::tabCompleteHistory() { | 316 | void FbRun::tabCompleteHistory() { |
317 | if (m_current_history_item == 0) { | 317 | if (m_current_history_item == 0 || m_history.empty() ) { |
318 | XBell(m_display, 0); | 318 | XBell(m_display, 0); |
319 | } else { | 319 | } else { |
320 | unsigned int nr= 0; | ||
320 | int history_item = m_current_history_item - 1; | 321 | int history_item = m_current_history_item - 1; |
321 | string prefix = text().substr(0, cursorPosition()); | 322 | string prefix = text().substr(0, cursorPosition()); |
322 | while (history_item != m_current_history_item ) { | 323 | while (history_item != m_current_history_item && nr++ < m_history.size()) { |
323 | if (history_item == -1 ) | 324 | if (history_item <= -1 ) |
324 | history_item+= m_history.size(); | 325 | history_item= m_history.size() - 1; |
325 | if (m_history[history_item].find(prefix) == 0) { | 326 | if (m_history[history_item].find(prefix) == 0) { |
326 | m_current_history_item = history_item; | 327 | m_current_history_item = history_item; |
327 | setText(m_history[m_current_history_item]); | 328 | setText(m_history[m_current_history_item]); |