@@ -152,6 +152,8 @@ def run(self, args):
152152 "output" : self .settings ["highlight" ],
153153 "strip_nl" : False ,
154154 }
155+ style = self .settings .get ("style" , "plain" )
156+ is_plain = style in ("plain" , "none" )
155157
156158 for field in ("highlight" , "style" ):
157159 if field in self .settings :
@@ -161,17 +163,28 @@ def run(self, args):
161163 if is_pyasm :
162164 lineno = first
163165 opts ["strip_nl" ] = True
166+ opts ["style" ] = "plain"
164167
165168 # FIXME add approximate
166- line , pyasm_line_index = pyficache .get_pyasm_line (filename , lineno , is_source_line = True , opts = opts )
169+ line , pyasm_line_index = pyficache .get_pyasm_line (
170+ filename , lineno , is_source_line = True , opts = opts
171+ )
167172 proc .list_lineno = lineno
168173 if line is None :
169174 self .errmsg (f"cannot find assembly for line number { lineno } " )
170175 return
171176 while lineno <= last :
177+ if not is_plain :
178+ line = pyficache .highlight_string (
179+ line , lexer = pyficache .pyasm_lexer , style = style
180+ )
181+ if line .endswith ("\n " ):
182+ line = line [:- 1 ]
172183 self .msg (line )
173184 pyasm_line_index += 1
174- line , pyasm_line_index = pyficache .get_pyasm_line (filename , pyasm_line_index , is_source_line = False , opts = opts )
185+ line , pyasm_line_index = pyficache .get_pyasm_line (
186+ filename , pyasm_line_index , is_source_line = False , opts = opts
187+ )
175188 if line is None :
176189 break
177190 else :
@@ -246,7 +259,7 @@ def doit(cmd, args):
246259 # doit(lcmd, ['list', "python3-trepan/test/example/00_chained-compare-cpython-314.pyasm:3"])
247260
248261 # Note: osp is defined above
249- doit (lcmd , [' list' , "osp:1" ])
262+ doit (lcmd , [" list" , "osp:1" ])
250263 # print('--' * 10)
251264
252265 print ("--" * 10 )
0 commit comments