MCPcopy Create free account
hub / github.com/mhammond/pywin32 / AppendToPrompt

Method AppendToPrompt

Pythonwin/pywin/framework/interact.py:328–347  ·  view source on GitHub ↗

Take a command and stick it at the end of the buffer (with python prompts inserted if required).

(self,bufLines, oldPrompt = None)

Source from the content-addressed store, hash-verified

326 line = line[:-1]
327 return line
328 def AppendToPrompt(self,bufLines, oldPrompt = None):
329 " Take a command and stick it at the end of the buffer (with python prompts inserted if required)."
330 self.flush()
331 lastLineNo = self.GetLineCount()-1
332 line = self.DoGetLine(lastLineNo)
333 if oldPrompt and line==oldPrompt:
334 self.SetSel(self.GetTextLength()-len(oldPrompt), self.GetTextLength())
335 self.ReplaceSel(sys.ps1)
336 elif (line!=str(sys.ps1)):
337 if len(line)!=0: self.write('\n')
338 self.write(sys.ps1)
339 self.flush()
340 self.idle.text.mark_set("iomark", "end-1c")
341 if not bufLines:
342 return
343 terms = (["\n" + sys.ps2] * (len(bufLines)-1)) + ['']
344 for bufLine, term in zip(bufLines, terms):
345 if bufLine.strip():
346 self.write( bufLine + term )
347 self.flush()
348
349 def EnsureNoPrompt(self):
350 # Get ready to write some text NOT at a Python prompt.

Callers 5

InitMethod · 0.95
SetContextMethod · 0.95
ProcessEnterEventMethod · 0.95
ProcessEscEventMethod · 0.95
RunScriptFunction · 0.80

Calls 8

DoGetLineMethod · 0.95
GetLineCountMethod · 0.80
SetSelMethod · 0.80
GetTextLengthMethod · 0.80
ReplaceSelMethod · 0.80
mark_setMethod · 0.80
flushMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected