aboutsummaryrefslogtreecommitdiff
path: root/toys/other/hexedit.c
AgeCommit message (Collapse)Author
2021-05-16Add black and white mode (x to toggle)Rob Landley
2021-04-20hexedit: various improvements.Elliott Hughes
I've been using hexedit quite a lot, mainly for _corrupting_ files, and have been meaning to send this collection of changes for far too long now. I saw a bug requesting editing in the ASCII pane (which this patch _doesn't_ add), and wanted to get this sent in before it has to undergo the third massive merge conflict of its existence... The main "TODO" in this is that I never got round to implementing searching for an arbitrary byte sequence. It seems like we ought to have that feature, but personally I'm far more likely to jump to an offset or to search for some ASCII. I haven't needed to search for arbitrary byte sequences in all this time, so I'll fix this if/when I actually need it... * Enter (new) read-only mode rather than refusing to open read-only files. * More keys: page up/page down, home/end, and ctrl-home/ctrl-end for beginning/end of file. * Jump with ^J (or vi-like :). Enter absolute address or +12 or -40 for relative jumps. * Find with ^F (or vi-like /). No support for bytes, but useful for finding text. (^G or n for next match, ^D or p for previous match.) * Support all the usual suspects for "quit": vi-like q, desktop-like ^Q, panic ^C, or even plain old Esc. * The ASCII pane is made more readable by (hopefully) reasonable use of color. Regular control characters are shown in red using the appropriate letter (so a red A is 0x01, etc), printable characters are shown normally, and top-bit set characters are just shown as a purple question mark (since I couldn't come up with a better representation that had any obvious value --- in my experience top-bit set characters are either meaningless in ASCII, part of a UTF-8 sequence in modern files, or in some random code page in ancient files). The choice of red and purple was to deliberately make these not-actually-ASCII characters slide into the background; before this patch they have so many bright pixels (especially with the use of reverse video) that I couldn't clearly see the *actual* ASCII content in the ASCII pane. * Addresses are now shown in yellow. No real justification other than "it looks nice". * NUL bytes in the hex pane are shown dimmed. I find this helpful especially when there's a lot of padding, and it can actually be a useful clue when reverse engineering (you can "see" repeated patterns more easily), but I can understand if this one's controversial. * Errors are shown "vim style" in bold white text on a red background, waiting briefly to ensure they're seen. * The status bar shows the filename, whether the file is opened read-only, the current offset into the file, and the total length of the file. * SIGWINCH handling has been added.
2019-09-26hexedit: fix scrolling on legacy terminalsJarno Mäkipää
Thanks for James McMechan for pointing this out. Using esc[1L and esc[1M escapes with cursor jump to 1, 1 to make scrolling effect instead of S and T fixes scrolling inside Linux terminal and tmux -Jarno
2019-04-16Add argument to xflush() so it can test for stdout err without flushing.Rob Landley
2018-08-17Make microcom use set_terminal() and move speed setting into set_terminal().Rob Landley
2017-05-24Add and use xmmap.Elliott Hughes
Everyone forgets that mmap returns MAP_FAILED rather than NULL on failure. Every use of mmap in toybox was either doing the wrong check, or no check at all (including the two I personally added).
2016-02-25Fix more warnings on 32 bit builds.Rob Landley
2016-02-19Help text update from Isaac Dunham, tweaked slightly.Rob Landley
2016-01-17Extend utf8 fontmetrics so ps can use them.Rob Landley
Also, I forgot to check in uuid_show() last time.
2016-01-17Update draw_str() and friends to do standard escaping for ^X <AB> U+ABCD.Rob Landley
2016-01-10Make cursor left/right change sort type in iotop.Rob Landley
2016-01-07Make scan_key() specify timeout in miliseconds, split out terminal_probesize(),Rob Landley
add function key definitions and shift/ctrl/alt cursor keys.
2016-01-05Add error_msg_raw() and friends, replace error_msg("%s", s) uses, enable formatRob Landley
checking, and fix up format checking complaints. Added out(type, value) function to stat to avoid a zillion printf typecasts.
2015-12-27Add scan_key_getsize() doing the ANSI probe, switch scan_key() to TAGGED_ARRAY,Rob Landley
and add test_scankey.
2015-12-23Factor out draw_str() and friends.Rob Landley
2015-08-06Initialize uninitialized variable. (Oops.)Rob Landley
2015-06-27Add undo buffer for 'u'.Rob Landley
2015-06-27Simplify hexedit logic by adjusting viewport all in one place up top.Rob Landley
(Easier to genericize logic and reuse later in less or vi...)
2015-06-26Factor out more not-curses infrastructure into lib.Rob Landley
2015-05-13Print name of file at the bottom of the screen.Rob Landley
And yes, I tested $PWD/私はガラスを食べられま す。それは私を傷つけません。 as a name and made it work. If you throw newlines or ascii escapes in the name it'll use the fancy printing logic for chars, otherwise it does the full utf8 fontmetrics deal.
2015-05-13More hexedit cursor boundary tweaking.Rob Landley
2015-05-10Git hates me.Rob Landley
2015-04-27Promote hexedit to other.Rob Landley
2015-04-27Some infrastructure hexedit needs. (Poor man's curses.)Rob Landley