[RB] Add (unfinished regex test)

This commit is contained in:
Dave Davenport 2023-05-10 18:09:54 +02:00
parent 848277001f
commit 4d2941caf3
3 changed files with 8 additions and 3 deletions

View File

@ -11,6 +11,7 @@ if [[ $ROFI_RETV = 0 ]]
then
echo -en "\x00delim\x1f\\x1\n"
fi
echo -en "\x00message\x1fmy line1\nmyline2\nmy line3\x1"
echo -en "\x00prompt\x1fChange prompt\x1"
for a in {1..10}
do

View File

@ -257,8 +257,6 @@ static gpointer read_input_thread(gpointer userdata) {
ssize_t nread = 0;
ssize_t len = 0;
char *line = NULL;
// Create the message passing queue to the UI thread.
pd->async_queue = g_async_queue_new();
Block *block = NULL;
GTimer *tim = g_timer_new();
@ -616,6 +614,8 @@ static int dmenu_mode_init(Mode *sw) {
}
pd->wake_source =
g_unix_fd_add(pd->pipefd2[0], G_IO_IN, dmenu_async_read_proc, pd);
// Create the message passing queue to the UI thread.
pd->async_queue = g_async_queue_new();
pd->reading_thread =
g_thread_new("dmenu-read", (GThreadFunc)read_input_thread, pd);
pd->loading = TRUE;

View File

@ -110,6 +110,7 @@ typedef struct {
guint end_thread;
gboolean loading;
int pipefd2[2];
GRegex *filter_regex;
} FileBrowserModePrivateData;
/**
@ -253,7 +254,9 @@ static void scan_dir(FileBrowserModePrivateData *pd, GFile *path) {
if (g_strcmp0(rd->d_name, ".") == 0) {
continue;
}
if (rd->d_name[0] == '.') {
if (pd->filter_regex &&
g_regex_match(pd->filter_regex, rd->d_name, 0, NULL)) {
printf("skip: %s\n", rd->d_name);
continue;
}
switch (rd->d_type) {
@ -377,6 +380,7 @@ static int recursive_browser_mode_init(Mode *sw) {
if (pipe(pd->pipefd2) == -1) {
g_error("Failed to create pipe");
}
pd->filter_regex = g_regex_new("^(\\..*)", G_REGEX_OPTIMIZE, 0, NULL);
pd->wake_source = g_unix_fd_add(pd->pipefd2[0], G_IO_IN,
recursive_browser_async_read_proc, pd);