summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-12-24 16:03:43 +0100
committerDave Davenport <qball@gmpclient.org>2017-12-24 16:03:43 +0100
commit8492543ad6182049b96851143fec48fefe7eb468 (patch)
treecba41f4d439dabd4828e943a230a6040916c0a9d
parent8a9633d19c99ee1b1db8bb521a192c1eb0e55b9d (diff)
Add search mode toggle.issue742
Fixes: #742
-rw-r--r--config/config.c1
-rw-r--r--doc/test_xr.txt2
-rw-r--r--include/settings.h2
-rw-r--r--source/view.c6
-rw-r--r--source/xrmoptions.c2
5 files changed, 12 insertions, 1 deletions
diff --git a/config/config.c b/config/config.c
index 815d902a..b199d515 100644
--- a/config/config.c
+++ b/config/config.c
@@ -147,4 +147,5 @@ Settings config = {
.plugin_path = PLUGIN_PATH,
.max_history_size = 25,
.combi_hide_mode_prefix = FALSE,
+ .search_mode = FALSE,
};
diff --git a/doc/test_xr.txt b/doc/test_xr.txt
index a3d1534f..5e44d63f 100644
--- a/doc/test_xr.txt
+++ b/doc/test_xr.txt
@@ -114,6 +114,8 @@ rofi.scroll-method: 0
! rofi.max-history-size: 25
! "Hide the prefix mode prefix on the combi view." Set from: Default
! rofi.combi-hide-mode-prefix: false
+! "Switch from filter to search mode." Set from: Default
+! rofi.search-mode: false
! "Pidfile location" Set from: File
rofi.pid: /tmp/rofi.pid
! "Paste primary selection" Set from: File
diff --git a/include/settings.h b/include/settings.h
index 6361b969..95d4bc6d 100644
--- a/include/settings.h
+++ b/include/settings.h
@@ -165,6 +165,8 @@ typedef struct
/** Maximum history length per mode. */
unsigned int max_history_size;
gboolean combi_hide_mode_prefix;
+ /** Search instead of filter. */
+ gboolean search_mode;
} Settings;
/** Global Settings structure. */
extern Settings config;
diff --git a/source/view.c b/source/view.c
index 8ba6b699..19187667 100644
--- a/source/view.c
+++ b/source/view.c
@@ -1081,7 +1081,11 @@ static void rofi_view_refilter ( RofiViewState *state )
for ( unsigned int i = 0; i < state->num_lines; i++ ) {
state->line_map[i] = i;
}
- state->filtered_lines = state->num_lines;
+ if ( config.search_mode == FALSE ) {
+ state->filtered_lines = state->num_lines;
+ } else {
+ state->filtered_lines = 0;
+ }
}
listview_set_num_elements ( state->list_view, state->filtered_lines );
diff --git a/source/xrmoptions.c b/source/xrmoptions.c
index 36c296be..476bc050 100644
--- a/source/xrmoptions.c
+++ b/source/xrmoptions.c
@@ -210,6 +210,8 @@ static XrmOption xrmOptions[] = {
"Max history size (WARNING: can cause slowdowns when set to high).", CONFIG_DEFAULT },
{ xrm_Boolean, "combi-hide-mode-prefix", { .snum = &config.combi_hide_mode_prefix }, NULL,
"Hide the prefix mode prefix on the combi view.", CONFIG_DEFAULT },
+ { xrm_Boolean, "search-mode" , { .snum = &config.search_mode }, NULL,
+ "Switch from filter to search mode.", CONFIG_DEFAULT },
};
/** Dynamic array of extra options */