Hi,

here is my patch to prevent duplicate history entries in prompt.lua, hope
you find it useful.

Massimiliano
From 409ec88a5b30ed3e720f2ae80f205cfe4c886e08 Mon Sep 17 00:00:00 2001
From: Massimiliano Brocchini <[email protected]>
Date: Sat, 22 Oct 2011 15:56:30 +0200
Subject: [PATCH] no duplicate entries in prompt history

Signed-off-by: Massimiliano Brocchini <[email protected]>
---
:100644 100644 64ab839... d953569... M	lib/awful/prompt.lua.in
 lib/awful/prompt.lua.in |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/awful/prompt.lua.in b/lib/awful/prompt.lua.in
index 64ab839..d953569 100644
--- a/lib/awful/prompt.lua.in
+++ b/lib/awful/prompt.lua.in
@@ -43,10 +43,12 @@ local function history_check_load(id, max)
 	-- Read history file
 	if f then
             for line in f:lines() do
-                table.insert(data.history[id].table, line)
-                if #data.history[id].table >= data.history[id].max then
-                   break
-		end
+                if util.table.hasitem(data.history[id].table, line) == nil then
+                        table.insert(data.history[id].table, line)
+                        if #data.history[id].table >= data.history[id].max then
+                           break
+                        end
+                end
             end
             f:close()
 	end
@@ -90,7 +92,7 @@ end
 local function history_add(id, command)
     if data.history[id] then
         if command ~= ""
-            and command ~= data.history[id].table[#data.history[id].table] then
+            and util.table.hasitem(data.history[id].table, command) == nil then
             table.insert(data.history[id].table, command)
 
             -- Do not exceed our max_cmd
-- 
1.7.7

Reply via email to