( self, force=False )
| 38 | |
| 39 | |
| 40 | def Request( self, force=False ): |
| 41 | if self._request and not self.Ready(): |
| 42 | return True |
| 43 | |
| 44 | # Check to see if the buffer ranges would actually change anything visible. |
| 45 | # This avoids a round-trip for every single line scroll event |
| 46 | if ( not force and |
| 47 | self._tick == vimsupport.GetBufferChangedTick( self._bufnr ) and |
| 48 | vimsupport.VisibleRangeOfBufferOverlaps( |
| 49 | self._bufnr, |
| 50 | self._last_requested_range ) ): |
| 51 | return False # don't poll |
| 52 | |
| 53 | # FIXME: This call is duplicated in the call to VisibleRangeOfBufferOverlaps |
| 54 | # - remove the expansion param |
| 55 | # - look up the actual visible range, then call this function |
| 56 | # - if not overlapping, do the factor expansion and request |
| 57 | self._last_requested_range = vimsupport.RangeVisibleInBuffer( self._bufnr ) |
| 58 | # If this is false, either the self._bufnr is not a valid buffer number or |
| 59 | # the buffer is not visible in any window. |
| 60 | # Since this is called asynchronously, a user may bwipeout a buffer with |
| 61 | # self._bufnr number between polls. |
| 62 | if self._last_requested_range is None: |
| 63 | return False |
| 64 | |
| 65 | self._tick = vimsupport.GetBufferChangedTick( self._bufnr ) |
| 66 | |
| 67 | # We'll never use the last response again, so clear it |
| 68 | self._latest_response = None |
| 69 | self._request = self._NewRequest( self._last_requested_range ) |
| 70 | self._request.Start() |
| 71 | return True |
| 72 | |
| 73 | |
| 74 | def Update( self ): |
no test coverage detected