Implement yank/paste in visual bit editor ##visual
Some checks are pending
build / linux-wasi (push) Waiting to run
build / linux-wasi-api (push) Waiting to run
build / linux-csnext (push) Waiting to run
build / linux-ssl-crypto (push) Waiting to run
build / tarball (push) Waiting to run
build / linux-static (push) Waiting to run
build / linux-acr-rpm-64 (push) Waiting to run
build / linux-acr-deb (amd64) (push) Waiting to run
build / linux-acr-deb (arm64, aarch64-linux-gnu) (push) Waiting to run
build / linux-acr-deb (i386, multilib) (push) Waiting to run
build / macos-acr (arm64, 13) (push) Waiting to run
build / macos-acr (x86_64, 12) (push) Waiting to run
build / ios (cydia32) (push) Waiting to run
build / ios (true, cydia) (push) Waiting to run
build / android-acr (16, arm) (push) Waiting to run
build / android-acr (aarch64) (push) Waiting to run
build / android-meson (x86_64) (push) Waiting to run
build / w32-meson (push) Waiting to run
build / w64-static-2022 (push) Waiting to run
build / w64-static (push) Waiting to run
build / w64-meson (push) Waiting to run
build / check_abi_compatibility (push) Blocked by required conditions
build / check_release (push) Blocked by required conditions
build / release (push) Blocked by required conditions
CI / linux-acr-oldlibsbug (push) Waiting to run
CI / linux-nocs (push) Waiting to run
CI / linux-acr-gperf (push) Waiting to run
CI / linux-sys-capstone (push) Waiting to run
CI / linux-acr-resymlink (push) Waiting to run
CI / linux-test (push) Waiting to run
CI / linux-static-meson (push) Waiting to run
CI / macos-test (push) Waiting to run
CI / linux-rpath (push) Waiting to run
CI / macos-rpath (push) Waiting to run
CI / linux-meson-spaces (push) Waiting to run
CI / linux-tinyasan-fuzz (push) Waiting to run
CI / linux-asan-fuzz (push) Waiting to run
CI / w64-make (push) Waiting to run
CI / w32-mingw (push) Waiting to run
CI / w64-mingw (push) Waiting to run
Code scanning - action / CodeQL-Build (push) Waiting to run
Coverity Scan / latest (push) Waiting to run
tcc / ubuntu-tcc-newabi (push) Waiting to run
tcc / ubuntu-tcc-test (push) Waiting to run
tcc / ubuntu-tcc-nodbg (push) Waiting to run
tcc / r2pm-tcc (push) Waiting to run
tcc / ubuntu-tcc-syslibs (push) Waiting to run

This commit is contained in:
pancake 2024-11-19 01:36:42 +01:00
parent 386e94dd5f
commit fa964a4782

View File

@ -475,6 +475,8 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
const int nbits = sizeof (ut64) * 8;
bool colorBits = false;
int analopType;
ut8 yankBuffer[8] = {0};
int yankSize = 0;
int i, j, x = 0;
RAnalOp analop;
ut8 buf[sizeof (ut64)];
@ -856,6 +858,28 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
case 'b':
bitsInLine = !bitsInLine;
break;
case 'y': // yank
{
const int nbyte = x / 8;
const int last = R_MIN (nbyte + wordsize, 8);
yankSize = last - nbyte + 1;
int i;
for (i = nbyte; i < last; i++) {
yankBuffer[i - nbyte] = buf[i];
}
}
break;
case 'Y': // paste
{
const int nbyte = x / 8;
const int last = R_MIN (nbyte + wordsize, yankSize + nbyte);
int i;
int j = 0;
for (i = nbyte; i < last; i++) {
buf[i] = yankBuffer[j++];
}
}
break;
case '?':
r_cons_clear00 ();
r_cons_printf (
@ -868,6 +892,7 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
" J/K - next/prev instruction (so+1,so-1)\n"
" h/l - select next/previous bit\n"
" w/W - increment 2 or 4 the wordsize\n"
" y/Y - yank/paste selected bits\n"
" +/- - increment or decrement byte value\n"
" </> - rotate left/right byte value\n"
" i - insert numeric value of byte\n"