@@ -795,7 +795,12 @@ def ask_for_word_fix(
795795 misspelling : Misspelling ,
796796 interactivity : int ,
797797 colors : TermColors ,
798+ filename : str ,
799+ lineno : int ,
798800) -> tuple [bool , str ]:
801+ cfilename = f"{ colors .FILE } { filename } { colors .DISABLE } "
802+ cline = f"{ colors .FILE } { lineno } { colors .DISABLE } "
803+
799804 wrongword = match .group ()
800805 if interactivity <= 0 :
801806 return misspelling .fix , fix_case (wrongword , misspelling .data )
@@ -810,7 +815,11 @@ def ask_for_word_fix(
810815 r = ""
811816 fixword = fix_case (wrongword , misspelling .data )
812817 while not r :
813- print (f"{ line_ui } \t { wrongword } ==> { fixword } (Y/n) " , end = "" , flush = True )
818+ print (
819+ f"{ cfilename } :{ cline } : { line_ui } \t { wrongword } ==> { fixword } (Y/n) " ,
820+ end = "" ,
821+ flush = True ,
822+ )
814823 r = sys .stdin .readline ().strip ().upper ()
815824 if not r :
816825 r = "Y"
@@ -828,7 +837,10 @@ def ask_for_word_fix(
828837 r = ""
829838 opt = [w .strip () for w in misspelling .data .split ("," )]
830839 while not r :
831- print (f"{ line_ui } Choose an option (blank for none): " , end = "" )
840+ print (
841+ f"{ cfilename } :{ cline } : { line_ui } Choose an option (blank for none): " ,
842+ end = "" ,
843+ )
832844 for i , o in enumerate (opt ):
833845 fixword = fix_case (wrongword , o )
834846 print (f" { i } ) { fixword } " , end = "" )
@@ -1024,6 +1036,8 @@ def parse_lines(
10241036 misspellings [lword ],
10251037 options .interactive ,
10261038 colors = colors ,
1039+ filename = filename ,
1040+ lineno = i + 1 ,
10271041 )
10281042 asked_for .add (lword )
10291043
@@ -1196,7 +1210,8 @@ def parse_file(
11961210 else :
11971211 if not options .quiet_level & QuietLevels .FIXES :
11981212 print (
1199- f"{ colors .FWORD } FIXED:{ colors .DISABLE } { filename } " ,
1213+ f"{ colors .FWORD } FIXED:{ colors .DISABLE } "
1214+ f"{ colors .FILE } { filename } { colors .DISABLE } " ,
12001215 file = sys .stderr ,
12011216 )
12021217 for line_num , wrong , right in changes_made :
0 commit comments