From 0fa3cf756a50dffe01e46c725245445dc1cfd39b Mon Sep 17 00:00:00 2001
From: Florent Le Coz <louiz@louiz.org>
Date: Tue, 21 Jun 2011 02:01:23 +0200
Subject: Reset the cursor position from the item list when node changes

---
 src/pubsub.py  | 2 +-
 src/windows.py | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/pubsub.py b/src/pubsub.py
index 0b8b02c5..30ffd624 100644
--- a/src/pubsub.py
+++ b/src/pubsub.py
@@ -183,7 +183,7 @@ class PubsubBrowserTab(tabs.Tab):
         node’s items
         """
         columns = self.item_list_header.get_columns()
-        self.item_listview.lines = []
+        self.item_listview.empty()
         log.debug('display_items_from_node: %s' % node.items)
         for item in node.items:
             self.item_listview.lines.append(item.to_dict(columns))
diff --git a/src/windows.py b/src/windows.py
index 512b6f01..9f6fc676 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -1512,6 +1512,14 @@ class ListWin(Win):
         self._selected_row = 0
         self._starting_pos = 0  # The column number from which we start the refresh
 
+    def empty(self):
+        """
+        emtpy the list and reset some important values as well
+        """
+        self.lines = []
+        self._selected_row = 0
+        self._starting_pos = 0
+
     def resize_columns(self, dic):
         """
         Resize the width of the columns
-- 
cgit v1.2.3