Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't exit void when pressing Unselect key #56

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
bb7db39
Don't exit void when pressing unselect key
Gskartwii Jul 20, 2020
bf21d6b
Merge branch 'master' of https://github.com/void-rs/void
Gskartwii Jan 18, 2021
62d0341
Use colours that are better suitable for light theme
Gskartwii Mar 4, 2021
2c83e00
Add modal keybinds option
Gskartwii Mar 4, 2021
7ef5a39
Merge branch 'modal'
Gskartwii Mar 4, 2021
9270139
Make arrows stable
Gskartwii Mar 4, 2021
a85661e
stable-arrows -> master
Gskartwii Mar 4, 2021
74452d6
Improve help screen
Gskartwii Mar 4, 2021
61af662
Sort hotkey help based on description alphabetically
Gskartwii Mar 6, 2021
33600d1
Fix removal of arrows and arrows getting duplicated
Gskartwii Mar 7, 2021
3e25dc7
Ensure insert mode is applied when creating a new node
Gskartwii Mar 7, 2021
47ed043
Indicate insert mode in the header line
Gskartwii Mar 7, 2021
98ce310
Add ignore tag for tasks, strip tags when executing nodes
Gskartwii Mar 8, 2021
10255f0
Fix autotask ignore functionality
Gskartwii Mar 9, 2021
06cf2ab
Fix autotask ignoring nodes with exclusively #ignr children
Gskartwii Mar 11, 2021
ee45ad2
Let the user know when a node is being yanked
Gskartwii Mar 14, 2021
2b318d7
Add config for configuring node marks
Gskartwii Mar 18, 2021
d56870b
Don't save focus location when searching or autotasking
Gskartwii Mar 22, 2021
0d85213
Implement functionality for copying nodes
Gskartwii Sep 22, 2021
2e49062
Reformat
Gskartwii Sep 22, 2021
c3d940a
Deal with Clippy lints
Gskartwii Sep 22, 2021
e7eeece
Plot successful tasks in reverse direction
Gskartwii Sep 22, 2021
d88a040
Really plot sparklines in reverse, instead of clumping everything at …
Gskartwii Sep 24, 2021
04a540f
Implement deadlines with a nice calendar
Gskartwii Sep 25, 2021
d6abf5d
Implement mysterious fix for header rendering
Gskartwii Sep 25, 2021
78894a8
Automatically expand node when creating a child
Gskartwii Sep 26, 2021
0d326c6
When reordering nodes, skip invisible ones
Gskartwii Sep 26, 2021
53b085f
When deleting a node, make a new selection
Gskartwii Sep 26, 2021
df9dadf
When striking or deleting a node, a nearby sibling or parent is selec…
Gskartwii Sep 26, 2021
4c3ba39
In calendar, don't count nodes whose parent has been stricken
Gskartwii Sep 30, 2021
8228286
Fix underflow at start of month when finding Monday
Gskartwii Oct 2, 2021
34838f0
Stop overriding done-time based on date in node
Gskartwii Oct 2, 2021
202c426
Allow attaching URLs to node metadata
Gskartwii Oct 2, 2021
9719d44
Stop showing browser command output
Gskartwii Oct 4, 2021
11ca168
Accept 1-based indexing for terminal size
Gskartwii Oct 15, 2021
23c7d11
Display date on header line
Gskartwii Oct 16, 2021
6d69544
Don't count stricken subtrees for calendar
Gskartwii Oct 28, 2021
7d7bcb7
Don't overflow when there are too many assigned tasks
Gskartwii Nov 4, 2021
16d78d7
Prevent done tasks being counted twice, when actual tasks are counted…
Gskartwii Nov 11, 2021
fb8afca
Fix Unicode boundary issue in statusline drawing
Gskartwii Dec 27, 2021
64eadd0
Reap background processes
Gskartwii Feb 8, 2022
78091f9
Implement selecting first and last sibling, undoing completion marking
Gskartwii Feb 8, 2022
1226d96
Implement universal file locking
Gskartwii Feb 8, 2022
f075f5e
Reroute all stdout writes through buffer to avoid flickering
Gskartwii Feb 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 74 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ log = "0.4.11"
lazy_static = "1.4.0"
time = "0.2.22"
getopts = "0.2.21"
protobuf = "1"
protobuf = "2"
rand = "0.7.3"
libc = "0.2.80"
regex = "1.4.2"
unicode-segmentation = "1.6.0"
clippy = { version = "0.0.302", optional = true }
fs2 = "0.4.3"
chrono = "0.4"
hostname = "0.3.1"

[dev-dependencies]
quickcheck = "0.9.2"
16 changes: 12 additions & 4 deletions include/data_model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ message Tag {
}

message Gps {
required float lat = 1;
required float lon = 2;
optional float lat = 1;
optional float lon = 2;
}

message Date {
required uint32 day = 1;
required uint32 month = 2;
required uint32 year = 3;
}

message Meta {
Expand All @@ -18,7 +24,8 @@ message Meta {
optional uint64 finish_time = 5;
required Gps gps = 3;
repeated Tag tags = 4;
optional uint64 due = 6;
optional uint64 OLD_due = 6;
optional Date due_date = 7;
}

message Node {
Expand All @@ -31,10 +38,11 @@ message Node {
required bool hide_stricken = 7;
required uint32 x = 8;
required uint32 y = 9;
required bool selected = 10;
optional bool selected = 10;
required uint64 parent_id = 11;
optional string free_text = 12;
required bool auto_arrange = 13;
optional string url = 14;
}

message Arrow {
Expand Down
55 changes: 44 additions & 11 deletions src/bin/void/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
use fs2::FileExt;
use std::{ffi::OsString, fs::OpenOptions, io::Read};
use voidmap::{deserialize_screen, init_screen_log, Config, Screen};
use std::{
ffi::OsString,
fs::OpenOptions,
io::{Read, Write},
path::PathBuf,
};
use voidmap::{deserialize_screen, init_screen_log, Config};

mod cli;

struct DeleteOnDrop(PathBuf);

impl Drop for DeleteOnDrop {
fn drop(&mut self) {
std::fs::remove_file(&self.0).expect("failed to kill lockfile")
}
}

fn main() {
// Initialise the CLI parser
let app = cli::create();
Expand All @@ -16,31 +28,51 @@ fn main() {
.value_of("PATH")
.map(OsString::from)
.or_else(|| {
dirs::home_dir().and_then(|mut h| {
dirs::home_dir().map(|mut h| {
h.push(".void.db");
Some(h.into_os_string())
h.into_os_string()
})
})
.unwrap();

// load from file if present
let mut data = vec![];
let mut lock_path = PathBuf::new();
lock_path.push(&path);
let mut file_name = lock_path
.file_name()
.expect("a filename for the db is needed")
.to_owned();
file_name.push(".lock");
lock_path.set_file_name(file_name);

let mut lock_file = OpenOptions::new()
.write(true)
.create_new(true)
.open(&lock_path)
.expect("failed to lock db - is another process using it?");
write!(
lock_file,
"{}::{}",
hostname::get().unwrap().to_string_lossy(),
std::process::id()
)
.unwrap();
lock_file.sync_all().unwrap();
let guard = DeleteOnDrop(lock_path);

let mut f = OpenOptions::new()
.write(true)
.read(true)
.create(true)
.open(&path)
.unwrap();

// exclusively lock the file
f.try_lock_exclusive()
.unwrap_or_else(|_| panic!("Another `void` process is using this path already!"));

f.read_to_end(&mut data).unwrap();
let saved_screen = deserialize_screen(data).ok();
let saved_screen = deserialize_screen(data).expect("invalid screen");

// Initialise the main working screen
let mut screen = saved_screen.unwrap_or_else(Screen::default);
let mut screen = saved_screen/*.unwrap_or_else(Screen::default)*/;

screen.work_path = matches
.value_of("PATH")
Expand All @@ -58,4 +90,5 @@ fn main() {
screen.config = config;

screen.run();
drop(guard);
}
17 changes: 13 additions & 4 deletions src/colors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@ pub fn random_fg_color() -> String {
use termion::color::*;
let colors: Vec<String> = vec![
format!("{}", Fg(LightGreen)),
// format!("{}", Fg(LightBlack)),
format!("{}", Fg(LightBlack)),
format!("{}", Fg(LightRed)),
format!("{}", Fg(LightGreen)),
format!("{}", Fg(LightYellow)),
// format!("{}", Fg(LightBlue)),
//format!("{}", Fg(LightYellow)),
format!("{}", Fg(LightBlue)),
format!("{}", Fg(LightMagenta)),
format!("{}", Fg(LightCyan)),
format!("{}", Fg(LightWhite)),
//format!("{}", Fg(LightWhite)),
format!("{}", Fg(Green)),
format!("{}", Fg(Black)),
format!("{}", Fg(Red)),
format!("{}", Fg(Green)),
format!("{}", Fg(Yellow)),
format!("{}", Fg(Blue)),
format!("{}", Fg(Magenta)),
format!("{}", Fg(Cyan)),
//format!("{}", Fg(White)),
];
colors.choose(&mut rand::thread_rng()).unwrap().clone()
}
Loading