@@ -2604,10 +2604,28 @@ ncursesPrinter(dsd_opts* opts, dsd_state* state) {
26042604 attron (COLOR_PAIR (4 ));
26052605
26062606 if (item -> event_string [0 ] != '\0' ) {
2607+ char compact_string [2000 ];
26072608 char text_string [2000 ];
2608- memcpy (text_string , item -> event_string , (size_t )string_size * sizeof (char ));
2609- text_string [string_size ] = 0 ; //terminate string
2610- printw ("| " );
2609+ ui_history_compact_event_text (compact_string , sizeof compact_string , item -> event_string ,
2610+ history_mode );
2611+
2612+ const int show_enc_tag = (history_mode == 1 && item -> enc != 0 );
2613+ const char * line_prefix = show_enc_tag ? "| [ENC] " : "| " ;
2614+ const int line_prefix_len = show_enc_tag ? 8 : 2 ;
2615+ uint16_t line_size = string_size ;
2616+ if (history_mode != 2 && cols > 0 ) {
2617+ int max_text = cols - (line_prefix_len + 2 );
2618+ if (max_text < 0 ) {
2619+ max_text = 0 ;
2620+ }
2621+ if (max_text < (int )line_size ) {
2622+ line_size = (uint16_t )max_text ;
2623+ }
2624+ }
2625+
2626+ memcpy (text_string , compact_string , (size_t )line_size * sizeof (char ));
2627+ text_string [line_size ] = 0 ; //terminate string
2628+ printw ("%s" , line_prefix );
26112629 attron (COLOR_PAIR (color_pair )); //this is where the custom color switch occurs for the
26122630 //event_string
26132631 printw ("%s\n" , text_string );
@@ -2661,13 +2679,13 @@ ncursesPrinter(dsd_opts* opts, dsd_state* state) {
26612679 }
26622680 }
26632681 } else {
2664- const int prefix_len = 5 ; // "| S# " (5)
2682+ const int base_prefix_len = 5 ; // "|[1] " (5)
26652683 uint16_t idx0 = 1 ;
26662684 uint16_t idx1 = 1 ;
26672685 uint16_t skip = state -> eh_index ;
26682686
26692687 if (history_mode != 2 && cols > 0 ) {
2670- int max_text = cols - (prefix_len + 2 );
2688+ int max_text = cols - (base_prefix_len + 2 );
26712689 if (max_text < 0 ) {
26722690 max_text = 0 ;
26732691 }
@@ -2737,10 +2755,33 @@ ncursesPrinter(dsd_opts* opts, dsd_state* state) {
27372755 uint8_t color_pair = item -> color_pair ;
27382756 attron (COLOR_PAIR (4 ));
27392757
2758+ char compact_string [2000 ];
27402759 char text_string [2000 ];
2741- memcpy (text_string , item -> event_string , (size_t )string_size * sizeof (char ));
2742- text_string [string_size ] = 0 ; //terminate string
2743- printw ("| S%d " , slot + 1 );
2760+ char line_prefix [16 ];
2761+ const int show_enc_tag = (history_mode == 1 && item -> enc != 0 );
2762+ if (show_enc_tag ) {
2763+ snprintf (line_prefix , sizeof line_prefix , "|[%d] [ENC] " , slot + 1 );
2764+ } else {
2765+ snprintf (line_prefix , sizeof line_prefix , "|[%d] " , slot + 1 );
2766+ }
2767+
2768+ ui_history_compact_event_text (compact_string , sizeof compact_string , item -> event_string ,
2769+ history_mode );
2770+
2771+ uint16_t line_size = string_size ;
2772+ if (history_mode != 2 && cols > 0 ) {
2773+ int max_text = cols - ((int )strlen (line_prefix ) + 2 );
2774+ if (max_text < 0 ) {
2775+ max_text = 0 ;
2776+ }
2777+ if (max_text < (int )line_size ) {
2778+ line_size = (uint16_t )max_text ;
2779+ }
2780+ }
2781+
2782+ memcpy (text_string , compact_string , (size_t )line_size * sizeof (char ));
2783+ text_string [line_size ] = 0 ; //terminate string
2784+ printw ("%s" , line_prefix );
27442785 attron (COLOR_PAIR (color_pair )); //this is where the custom color switch occurs for the event_string
27452786 printw ("%s\n" , text_string );
27462787 attron (COLOR_PAIR (4 ));
@@ -2751,7 +2792,7 @@ ncursesPrinter(dsd_opts* opts, dsd_state* state) {
27512792 break ;
27522793 }
27532794 attron (COLOR_PAIR (4 )); //feel free to change this to any value you want
2754- printw ("| S%d \\-- %s\n" , slot + 1 , item -> text_message );
2795+ printw ("|[%d] \\-- %s\n" , slot + 1 , item -> text_message );
27552796 attron (COLOR_PAIR (4 ));
27562797 }
27572798
@@ -2761,7 +2802,7 @@ ncursesPrinter(dsd_opts* opts, dsd_state* state) {
27612802 break ;
27622803 }
27632804 attron (COLOR_PAIR (4 ));
2764- printw ("| S%d \\-- Alias: %s \n" , slot + 1 , item -> alias );
2805+ printw ("|[%d] \\-- Alias: %s \n" , slot + 1 , item -> alias );
27652806 attron (COLOR_PAIR (4 ));
27662807 }
27672808
@@ -2771,7 +2812,7 @@ ncursesPrinter(dsd_opts* opts, dsd_state* state) {
27712812 break ;
27722813 }
27732814 attron (COLOR_PAIR (4 ));
2774- printw ("| S%d \\-- GPS: %s \n" , slot + 1 , item -> gps_s );
2815+ printw ("|[%d] \\-- GPS: %s \n" , slot + 1 , item -> gps_s );
27752816 attron (COLOR_PAIR (4 ));
27762817 }
27772818
@@ -2781,7 +2822,7 @@ ncursesPrinter(dsd_opts* opts, dsd_state* state) {
27812822 break ;
27822823 }
27832824 attron (COLOR_PAIR (4 ));
2784- printw ("| S%d \\-- DSD-neo: %s \n" , slot + 1 , item -> internal_str );
2825+ printw ("|[%d] \\-- DSD-neo: %s \n" , slot + 1 , item -> internal_str );
27852826 attron (COLOR_PAIR (4 ));
27862827 }
27872828 }
0 commit comments