On Wed, Aug 18, 2010 at 09:50:07AM -0500, Kumar Appaiah wrote:
> Package: luakit
> Version: 0~20100813-3
> Severity: minor
> Tags: patch
> 
> Dear Clint,
> 
> Please find attached a patch to strip the whitespace around the search
> terms. Naturally, you may feel free to overrule this, I'd understand.
> 
> Thanks!

And here is the patch! Sorry for failing to attach it earlier.

Thanks.

Kumar
>From b7814499e41e29067029aa84d9d6820a30702dd2 Mon Sep 17 00:00:00 2001
From: Kumar Appaiah <[email protected]>
Date: Wed, 18 Aug 2010 09:44:53 -0500
Subject: [PATCH] Strip whitespace around the search terms in the websearch function

Since most people who search wouldn't really need accurate
reproduction of the whitespace around the search term, and some search
engines actually fail to work if the whitespace is present, this patch
strips the whitespace around the search terms. Ideally, we would want
this on a per-search engine basis, but that seems to require a larger
change in the already long rc.lua.
---
 rc.lua |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/rc.lua b/rc.lua
index 276d9c3..b92ac97 100755
--- a/rc.lua
+++ b/rc.lua
@@ -689,6 +689,7 @@ window_helpers = {
         local sep = string.find(args, " ")
         local engine = string.sub(args, 1, sep-1)
         local search = string.sub(args, sep+1)
+        search = string.gsub(search, "^%s*(.-)%s*$", "%1")
         if not search_engines[engine] then
             print("E: No matching search engine found:", engine)
             return 0
-- 
1.7.1

Reply via email to