Giter Site home page Giter Site logo

heh's People

Contributors

0b11001111 avatar dependabot[bot] avatar jondot avatar joooooooooooooooooooooooooooooooooooosh avatar jungletryne avatar ndd7xv avatar orhun avatar programingjd avatar samoylovfp avatar yuankunzhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

heh's Issues

Implement Page Up/Page Down

Page Up and Page Down should make the cursor jump a screens' worth of bytes (lines_per_screen * bytes_per_line) since it'd be easier and quicker to navigate the contents of a file.

Feel free to ask any clarifying questions or express any concerns!

[BUG] error[E0583]: file not found for module `windows`

Describe the bug

Updating heh from https://github.com/ndd7xv/heh.git
    Updating git repository `https://github.com/ndd7xv/heh.git`
  Installing heh v0.4.1 (https://github.com/ndd7xv/heh.git#a3bd3ffb)
    Updating crates.io index
  Downloaded crossbeam-queue v0.3.8
  Downloaded thiserror-impl v1.0.48
  Downloaded memmap2 v0.7.1
  Downloaded clap_lex v0.5.1
  Downloaded paste v1.0.14
  Downloaded quote v1.0.33
  Downloaded crossbeam-utils v0.8.16
  Downloaded crossterm v0.27.0
  Downloaded ratatui v0.22.0
  Downloaded clap_builder v4.4.2
  Downloaded syn v2.0.31
  Downloaded windows-sys v0.48.0
  Downloaded winapi v0.3.9
  Downloaded windows_x86_64_msvc v0.48.5
  Downloaded libc v0.2.147
  Downloaded anstyle-wincon v2.1.0
  Downloaded unicode-segmentation v1.10.1
  Downloaded clap_derive v4.4.2
  Downloaded anstyle-parse v0.2.1
  Downloaded parking_lot v0.12.1
  Downloaded thiserror v1.0.48
  Downloaded crossbeam-channel v0.5.8
  Downloaded lock_api v0.4.10
  Downloaded clap v4.4.2
  Downloaded proc-macro2 v1.0.66
  Downloaded crossbeam v0.8.2
  Downloaded log v0.4.20
  Downloaded unicode-width v0.1.10
  Downloaded smallvec v1.11.0
  Downloaded str-buf v1.0.6
  Downloaded strsim v0.10.0
  Downloaded unicode-ident v1.0.11
  Downloaded parking_lot_core v0.9.8
  Downloaded anstream v0.5.0
  Downloaded bitflags v2.4.0
  Downloaded crossterm_winapi v0.9.1
  Downloaded bitflags v1.3.2
  Downloaded cfg-if v1.0.0
  Downloaded cassowary v0.3.0
  Downloaded utf8parse v0.2.1
  Downloaded crossbeam-deque v0.8.3
  Downloaded error-code v2.3.1
  Downloaded windows-targets v0.48.5
  Downloaded crossbeam-epoch v0.9.15
  Downloaded clipboard-win v4.5.0
  Downloaded anstyle-query v1.0.0
  Downloaded anstyle v1.0.2
  Downloaded colorchoice v1.0.0
  Downloaded autocfg v1.1.0
  Downloaded indoc v2.0.3
  Downloaded heck v0.4.1
  Downloaded scopeguard v1.2.0
  Downloaded memoffset v0.9.0
  Downloaded arboard v3.2.1
  Downloaded crossterm v0.26.1
  Downloaded 55 crates (7.3 MB) in 0.68s (largest was `windows-sys` at 2.6 MB)
   Compiling autocfg v1.1.0
   Compiling windows_x86_64_msvc v0.48.5
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.66
   Compiling scopeguard v1.2.0
   Compiling winapi v0.3.9
   Compiling unicode-ident v1.0.11
   Compiling crossbeam-utils v0.8.16
   Compiling parking_lot_core v0.9.8
   Compiling smallvec v1.11.0
   Compiling libc v0.2.147
   Compiling anstyle v1.0.2
   Compiling utf8parse v0.2.1
   Compiling colorchoice v1.0.0
   Compiling thiserror v1.0.48
   Compiling paste v1.0.14
   Compiling crossbeam-queue v0.3.8
   Compiling str-buf v1.0.6
   Compiling anstyle-parse v0.2.1
   Compiling heck v0.4.1
   Compiling bitflags v1.3.2
   Compiling bitflags v2.4.0
   Compiling clap_lex v0.5.1
   Compiling strsim v0.10.0
   Compiling indoc v2.0.3
   Compiling lock_api v0.4.10
   Compiling memoffset v0.9.0
   Compiling crossbeam-epoch v0.9.15
   Compiling unicode-width v0.1.10
   Compiling unicode-segmentation v1.10.1
   Compiling log v0.4.20
error[E0583]: file not found for module `windows`
  --> ~\scoop\persist\rustup-msvc\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libc-0.2.147\src\lib.rs:98:9
   |
98 |         mod windows;
   |         ^^^^^^^^^^^^
   |
   = help: to create the module `windows`, create file "~\scoop\persist\rustup-msvc\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libc-0.2.147\src\windows.rs" or "~\scoop\persist\rustup-msvc\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libc-0.2.147\src\windows\mod.rs"

For more information about this error, try `rustc --explain E0583`.
error: could not compile `libc` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `heh v0.4.1 (https://github.com/ndd7xv/heh.git#a3bd3ffb)`, intermediate artifacts can be found at `~\AppData\Local\Temp\cargo-install7M2I8y`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.


Updated 0 git packages.
Failed to update heh.

NativeCommandExitException: Program "cargo.exe" ended with non-zero exit code: 101.

โฏ rustc --explain E0583
A file wasn't found for an out-of-line module.

Erroneous code example:

mod file_that_doesnt_exist; // error: file not found for module

fn main() {}

Please be sure that a file corresponding to the module exists. If you
want to use a module named `file_that_doesnt_exist`, you need to have a file
named `file_that_doesnt_exist.rs` or `file_that_doesnt_exist/mod.rs` in the
same directory.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 19044.3324

Improve repository readability and documentation

As per this feedback,

  • Give more spacing between functions
  • Add comments to generate rustdoc
  • Add additional comments on obscure code

I'm extending this beyond the listed recommendations because the suggestions are a part of the bigger idea to make this repo understandable - if there's anything that needs to be changed (or you think should be added) in the README, typos in a comment, or a refactoring of unidiomatic/messy code, those changes (whether they be in a different PR or not) are welcome to reference this issue.

Refactor label.rs

I'm hoping to reduce the code using a macro, and add tests for this file.

Refactor Input Handling

As a part of my self code-review/ramblings in #19, the input is being handled based off of the FocusedWindow is becoming too long and should be refactored.

One potential solution is using traits, described in #19 (comment). We could also just keep Popup(PopupData) in the enum and impl each case.

Welcoming other suggestions as well! ๐Ÿ˜„

Implement Crash Handling

Background

If you run something like

kill <heh pid> # which you can probably get with $(ps -ef | grep heh | grep -v grep | awk '{print $2}')

heh will terminate and fail to save any progress or changes made. It will also remain with raw mode enabled, rendering the terminal session extremely difficult to use.

Task

When running the command mentioned above, heh should have some sort of graceful way of preventing data loss, or at least a way to alert the user and leave the terminal session usable. Doing the same thing for vim prints out

Vim: Caught deadly signal TERM
Vim: preserving files...
Vim: Finished.

For saving things, we could try using .swp files.

Add sample data

Hello,

When I ran in your repo few days ago, I wanted to try the tool but realized there was no sample data anywhere that could help me to test your tool.

Since I had no data to test the tool on either, I couldn't test.

Maybe it would be a good idea to add sample data for people that just want to have a look on your project ? ๐Ÿ˜„

Give Option to Toggle Label Data

Currently there is no option to hide the labels at the bottom that give information about the point where your cursor is on. GHex has an option to toggle this (indicated by the arrow in the bottom-right).

image

For now, I think it would be nice to have this feature stored behind a keyboard shortcut.

Implement "Move Cursor to Click" feature

This might require a big refactor of the way hex/ASCII is currently displayed. Many editors (regardless of being hex editors or not) have the ability to move the cursor to the location that is clicked. It would be really convenient for navigation to a general area, as opposed to arrowing over or typing in a specific byte.

Implement Undo

Background

heh currently has no way to undo a deleted or back-spaced byte. It would also be convenient for users to "un-type" things are go back to a position the cursor was previously located at.

Task

I'm thinking to implement something basic, we could have a Vector of Actions, which would be an enumeration of the different actions a user will be able to undo. Hitting ctrl+z would pop actions from the vector and undo that command, while doing an action would push it to the vector.

Add `--offset` option

Add an --offset option so that users can use it from the command line and immediately be at the specified offset in the file.

For example:

heh <file> --offset 0x10FF90

Should put the cursor at position 0x10FF90.

  1. The offset should be able to read hex or decimal. If it can't be parsed then make the cursor position 0.
  2. If the offset is negative, set the cursor position to the 0 byte (maybe add notification?).
  3. If the offset is larger than the file size, set the cursor position to the last byte (maybe add notification?).

[BUG] `--version` missing

Describe the bug
The README sais --version exist, but it does not.

To Reproduce

[nix-shell:~/.cache/nixpkgs-review/pr-246402]$ heh --version
error: unexpected argument '--version' found

  tip: to pass '--version' as a value, use '-- --version'

Usage: heh [OPTIONS] <FILE>

For more information, try '--help'.

The tip is not helping here:

[nix-shell:~/.cache/nixpkgs-review/pr-246402]$ heh -- --version
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }

Expected behavior
It is a basic option like --help that any CLI program should have.

Desktop (please complete the following information):

  • OS: NixOS 22.11.4588.93fddcf640c

Additional context
Noticed while reviewing the packaging for NixOS: NixOS/nixpkgs#246402

Implement Scroll Feature

Scrolling with the mouse should move the view up and down, similar to when moving the cursor outside the current view of bytes.

Add Unicode Support

Suggested in a Reddit comment, but putting it here if there are any ideas.

I think it'll be complicated to do this, and I don't think many hex editors support Unicode. Many files inspected with a hex editor (such as binaries or specific file formats) often have random bytes that are not ASCII printable but also not Unicode. Thus, there probably needs to be a way to differentiate between a byte stream that can represent Unicode and just a byte stream that's random bytes.

There may also be other concerns that aren't coming to mind right now.

Add Tests

at this point it's a little embarrassing

especially since the only tests that have been added were added by contributors - not me lol

Implement "Jump to byte" Feature

In larger files, keying your way to the selected byte isn't going to cut it. GHex has a "Goto/Jump to Byte" feature that allows a user to input a byte they want to select - it can interpret decimal or hex (e.g., 10 or 0xA). The shortcut to use it is Ctrl+J.

image

I'm thinking that this could be done by creating a popup (example), though I'm open to other ideas - having text input update in the "Notifications" label wouldn't sound half bad if it weren't for the fact that I called it "Notifications."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.