MCPcopy
hub / github.com/jisaacks/GitGutter / _bind_files

Method _bind_files

modules/show_diff.py:248–273  ·  view source on GitHub ↗

Add gutter icons to each line in the view. The regions are calculated directly on the buffer string as view.lines(...) takes up to 3 times longer, what hurts especially with larger files. Arguments: event (string): The element of self.region_names to bin

(self, event)

Source from the content-addressed store, hash-verified

246 return regions
247
248 def _bind_files(self, event):
249 """Add gutter icons to each line in the view.
250
251 The regions are calculated directly on the buffer string as
252 view.lines(...) takes up to 3 times longer, what hurts especially
253 with larger files.
254
255 Arguments:
256 event (string): The element of self.region_names to bind
257 """
258 view = self.git_handler.view
259 start = 0
260 regions = []
261 protected = self._get_protected_regions()
262 for line in self.git_handler.view_cache.text.splitlines():
263 end = start + len(line)
264 if start not in protected:
265 region = sublime.Region(
266 start, min(end, start + self._minimap_size))
267 regions.append(region)
268 start = end + 1
269 self._line_height = view.line_height()
270 self._minimap_size = self.git_handler.settings.show_in_minimap
271 self._bind_regions(event, regions)
272 self._clear_regions(event)
273 self._busy = False
274
275 def _bind_regions(self, event, regions):
276 """Add gutter icons to all lines defined by their regions.

Callers 2

bind_untrackedMethod · 0.95

Calls 3

_bind_regionsMethod · 0.95
_clear_regionsMethod · 0.95

Tested by

no test coverage detected