[70] in bug-owl

home help back first fref pref prev next nref lref last post

no repeat history

daemon@ATHENA.MIT.EDU (Jeremy Daniel)
Sun Aug 18 13:40:57 2002

To: bug-owl@MIT.EDU
From: Jeremy Daniel <jdaniel@MIT.EDU>
Date: 18 Aug 2002 13:40:53 -0400
Message-ID: <skebs809iai.fsf@multics.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

This patch will keep the history from having the same command multiple
times in a row by only storing new entries if they're different from
the one at the top of the list.

/mit/jdaniel/project/owl/build-cvs/history_no_repeat.patch

Index: history.c
===================================================================
RCS file: /mit/ktools/src/owl/repository/owl/history.c,v
retrieving revision 1.3
diff -u -r1.3 history.c
--- history.c	2002/07/09 02:37:30	1.3
+++ history.c	2002/08/18 17:23:02
@@ -46,8 +46,13 @@
     owl_list_remove_element(&(h->hist), 0);
   }
 
-  /* if we've reached the max history size, pop off the last element */
+  /* if this element is the same as the top one don't store it again */
   size=owl_list_get_size(&(h->hist));
+  if (size>0 && !strcmp(owl_list_get_element(&(h->hist), 0), line)) {
+    return;
+  }
+
+  /* if we've reached the max history size, pop off the last element */
   if (size>OWL_HISTORYSIZE) {
     owl_free(owl_list_get_element(&(h->hist), size-1));
     owl_list_remove_element(&(h->hist), size-1);

-- 


				Jer


------------------------------------------------------------------
Tulgey Wood - tulgeywood@attbi.com     Cell Phone: 617-429-8573 / 
4 Farragut Ave (617-629-3983)             jdaniel-phone@mit.edu
Somerville, MA 02144-1709              AIM: jdanielmit      
                                    
Zephyr athena users over the web:  http://webzephyr.mit.edu/

home help back first fref pref prev next nref lref last post