equal
deleted
inserted
replaced
471 |
471 |
472 This function refers to input only; for output, see `ui.formatted()'. |
472 This function refers to input only; for output, see `ui.formatted()'. |
473 ''' |
473 ''' |
474 i = self.configbool("ui", "interactive", None) |
474 i = self.configbool("ui", "interactive", None) |
475 if i is None: |
475 if i is None: |
476 try: |
476 # some environments replace stdin without implementing isatty |
477 return sys.stdin.isatty() |
477 # usually those are non-interactive |
478 except AttributeError: |
478 return util.isatty(sys.stdin) |
479 # some environments replace stdin without implementing isatty |
|
480 # usually those are non-interactive |
|
481 return False |
|
482 |
479 |
483 return i |
480 return i |
484 |
481 |
485 def termwidth(self): |
482 def termwidth(self): |
486 '''how wide is the terminal in columns? |
483 '''how wide is the terminal in columns? |
512 if self.plain(): |
509 if self.plain(): |
513 return False |
510 return False |
514 |
511 |
515 i = self.configbool("ui", "formatted", None) |
512 i = self.configbool("ui", "formatted", None) |
516 if i is None: |
513 if i is None: |
517 try: |
514 # some environments replace stdout without implementing isatty |
518 return sys.stdout.isatty() |
515 # usually those are non-interactive |
519 except AttributeError: |
516 return util.isatty(sys.stdout) |
520 # some environments replace stdout without implementing isatty |
|
521 # usually those are non-interactive |
|
522 return False |
|
523 |
517 |
524 return i |
518 return i |
525 |
519 |
526 def _readline(self, prompt=''): |
520 def _readline(self, prompt=''): |
527 if sys.stdin.isatty(): |
521 if util.isatty(sys.stdin): |
528 try: |
522 try: |
529 # magically add command line editing support, where |
523 # magically add command line editing support, where |
530 # available |
524 # available |
531 import readline |
525 import readline |
532 # force demandimport to really load the module |
526 # force demandimport to really load the module |