Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 16 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
- `t` now truncates the file (it was `T` before).
- `T` reverse truncates the file (deletes from offset 0 to current offset).
- Both commands above need confirmation from the user as they can't be undone.
- Selection mode:
- Selection mode:
- Bug fix: selection no longer disappears when selected range is bigger than page size.
- Users can now mark colored blocks with `Alt-m`. Press multiple times to change colors. `[` and `]` keys navigate to marked block boundaries.

## dz6 v0.6.0

- Hex view:
- `Ctrl+f` goes down one page (same as `PgDown`).
- `Ctrl+f` goes down one page (same as `PgDown`).
- `Ctrl+b` goes up one page (same as `PgUp`).
- `~` changes case when applicable (available in Normal, Replace, and Select modes).
- `Ctrl+a`, `Ctrl+x`, `n`, and `z` work without putting the editor in Replace mode.
Expand Down Expand Up @@ -57,25 +58,25 @@
- Basic support for multibyte selection. Press `v` (like visual mode in vim), then select a byte range. Then, `y` to copy bytes to clipboard, `z` to fill them with zeroes, or `n` to fill them with x86 NOPs.
- Support for initialization file at `$HOME/.gdbinit`. Commands added to this file will be executed at startup (one per line). (https://github.com/mentebinaria/dz6/issues/12)
- New `:` commands:
- `set db` turn on database loading/saving (default)
- `set nodb` turn off the above
- `set db` turn on database loading/saving (default)
- `set nodb` turn off the above

## dz6 v0.4.0

- Status bar now shows "COMMAND" when you press `:`.
- New `:` commands:
- `cmt <offset> <comment>` (programatic alternative to `;`)
- `set byteline <number>` sets the number of bytes per line in the hex dump
- `set ctrlchar <char>`sets the character shown for ASCII non-graphical byte values
- `set dimzero` dim nullbytes
- `set dimctrl` dim all control characters
- `set nodim` turn off dimming
- `set theme` changes the theme
- `w` write changes to file
- `wq` or `x` write changes to file and quit
- `cmt <offset> <comment>` (programatic alternative to `;`)
- `set byteline <number>` sets the number of bytes per line in the hex dump
- `set ctrlchar <char>`sets the character shown for ASCII non-graphical byte values
- `set dimzero` dim nullbytes
- `set dimctrl` dim all control characters
- `set nodim` turn off dimming
- `set theme` changes the theme
- `w` write changes to file
- `wq` or `x` write changes to file and quit
- In-memory buffer when patching bytes. Nothing is written to the file until you use some of the writing commands (`w`, `wq` or `x`), but truncating is an exception (`T` in replace mode).
- Light theme.
- dz6 beeps if you try to enter replace mode when editing a read-only file.
- Light theme.
- dz6 beeps if you try to enter replace mode when editing a read-only file.

## dz6 v0.3.1

Expand Down
113 changes: 95 additions & 18 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ evalexpr = "13.1.*"
hex = "0.4.3"
memchr = "2.8.0"
mmap-io = "0.9.4"
rand = "0.10.1"
ratatui = "0.30.0"
regex = "1.11.2"
serde = { version = "1.0.228", features = ["derive"] }
Expand Down
5 changes: 4 additions & 1 deletion src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ impl App {
let target_db: PathBuf = target_dir.join(&cwd_db);

// if there's nothing to be saved, delete any existing db files and return
if self.hex_view.bookmarks.is_empty() && self.hex_view.comment_name_list.is_empty() {
if self.hex_view.bookmarks.is_empty()
&& self.hex_view.comment_name_list.is_empty()
&& self.hex_view.blocks.is_empty()
{
let _ = fs::remove_file(target_db);
let _ = fs::remove_file(cwd_db);
return Ok(());
Expand Down
32 changes: 32 additions & 0 deletions src/hex/blocks.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use rand::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Default, Serialize, Deserialize, PartialEq, Eq, PartialOrd)]
pub struct ColoredBlock {
pub start: usize,
pub end: usize,
pub bg_color: u32,
pub fg_color: u32,
}

fn get_random_color() -> u32 {
let mut rng = rand::rng();

rng.random::<u32>()
}

impl ColoredBlock {
pub fn new(start: usize, end: usize) -> Self {
ColoredBlock {
start,
end,
bg_color: get_random_color(),
fg_color: get_random_color(),
}
}

pub fn set_random_color(&mut self) {
self.bg_color = get_random_color();
self.fg_color = get_random_color();
}
}
Loading
Loading