equal
deleted
inserted
replaced
137 In most cases, you should use ui.copy() to create a copy of an existing |
137 In most cases, you should use ui.copy() to create a copy of an existing |
138 ui object. |
138 ui object. |
139 """ |
139 """ |
140 # _buffers: used for temporary capture of output |
140 # _buffers: used for temporary capture of output |
141 self._buffers = [] |
141 self._buffers = [] |
|
142 # _exithandlers: callbacks run at the end of a request |
|
143 self._exithandlers = [] |
142 # 3-tuple describing how each buffer in the stack behaves. |
144 # 3-tuple describing how each buffer in the stack behaves. |
143 # Values are (capture stderr, capture subprocesses, apply labels). |
145 # Values are (capture stderr, capture subprocesses, apply labels). |
144 self._bufferstates = [] |
146 self._bufferstates = [] |
145 # When a buffer is active, defines whether we are expanding labels. |
147 # When a buffer is active, defines whether we are expanding labels. |
146 # This exists to prevent an extra list lookup. |
148 # This exists to prevent an extra list lookup. |
161 self._colormode = None |
163 self._colormode = None |
162 self._terminfoparams = {} |
164 self._terminfoparams = {} |
163 self._styles = {} |
165 self._styles = {} |
164 |
166 |
165 if src: |
167 if src: |
|
168 self._exithandlers = src._exithandlers |
166 self.fout = src.fout |
169 self.fout = src.fout |
167 self.ferr = src.ferr |
170 self.ferr = src.ferr |
168 self.fin = src.fin |
171 self.fin = src.fin |
169 self.pageractive = src.pageractive |
172 self.pageractive = src.pageractive |
170 self._disablepager = src._disablepager |
173 self._disablepager = src._disablepager |
944 pager.stdin.close() |
947 pager.stdin.close() |
945 pager.wait() |
948 pager.wait() |
946 |
949 |
947 return True |
950 return True |
948 |
951 |
|
952 def atexit(self, func, *args, **kwargs): |
|
953 '''register a function to run after dispatching a request |
|
954 |
|
955 Handlers do not stay registered across request boundaries.''' |
|
956 self._exithandlers.append((func, args, kwargs)) |
|
957 return func |
|
958 |
949 def interface(self, feature): |
959 def interface(self, feature): |
950 """what interface to use for interactive console features? |
960 """what interface to use for interactive console features? |
951 |
961 |
952 The interface is controlled by the value of `ui.interface` but also by |
962 The interface is controlled by the value of `ui.interface` but also by |
953 the value of feature-specific configuration. For example: |
963 the value of feature-specific configuration. For example: |