@@ -1039,6 +1039,24 @@ static unsigned int r_panels_adjust_side_panels(RCore *core) {
10391039 return space ;
10401040}
10411041
1042+ static void r_panels_setup_help_panel (RCore * core , RPanel * p , const char * title , const char * const * msg ) {
1043+ const char * help = "Help" ;
1044+ free (p -> model -> title );
1045+ free (p -> model -> cmd );
1046+ p -> model -> title = strdup (help );
1047+ p -> model -> cmd = strdup (help );
1048+ RStrBuf * rsb = r_strbuf_new (NULL );
1049+ r_core_visual_append_help (core , rsb , title , msg );
1050+ if (!rsb ) {
1051+ return ;
1052+ }
1053+ char * drained_string = r_strbuf_drain (rsb );
1054+ if (drained_string ) {
1055+ r_panels_set_read_only (core , p , drained_string );
1056+ free (drained_string );
1057+ }
1058+ }
1059+
10421060static void r_panels_update_help (RCore * core , RPanels * ps ) {
10431061 const char * help = "Help" ;
10441062 int i ;
@@ -1048,7 +1066,6 @@ static void r_panels_update_help(RCore *core, RPanels *ps) {
10481066 continue ;
10491067 }
10501068 if (!strncmp (p -> model -> cmd , help , strlen (help ))) {
1051- RStrBuf * rsb = r_strbuf_new (NULL );
10521069 const char * title ;
10531070 const char * const * msg ;
10541071 switch (ps -> mode ) {
@@ -1065,20 +1082,7 @@ static void r_panels_update_help(RCore *core, RPanels *ps) {
10651082 msg = help_msg_panels ;
10661083 break ;
10671084 }
1068- // panel's title does not change, keep it short and simple
1069- free (p -> model -> title );
1070- p -> model -> title = strdup (help );
1071- free (p -> model -> cmd );
1072- p -> model -> cmd = strdup (help );
1073- r_core_visual_append_help (core , rsb , title , msg );
1074- if (!rsb ) {
1075- break ;
1076- }
1077- char * drained = r_strbuf_drain (rsb );
1078- if (drained ) {
1079- r_panels_set_read_only (core , p , drained );
1080- free (drained );
1081- }
1085+ r_panels_setup_help_panel (core , p , title , msg );
10821086 p -> view -> refresh = true;
10831087 }
10841088 }
0 commit comments