diff --git a/Cargo.lock b/Cargo.lock index 2e1e585..b8bb666 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,7 +52,7 @@ dependencies = [ [[package]] name = "edhex" -version = "0.4.0" +version = "0.4.1" dependencies = [ "ansi_term", "clap", @@ -62,7 +62,7 @@ dependencies = [ [[package]] name = "edhex_core" -version = "0.7.0" +version = "0.7.1" dependencies = [ "ansi_term", "regex", diff --git a/Cargo.toml b/Cargo.toml index 5d65ebe..da9f4fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "edhex" -version = "0.4.0" +version = "0.4.1" authors = ["John Baber-Lucero "] license = "GPL-3.0" description = "Hex editor that works vaguely like ed" @@ -11,6 +11,6 @@ edition = "2018" [dependencies] ansi_term = "0.12.1" -edhex_core = { path = "../edhex_core", version = "0.7.0" } +edhex_core = { path = "../edhex_core", version = "0.7.1" } regex = "1.4.5" clap = "2.27.0" diff --git a/src/lib.rs b/src/lib.rs index 1c38598..781792b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,6 +73,7 @@ S (S)ave state to a file except the bytes you're editing. t3d Print 0x3d lines of con(t)extual bytes after current line [Default 0] T3d Print 0x3d lines of con(T)extual bytes before current line [Default 0] u (u)pdate filename to write to +U Toggle (U)nderlining main line v Insert a (v)isual break in the display at the current byte. NOTE: This does not insert a byte in the file. It's just display. V Remove a (V)isual break if one is at the current byte. @@ -114,7 +115,7 @@ impl Command { let re_search_again = Regex::new(r"^ *(?P[/?]) *$").unwrap(); let re_search_kill = Regex::new(r"^ */(?P[0-9a-fA-F]+)/k *$").unwrap(); let re_search_insert = Regex::new(r"^ */(?P[0-9a-fA-F]+)/i *$").unwrap(); - let re_single_char_command = Regex::new(r"^ *(?P[hijkmnopqRrsSlLPuvVwx]).*$").unwrap(); + let re_single_char_command = Regex::new(r"^ *(?P[hijkmnopqRrsSlLPuUvVwx]).*$").unwrap(); let re_range = Regex::new(r"^ *(?P[0-9a-fA-F.$]+) *, *(?P[0-9a-fA-F.$]+) *(?P.*) *$").unwrap(); let re_specified_index = Regex::new(r"^ *(?P[0-9A-Fa-f.$]+) *(?P.*) *$").unwrap(); let re_offset_index = Regex::new(r"^ *(?P[-+])(?P[0-9A-Fa-f]+) *(?P.*) *$").unwrap(); @@ -564,7 +565,7 @@ fn minuses(state:&mut State, num_minuses:usize) -> Result { } else { state.index -= num_minuses; - state.print_bytes(true); + state.print_bytes(); Ok(state.index) } } @@ -585,7 +586,7 @@ fn pluses(state:&mut State, num_pluses:usize) -> Result { } else { state.index += num_pluses; - state.print_bytes(true); + state.print_bytes(); Ok(state.index) } }, @@ -826,7 +827,7 @@ pub fn actual_runtime(filename:&str, pipe_mode:bool, color:bool, readonly:bool, println!("{}", Color::Yellow.paint("h for help")); println!("\n{}", state); println!(); - state.print_bytes(true); + state.print_bytes(); } // TODO Below here should be a function called main_loop() @@ -857,7 +858,7 @@ pub fn actual_runtime(filename:&str, pipe_mode:bool, color:bool, readonly:bool, 'g' => { match ec::move_to(&mut state, command.range.0) { Ok(_) => { - state.print_bytes(true); + state.print_bytes(); }, Err(error) => { println!("? ({})", error); @@ -934,7 +935,7 @@ pub fn actual_runtime(filename:&str, pipe_mode:bool, color:bool, readonly:bool, let first_byte_to_show_index = state.index.saturating_sub(width); state.index = first_byte_to_show_index; - state.print_bytes(true); + state.print_bytes(); } @@ -951,7 +952,7 @@ pub fn actual_runtime(filename:&str, pipe_mode:bool, color:bool, readonly:bool, state.all_bytes.append(&mut right_half); state.index = command.range.0; state.unsaved_changes = true; - state.print_bytes(true); + state.print_bytes(); }, @@ -994,6 +995,17 @@ pub fn actual_runtime(filename:&str, pipe_mode:bool, color:bool, readonly:bool, } }, + /* Toggle underlining non-context line */ + 'U' => { + state.prefs.underline_main_line = + if state.prefs.underline_main_line { + false + } + else { + true + }; + } + /* Insert a break in the display at current byte */ 'v' => { @@ -1077,7 +1089,7 @@ pub fn actual_runtime(filename:&str, pipe_mode:bool, color:bool, readonly:bool, continue; }; - state.print_bytes(true); + state.print_bytes(); }, /* Quit */