@@ -791,7 +791,12 @@ def ask_for_word_fix(
791791 misspelling : Misspelling ,
792792 interactivity : int ,
793793 colors : TermColors ,
794+ filename : str ,
795+ lineno : int ,
794796) -> tuple [bool , str ]:
797+ cfilename = f"{ colors .FILE } { filename } { colors .DISABLE } "
798+ cline = f"{ colors .FILE } { lineno } { colors .DISABLE } "
799+
795800 wrongword = match .group ()
796801 if interactivity <= 0 :
797802 return misspelling .fix , fix_case (wrongword , misspelling .data )
@@ -806,7 +811,11 @@ def ask_for_word_fix(
806811 r = ""
807812 fixword = fix_case (wrongword , misspelling .data )
808813 while not r :
809- print (f"{ line_ui } \t { wrongword } ==> { fixword } (Y/n) " , end = "" , flush = True )
814+ print (
815+ f"{ cfilename } :{ cline } : { line_ui } \t { wrongword } ==> { fixword } (Y/n) " ,
816+ end = "" ,
817+ flush = True ,
818+ )
810819 r = sys .stdin .readline ().strip ().upper ()
811820 if not r :
812821 r = "Y"
@@ -824,7 +833,10 @@ def ask_for_word_fix(
824833 r = ""
825834 opt = [w .strip () for w in misspelling .data .split ("," )]
826835 while not r :
827- print (f"{ line_ui } Choose an option (blank for none): " , end = "" )
836+ print (
837+ f"{ cfilename } :{ cline } : { line_ui } Choose an option (blank for none): " ,
838+ end = "" ,
839+ )
828840 for i , o in enumerate (opt ):
829841 fixword = fix_case (wrongword , o )
830842 print (f" { i } ) { fixword } " , end = "" )
@@ -1020,6 +1032,8 @@ def parse_lines(
10201032 misspellings [lword ],
10211033 options .interactive ,
10221034 colors = colors ,
1035+ filename = filename ,
1036+ lineno = i + 1 ,
10231037 )
10241038 asked_for .add (lword )
10251039
@@ -1192,7 +1206,8 @@ def parse_file(
11921206 else :
11931207 if not options .quiet_level & QuietLevels .FIXES :
11941208 print (
1195- f"{ colors .FWORD } FIXED:{ colors .DISABLE } { filename } " ,
1209+ f"{ colors .FWORD } FIXED:{ colors .DISABLE } "
1210+ f"{ colors .FILE } { filename } { colors .DISABLE } " ,
11961211 file = sys .stderr ,
11971212 )
11981213 for line_num , wrong , right in changes_made :
0 commit comments