Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c879cdb271 | |||
| 596f3d5c12 | |||
| 7b5d56dd92 | |||
| e94c70fa9e |
@@ -44,6 +44,14 @@ jobs:
|
|||||||
- name: check version
|
- name: check version
|
||||||
# cut off the v part of the tag to only search for the number
|
# cut off the v part of the tag to only search for the number
|
||||||
run: grep --quiet "$(echo "${{ github.ref_name }}" | cut -c2-)" Cargo.toml
|
run: grep --quiet "$(echo "${{ github.ref_name }}" | cut -c2-)" Cargo.toml
|
||||||
|
- name: cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
- name: test
|
- name: test
|
||||||
run: cargo test --release
|
run: cargo test --release
|
||||||
- name: make completion/manpage folders
|
- name: make completion/manpage folders
|
||||||
|
|||||||
Generated
+1
-1
@@ -568,7 +568,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hexapoda"
|
name = "hexapoda"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"clap_complete",
|
"clap_complete",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "hexapoda"
|
name = "hexapoda"
|
||||||
# if run manually, CI will check for the string "ain" (lol), so here you go :)
|
# if run manually, CI will check for the string "ain" (lol), so here you go :)
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
description = "a colorful modal hex editor"
|
description = "a colorful modal hex editor"
|
||||||
repository = "https://github.com/simonomi/hexapoda"
|
repository = "https://github.com/simonomi/hexapoda"
|
||||||
keywords = ["cli", "tui", "hex", "tool", "editor"]
|
keywords = ["cli", "tui", "hex", "tool", "editor"]
|
||||||
|
|||||||
+22
-13
@@ -29,6 +29,11 @@ func camelCaseToSnakeCase(_ string: Substring) -> String {
|
|||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let cargoTOMLPath = URL(filePath: "Cargo.toml")
|
||||||
|
let cargoTOML = try String(contentsOf: cargoTOMLPath, encoding: .utf8)
|
||||||
|
|
||||||
|
let versionNumber = cargoTOML.matches(of: #/version = "(?'number'[\d\.]+)"/#).first!.output.number
|
||||||
|
|
||||||
let defaultConfigPath = URL(filePath: "src/config/default.rs")
|
let defaultConfigPath = URL(filePath: "src/config/default.rs")
|
||||||
|
|
||||||
let lines = try String(contentsOf: defaultConfigPath, encoding: .utf8)
|
let lines = try String(contentsOf: defaultConfigPath, encoding: .utf8)
|
||||||
@@ -38,31 +43,35 @@ let lines = try String(contentsOf: defaultConfigPath, encoding: .utf8)
|
|||||||
|
|
||||||
precondition(lines.first!.contains("Mode::Normal"))
|
precondition(lines.first!.contains("Mode::Normal"))
|
||||||
|
|
||||||
|
var output = """
|
||||||
|
{%- highlight toml -%}
|
||||||
|
#:schema https://simonomi.dev/hexapoda/config/schema-v\(versionNumber).json
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
var mode: String?
|
var mode: String?
|
||||||
|
|
||||||
for line in lines {
|
for line in lines {
|
||||||
if let match = line.wholeMatch(of: #/.*Mode::(?'mode'\w*),.*/#) {
|
if let match = line.wholeMatch(of: #/.*Mode::(?'mode'\w*),.*/#) {
|
||||||
mode = match.output.mode.lowercased()
|
mode = match.output.mode.lowercased()
|
||||||
} else if line.contains("None") {
|
} else if line.contains("None") {
|
||||||
print("[\(mode!)]")
|
output += "[\(mode!)]\n"
|
||||||
} else if let match = line.wholeMatch(of: #/.*PartialAction::(?'partialAction'\w*).*/#) {
|
} else if let match = line.wholeMatch(of: #/.*PartialAction::(?'partialAction'\w*).*/#) {
|
||||||
let partialAction = match.output.partialAction.lowercased()
|
let partialAction = match.output.partialAction.lowercased()
|
||||||
print("[\(mode!).\(partialAction)]")
|
output += "[\(mode!).\(partialAction)]\n"
|
||||||
} else if let match = line.wholeMatch(of: #/.*\(keypress\("(?'keypress'.*?)"\), (?'action'.*?)\.into\(\)\).*/#) {
|
} else if let match = line.wholeMatch(of: #/.*\(keypress\("(?'keypress'.*?)"\), (?'action'.*?)\.into\(\)\).*/#) {
|
||||||
if match.output.keypress.contains(where: { !($0.isLetter || $0.isNumber) }) {
|
if match.output.keypress.contains(where: { !($0.isLetter || $0.isNumber) }) {
|
||||||
print(
|
output += "\"\(match.output.keypress)\" = \"\(camelCaseToSnakeCase(match.output.action))\"\n"
|
||||||
"\"\(match.output.keypress)\"",
|
|
||||||
"=",
|
|
||||||
"\"\(camelCaseToSnakeCase(match.output.action))\""
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
print(
|
output += "\(match.output.keypress) = \"\(camelCaseToSnakeCase(match.output.action))\"\n"
|
||||||
match.output.keypress,
|
|
||||||
"=",
|
|
||||||
"\"\(camelCaseToSnakeCase(match.output.action))\""
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print()
|
output += "\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
output += "{%- endhighlight -%}\n"
|
||||||
|
|
||||||
|
let outputPath = URL(filePath: "~/Documents/programming/websites/simonomi.dev/_includes/hexapoda/hexapoda v\(versionNumber).toml")
|
||||||
|
try Data(output.utf8).write(to: outputPath)
|
||||||
|
|
||||||
|
print("wrote config to \(outputPath.path(percentEncoded: false))")
|
||||||
|
|||||||
+2
-1
@@ -250,7 +250,8 @@ impl App {
|
|||||||
fn mouse_event_position(&self, mouse_event: MouseEvent) -> Option<usize> {
|
fn mouse_event_position(&self, mouse_event: MouseEvent) -> Option<usize> {
|
||||||
let tab_bar_rows = usize::from(self.buffers.len() > 1);
|
let tab_bar_rows = usize::from(self.buffers.len() > 1);
|
||||||
|
|
||||||
if usize::from(mouse_event.row) - tab_bar_rows >= self.window_size.hex_rows() {
|
if usize::from(mouse_event.row) < tab_bar_rows ||
|
||||||
|
usize::from(mouse_event.row) - tab_bar_rows >= self.window_size.hex_rows() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ impl App {
|
|||||||
self.quit();
|
self.quit();
|
||||||
} else {
|
} else {
|
||||||
self.buffers[self.current_buffer_index].alert_message = Span::from(
|
self.buffers[self.current_buffer_index].alert_message = Span::from(
|
||||||
"there are unsaved changes, use Q to override"
|
"unsaved changes, use <space>w to save or Q to override"
|
||||||
).red();
|
).red();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
use crate::{buffer::{Buffer, Mode}, utilities::CustomGreys};
|
use crate::{buffer::{Buffer, Mode}, utilities::CustomGreys};
|
||||||
use ratatui::{style::{Color, Stylize}, text::{Line, Span, Text}};
|
use ratatui::{style::{Color, Stylize}, text::{Line, Span}};
|
||||||
|
|
||||||
impl Buffer {
|
impl Buffer {
|
||||||
pub fn render_status_line(&self) -> Text<'_> {
|
pub fn render_status_line(&self) -> Line<'_> {
|
||||||
Text::from(
|
|
||||||
Line::from_iter([
|
Line::from_iter([
|
||||||
self.render_mode(),
|
self.render_mode(),
|
||||||
" ".into(),
|
" ".into(),
|
||||||
@@ -12,7 +11,6 @@ impl Buffer {
|
|||||||
" ".into(),
|
" ".into(),
|
||||||
self.alert_message.clone()
|
self.alert_message.clone()
|
||||||
])
|
])
|
||||||
)
|
|
||||||
.bg(Color::ui_grey())
|
.bg(Color::ui_grey())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,11 @@ impl Default for Config {
|
|||||||
(keypress("l"), GotoLineEnd.into()),
|
(keypress("l"), GotoLineEnd.into()),
|
||||||
|
|
||||||
(keypress("g"), GotoFileStart.into()),
|
(keypress("g"), GotoFileStart.into()),
|
||||||
|
(keypress("i"), GotoFileStart.into()),
|
||||||
|
(keypress("k"), GotoFileEnd.into()),
|
||||||
|
|
||||||
|
(keypress("p"), PreviousBuffer.into()),
|
||||||
|
(keypress("n"), NextBuffer.into()),
|
||||||
].into()),
|
].into()),
|
||||||
(Some(PartialAction::View), [
|
(Some(PartialAction::View), [
|
||||||
(keypress("z"), AlignViewCenter.into()),
|
(keypress("z"), AlignViewCenter.into()),
|
||||||
@@ -153,6 +158,7 @@ impl Default for Config {
|
|||||||
(keypress("Q"), Quit.into()),
|
(keypress("Q"), Quit.into()),
|
||||||
|
|
||||||
(keypress("v"), NormalMode.into()),
|
(keypress("v"), NormalMode.into()),
|
||||||
|
(keypress("escape"), NormalMode.into()),
|
||||||
|
|
||||||
(keypress("g"), Goto.into()),
|
(keypress("g"), Goto.into()),
|
||||||
(keypress("z"), View.into()),
|
(keypress("z"), View.into()),
|
||||||
@@ -230,6 +236,11 @@ impl Default for Config {
|
|||||||
(keypress("l"), ExtendLineEnd.into()),
|
(keypress("l"), ExtendLineEnd.into()),
|
||||||
|
|
||||||
(keypress("g"), ExtendFileStart.into()),
|
(keypress("g"), ExtendFileStart.into()),
|
||||||
|
(keypress("i"), ExtendFileStart.into()),
|
||||||
|
(keypress("k"), ExtendFileEnd.into()),
|
||||||
|
|
||||||
|
(keypress("p"), PreviousBuffer.into()),
|
||||||
|
(keypress("n"), NextBuffer.into()),
|
||||||
].into()),
|
].into()),
|
||||||
(Some(PartialAction::View), [
|
(Some(PartialAction::View), [
|
||||||
(keypress("z"), AlignViewCenter.into()),
|
(keypress("z"), AlignViewCenter.into()),
|
||||||
|
|||||||
-28
@@ -25,34 +25,6 @@ const CHUNKS_PER_LINE: usize = BYTES_PER_LINE / BYTES_PER_CHUNK;
|
|||||||
const LINES_OF_PADDING: usize = 5;
|
const LINES_OF_PADDING: usize = 5;
|
||||||
const BYTES_OF_PADDING: usize = LINES_OF_PADDING * BYTES_PER_LINE;
|
const BYTES_OF_PADDING: usize = LINES_OF_PADDING * BYTES_PER_LINE;
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// - `go` goto entered offset
|
|
||||||
// - search
|
|
||||||
// - `/` hex, `A-/` ascii
|
|
||||||
// - if non-hex-digit typed, search ascii
|
|
||||||
// - inspector translations for varint
|
|
||||||
// - M mark at selected offset? (like Jm)
|
|
||||||
// - diffing
|
|
||||||
// - doesn't have to be anything fancy, just compare each byte 1:1
|
|
||||||
// - sync scroll ? sync selections ??
|
|
||||||
// - s/A-k/A-K
|
|
||||||
// - sm select marks
|
|
||||||
// - C-a/C-x
|
|
||||||
// - +/- to edit selected bytes by amount ?
|
|
||||||
// - operate on entire selection (u16/u32/etc)
|
|
||||||
// - hex or decimal ?
|
|
||||||
// - modifications
|
|
||||||
// - insert/append
|
|
||||||
// - mode
|
|
||||||
// - add to edit history when *leaving* insert mode
|
|
||||||
// - replace-and-keep-going
|
|
||||||
// - mode
|
|
||||||
// - change
|
|
||||||
// - A-r replaces with ASCII
|
|
||||||
// - jumplist
|
|
||||||
// - p
|
|
||||||
// - [/] to cycle view offset?
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let arguments = Arguments::parse();
|
let arguments = Arguments::parse();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# todo
|
||||||
|
- v1.0
|
||||||
|
- `<escape>` dismiss inspectors
|
||||||
|
- `T` Till
|
||||||
|
- click on tab to go to buffer
|
||||||
|
- `go` goto entered offset
|
||||||
|
- search
|
||||||
|
- `/` hex, `A-/` ASCII
|
||||||
|
- if non-hex-digit typed, search ASCII
|
||||||
|
- inspector translations for varint [#1](https://github.com/simonomi/hexapoda/issues/1#issue-4232822634)
|
||||||
|
- `M` mark at selected offset? (like `Jm`)
|
||||||
|
- diffing
|
||||||
|
- doesn't have to be anything fancy, just compare each byte 1:1
|
||||||
|
- sync scroll ? sync selections ??
|
||||||
|
- `s`/`A-k`/`A-K`
|
||||||
|
- sm select marks
|
||||||
|
- `C-a`/`C-x`
|
||||||
|
- `+`/`-` to edit selected bytes by amount ?
|
||||||
|
- operate on entire selection (u16/u32/etc)
|
||||||
|
- hex or decimal ?
|
||||||
|
- modifications
|
||||||
|
- insert/append
|
||||||
|
- mode
|
||||||
|
- add to edit history when *leaving* insert mode
|
||||||
|
- replace-and-keep-going
|
||||||
|
- mode
|
||||||
|
- change (basically `dh`)
|
||||||
|
- `p` put
|
||||||
|
- `A-r` replaces with ASCII
|
||||||
|
- jumplist (`C-o`/`C-i`)
|
||||||
|
- `[`/`]` to cycle view offset?
|
||||||
Reference in New Issue
Block a user