[gedit-plugins] Improve commander history handling



commit 79abc6a90e6cc47d7dc45af4c29561f3e863fd8c
Author: Jesse van den Kieboom <jesse icecrew nl>
Date:   Thu May 13 16:53:48 2010 +0200

    Improve commander history handling

 plugins/commander/commander/entry.py   |    3 +--
 plugins/commander/commander/history.py |    8 +++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/plugins/commander/commander/entry.py b/plugins/commander/commander/entry.py
index e887ee3..bc48ebd 100644
--- a/plugins/commander/commander/entry.py
+++ b/plugins/commander/commander/entry.py
@@ -291,8 +291,7 @@ class Entry(gtk.EventBox):
 		return self._info_window.add_action(stock, callback, data)
 
 	def command_history_done(self):
-		self._history.update(self._entry.get_text())
-		self._history.add()
+		self._history.add(self._entry.get_text())
 		self._history_prefix = None
 		self._entry.set_text('')
 
diff --git a/plugins/commander/commander/history.py b/plugins/commander/commander/history.py
index 743e7be..84f6a0e 100644
--- a/plugins/commander/commander/history.py
+++ b/plugins/commander/commander/history.py
@@ -34,7 +34,13 @@ class History:
 	def down(self, prefix=''):
 		return self.move(1, prefix)
 
-	def add(self):
+	def add(self, line):
+		if line.strip() != '':
+			if self._history[-1] != '':
+				self._history.append(line)
+			else:
+				self._history[-1] = line
+
 		if self._history[-1] != '':
 			self._history.append('')
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]