@@ -42,7 +42,7 @@ def make_toolbar_content(
4242 current_field : str ,
4343 current_text : str ,
4444 * ,
45- max_length : int | None ,
45+ max_length : int ,
4646) -> str :
4747 """Build bottom toolbar content with live preview and length counter.
4848
@@ -53,10 +53,11 @@ def make_toolbar_content(
5353 preview = subject_builder (current_field , current_text )
5454 current_length = len (preview )
5555
56- if max_length is not None and max_length > 0 :
57- counter = f"{ current_length } /{ max_length } chars"
58- else :
59- counter = f"{ current_length } chars"
56+ counter = (
57+ f"{ current_length } /{ max_length } chars"
58+ if max_length > 0
59+ else f"{ current_length } chars"
60+ )
6061
6162 try :
6263 width = get_terminal_size ().columns
@@ -76,19 +77,19 @@ def make_length_validator(
7677 subject_builder : SubjectBuilder ,
7778 field : str ,
7879 * ,
79- max_length : int | None ,
80+ max_length : int ,
8081) -> Callable [[str ], bool | str ]:
8182 """Create a questionary-style validator for subject length.
8283
8384 The validator:
8485 - Uses the subject_builder to get the full preview string for the current
8586 answers_state and field value.
86- - Applies max_length on the character count (len). A value of 0 or None
87- disables the limit.
87+ - Applies max_length on the character count (len). A value of 0 disables
88+ the limit.
8889 """
8990
9091 def _validate (text : str ) -> bool | str :
91- if not max_length or max_length <= 0 :
92+ if max_length <= 0 :
9293 return True
9394
9495 preview = subject_builder (field , text )
0 commit comments