@@ -96,13 +96,16 @@ fn render_content(f: &mut Frame, app: &App, area: Rect) {
9696 return ;
9797 }
9898
99+ // When in elicitation form, show errors inside the form overlay instead of replacing content
99100 if let Some ( error) = & app. error_message {
100- let error_widget = Paragraph :: new ( error. as_str ( ) )
101- . block ( Block :: default ( ) . borders ( Borders :: ALL ) . title ( "Error" ) )
102- . style ( Style :: default ( ) . fg ( Color :: Red ) )
103- . wrap ( Wrap { trim : true } ) ;
104- f. render_widget ( error_widget, area) ;
105- return ;
101+ if !app. elicitation_input_mode {
102+ let error_widget = Paragraph :: new ( error. as_str ( ) )
103+ . block ( Block :: default ( ) . borders ( Borders :: ALL ) . title ( "Error" ) )
104+ . style ( Style :: default ( ) . fg ( Color :: Red ) )
105+ . wrap ( Wrap { trim : true } ) ;
106+ f. render_widget ( error_widget, area) ;
107+ return ;
108+ }
106109 }
107110
108111 match app. current_tab {
@@ -627,6 +630,16 @@ fn render_tool_input_form(f: &mut Frame, app: &App) {
627630 ) ) ) ;
628631 }
629632
633+ if let Some ( opts) = & field. enum_values {
634+ if !opts. is_empty ( ) {
635+ let hint = format ! ( " Allowed: {}" , opts. join( ", " ) ) ;
636+ lines. push ( Line :: from ( Span :: styled (
637+ hint,
638+ Style :: default ( ) . fg ( Color :: DarkGray ) ,
639+ ) ) ) ;
640+ }
641+ }
642+
630643 let value_style = if is_current {
631644 Style :: default ( )
632645 . fg ( Color :: Green )
@@ -798,9 +811,17 @@ fn render_elicitation_form(f: &mut Frame, app: &App) {
798811 . map ( |p| p. message . lines ( ) . count ( ) )
799812 . unwrap_or ( 0 )
800813 . max ( 1 ) ;
814+ let error_lines = app
815+ . error_message
816+ . as_ref ( )
817+ . map ( |e| e. lines ( ) . count ( ) )
818+ . unwrap_or ( 0 ) ;
801819 let popup_width = area. width . saturating_sub ( 10 ) . min ( 80 ) ;
802- let popup_height = ( message_lines as u16 + ( app. input_fields . len ( ) as u16 * 3 ) + 8 )
803- . min ( area. height . saturating_sub ( 4 ) ) ;
820+ let popup_height = ( message_lines as u16
821+ + ( error_lines as u16 ) . saturating_add ( 2 )
822+ + ( app. input_fields . len ( ) as u16 * 3 )
823+ + 8 )
824+ . min ( area. height . saturating_sub ( 4 ) ) ;
804825
805826 let popup_area = Rect {
806827 x : ( area. width . saturating_sub ( popup_width) ) / 2 ,
@@ -827,6 +848,20 @@ fn render_elicitation_form(f: &mut Frame, app: &App) {
827848
828849 let mut lines = Vec :: new ( ) ;
829850
851+ if let Some ( error) = & app. error_message {
852+ lines. push ( Line :: from ( Span :: styled (
853+ "Error:" ,
854+ Style :: default ( ) . fg ( Color :: Red ) . add_modifier ( Modifier :: BOLD ) ,
855+ ) ) ) ;
856+ for line in error. lines ( ) {
857+ lines. push ( Line :: from ( Span :: styled (
858+ line,
859+ Style :: default ( ) . fg ( Color :: Red ) ,
860+ ) ) ) ;
861+ }
862+ lines. push ( Line :: from ( "" ) ) ;
863+ }
864+
830865 if let Some ( pending) = & app. pending_elicitation {
831866 lines. push ( Line :: from ( Span :: styled (
832867 & pending. message ,
@@ -878,6 +913,16 @@ fn render_elicitation_form(f: &mut Frame, app: &App) {
878913 ) ) ) ;
879914 }
880915
916+ if let Some ( opts) = & field. enum_values {
917+ if !opts. is_empty ( ) {
918+ let hint = format ! ( " Allowed: {}" , opts. join( ", " ) ) ;
919+ lines. push ( Line :: from ( Span :: styled (
920+ hint,
921+ Style :: default ( ) . fg ( Color :: DarkGray ) ,
922+ ) ) ) ;
923+ }
924+ }
925+
881926 let value_style = if is_current {
882927 Style :: default ( )
883928 . fg ( Color :: Green )
0 commit comments