From f70af6b7024aa95ceb9354764a31139ce92f43d5 Mon Sep 17 00:00:00 2001 From: Sanpi Date: Fri, 20 Jul 2018 11:56:58 +0200 Subject: [PATCH] Uses \ as tag separator https://github.com/todotxt/todo.txt/issues/13 --- docs/README.md | 4 ++-- src/tasks/task.rs | 2 +- src/widgets/filter.rs | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/README.md b/docs/README.md index 219e80b..90ef0ae 100644 --- a/docs/README.md +++ b/docs/README.md @@ -31,8 +31,8 @@ I tried to develop a clear interface without surprises, but you can easily miss some feature: * Double click on a feature, *everywhere*, open the edit panel; -* You can create sub-projects (or sub-contexts) by adding a dash. For example, - the project `+work-admin-automation` create this arborescence: +* You can create sub-projects (or sub-contexts) by adding a backslash. For +* example, the project `+work\admin\automation` create this arborescence: ```txt work diff --git a/src/tasks/task.rs b/src/tasks/task.rs index 447549f..06d13b6 100644 --- a/src/tasks/task.rs +++ b/src/tasks/task.rs @@ -25,7 +25,7 @@ impl Task { }) .into_owned(); - let regex = ::regex::Regex::new(r"(?P^|[\s])(?P[\+@][\w\-]+)").unwrap(); + let regex = ::regex::Regex::new(r"(?P^|[\s])(?P[\+@][\w\-\\]+)").unwrap(); subject = regex .replace_all(&subject, "$space$tag") .into_owned(); diff --git a/src/widgets/filter.rs b/src/widgets/filter.rs index 616b738..009d945 100644 --- a/src/widgets/filter.rs +++ b/src/widgets/filter.rs @@ -60,14 +60,15 @@ impl Filter { use gtk::ToValue; use std::slice::SliceConcatExt; + let separator = '\\'; let (filter, (done, total)) = filter; let progress = (done as f32 / total as f32) * 100.; let f = filter.clone(); - let mut levels: Vec<_> = f.split('-').collect(); + let mut levels: Vec<_> = f.split(separator).collect(); let title = levels.pop().unwrap(); - let parent = levels.join("-"); + let parent = levels.join(&separator.to_string()); if !parent.is_empty() && root.get(&parent).is_none() { self.append(root, (parent.clone(), (0, 0)));