@@ -3287,7 +3287,7 @@ static void scrollbar(RCore *core) {
3287
3287
3288
3288
static void visual_refresh (RCore * core ) {
3289
3289
static ut64 oseek = UT64_MAX ;
3290
- const char * vi , * vcmd ;
3290
+ const char * vi , * vcmd , * cmd_str ;
3291
3291
if (!core ) {
3292
3292
return ;
3293
3293
}
@@ -3304,24 +3304,29 @@ static void visual_refresh(RCore *core) {
3304
3304
r_cons_flush ();
3305
3305
r_cons_print_clear ();
3306
3306
3307
- vi = r_config_get (core -> config , "cmd.cprompt" );
3307
+ int hex_cols = r_config_get_i (core -> config , "hex.cols" );
3308
+ int split_w = 12 + 4 + hex_cols + (hex_cols * 3 );
3308
3309
bool ce = core -> print -> cur_enabled ;
3309
- if (vi && * vi ) {
3310
+
3311
+ vi = r_config_get (core -> config , "cmd.cprompt" );
3312
+ bool vsplit = (vi && * vi );
3313
+
3314
+ if (vsplit ) {
3310
3315
// XXX: slow
3311
3316
core -> cons -> blankline = false;
3312
3317
r_cons_clear00 ();
3313
3318
{
3314
- int hc = r_config_get_i (core -> config , "hex.cols" );
3315
- int nw = 12 + 4 + hc + (hc * 3 );
3316
- if (nw > w ) {
3319
+ int hex_cols = r_config_get_i (core -> config , "hex.cols" );
3320
+ int split_w = 12 + 4 + hex_cols + (hex_cols * 3 );
3321
+ if (split_w > w ) {
3317
3322
// do not show column contents
3318
3323
} else {
3319
3324
r_cons_printf ("[cmd.cprompt=%s]\n" , vi );
3320
3325
if (oseek != UT64_MAX ) {
3321
3326
r_core_seek (core , oseek , 1 );
3322
3327
}
3323
3328
r_core_cmd0 (core , vi );
3324
- r_cons_column (nw );
3329
+ r_cons_column (split_w );
3325
3330
if (!strncmp (vi , "p=" , 2 ) && core -> print -> cur_enabled ) {
3326
3331
oseek = core -> offset ;
3327
3332
core -> print -> cur_enabled = false;
@@ -3349,7 +3354,7 @@ static void visual_refresh(RCore *core) {
3349
3354
// disable screen bounds when it's a user-defined command
3350
3355
// because it can cause some issues
3351
3356
core -> print -> screen_bounds = 0 ;
3352
- r_core_cmd ( core , vcmd , 0 ) ;
3357
+ cmd_str = vcmd ;
3353
3358
} else {
3354
3359
if (splitView ) {
3355
3360
static char debugstr [512 ];
@@ -3370,10 +3375,20 @@ static void visual_refresh(RCore *core) {
3370
3375
pxw , size , splitPtr ,
3371
3376
pxw , size , core -> offset );
3372
3377
core -> print -> screen_bounds = 1LL ;
3373
- r_core_cmd0 ( core , debugstr ) ;
3378
+ cmd_str = debugstr ;
3374
3379
} else {
3375
3380
core -> print -> screen_bounds = 1LL ;
3376
- r_core_cmd0 (core , zoom ? "pz" : printfmt [PIDX ]);
3381
+ cmd_str = (zoom ? "pz" : printfmt [PIDX ]);
3382
+ }
3383
+ }
3384
+ if (cmd_str && * cmd_str ) {
3385
+ if (vsplit ) {
3386
+ char * cmd_result ;
3387
+ cmd_result = r_core_cmd_str (core , cmd_str );
3388
+ cmd_result = r_str_ansi_crop (cmd_result , 0 , 0 , split_w , -1 );
3389
+ r_cons_strcat (cmd_result );
3390
+ } else {
3391
+ r_core_cmd0 (core , cmd_str );
3377
3392
}
3378
3393
}
3379
3394
core -> print -> cur_enabled = ce ;
0 commit comments