qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs search.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs search.c
Date: Wed, 26 Aug 2015 23:13:37 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        15/08/26 23:13:37

Modified files:
        .              : search.c 

Log message:
        search: remember last search flags
        - C-s and C-r in incremental search also restores flags from last search
        - do_search_string() accepts empty string

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/search.c?cvsroot=qemacs&r1=1.3&r2=1.4

Patches:
Index: search.c
===================================================================
RCS file: /sources/qemacs/qemacs/search.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- search.c    19 Aug 2015 20:33:01 -0000      1.3
+++ search.c    26 Aug 2015 23:13:36 -0000      1.4
@@ -56,6 +56,7 @@
 /* store last searched string */
 static unsigned int last_search_u32[SEARCH_LENGTH];
 static int last_search_u32_len = 0;
+static int last_search_u32_flags = 0;
 
 static int eb_search(EditBuffer *b, int dir, int flags,
                      int start_offset, int end_offset,
@@ -370,6 +371,7 @@
             memcpy(last_search_u32, is->search_u32,
                    is->search_u32_len * sizeof(*is->search_u32));
             last_search_u32_len = is->search_u32_len;
+            last_search_u32_flags = is->search_flags;
         }
         qe_ungrab_keys();
         edit_display(s->qe_state);
@@ -387,6 +389,7 @@
             memcpy(is->search_u32_flags + is->pos, last_search_u32,
                    len * sizeof(*is->search_u32_flags));
             is->pos += len;
+            is->search_flags = last_search_u32_flags;
         } else
         if (is->pos < SEARCH_LENGTH) {
             /* add the match position, if any */
@@ -836,6 +839,10 @@
     }
     search_u32_len = search_to_u32(search_u32, countof(search_u32),
                                    search_str, flags);
+    /* empty string matches */
+    if (search_u32_len <= 0)
+        return;
+
     if (eb_search(s->b, dir, flags,
                   s->offset, s->b->total_size,
                   search_u32, search_u32_len,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]