mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-20 20:55:32 +00:00
Improve visual text editor navigation ('j' moves to next line) ##visual
This commit is contained in:
parent
79679dbae0
commit
7cf0c56dbf
@ -3441,7 +3441,7 @@ static bool __handle_window_mode(RCore *core, const int key) {
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if (r_config_get_b (core->config, "scr.cursor")) {
|
||||
if (core->print->cur_enabled) {
|
||||
core->cons->cpos.x++;
|
||||
} else {
|
||||
(void)__move_to_direction (core, RIGHT);
|
||||
|
@ -1848,6 +1848,17 @@ static void cursor_nextrow(RCore *core, bool use_ocur) {
|
||||
nextOpcode (core);
|
||||
return;
|
||||
}
|
||||
if (PIDX == 4) { // TEXT
|
||||
int idx = p->cur_enabled? p->cur: 0;
|
||||
const ut8 *buf = core->block;
|
||||
if (idx < core->blocksize) {
|
||||
const ut8* nl = r_mem_mem (core->block + idx, core->blocksize - idx, (const ut8*)"\n", 1);
|
||||
if (nl) {
|
||||
p->cur = (int)(size_t)(nl - buf + 1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (PIDX == 7 || !strcmp ("prc", r_config_get (core->config, "cmd.visual"))) {
|
||||
p->cur += r_config_get_i (core->config, "hex.cols");
|
||||
@ -2113,7 +2124,7 @@ static bool insert_mode_enabled(RCore *core) {
|
||||
}
|
||||
if (ch == 0x7f) { // backspace
|
||||
if (textedit_mode) {
|
||||
if (core->print->cur > 0) {
|
||||
if (core->print->cur_enabled && core->print->cur > 0) {
|
||||
r_core_cmdf (core, "r-1@ 0x%08"PFMT64x" + %d", core->offset, core->print->cur - 1);
|
||||
core->print->cur--;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user