# HG changeset patch # User John W. Eaton # Date 1346953744 14400 # Node ID 35fe4b9909a8333dc4d96b71f22f5b204d08ac7e # Parent 67ef63ead0235597aa0e1f38f304f983f395e9a6 keep history in gui widget in chronological order, top to bottom * history-docwidget.cc (history_dock_widget::event_accepted): Insert new items at the bottom of the list. Scroll to bottom of list view widget after inserting new items. diff --git a/libgui/src/history-dockwidget.cc b/libgui/src/history-dockwidget.cc --- a/libgui/src/history-dockwidget.cc +++ b/libgui/src/history-dockwidget.cc @@ -50,13 +50,20 @@ // them to our history. if (clientHistoryLength < serverHistoryLength) { + int elts_to_add = serverHistoryLength - clientHistoryLength; + + _history_model->insertRows (clientHistoryLength, elts_to_add); + for (int i = clientHistoryLength; i < serverHistoryLength; i++) { - _history_model->insertRow (0); - _history_model->setData (_history_model->index (0), - QString (command_history::get_entry (i).c_str ())); + std::string entry = command_history::get_entry (i); + + _history_model->setData (_history_model->index (i), + QString::fromStdString (entry)); } } + + _history_list_view->scrollToBottom (); } // Post a new update event in a given time. This prevents flooding the