How to use the hist.History function in hist

To help you get started, we’ve selected a few hist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github randy3k / AlignTab / hist.py View on Github external
self.index = -1 if backwards else 0

    def last(self):
        return self.hist[-1] if self.hist else None

    def get(self, index=None):
        if not index:
            index = self.index
        return self.hist[index] if self.hist else None

    def reset_index(self):
        self.index = None


if 'history' not in globals():
    history = History()


class AlignTabHistory(sublime_plugin.TextCommand):
    def run(self, edit, backwards=False):
        history.roll(backwards)
        self.view.erase(edit, sublime.Region(0, self.view.size()))
        self.view.insert(edit, 0, history.get())


class AlignTabHistoryListener(sublime_plugin.EventListener):
    # restore History index
    def on_deactivated(self, view):
        if view.settings().get("AlignTabInputPanel"):
            history.reset_index()

hist

Hist classes and utilities

BSD-3-Clause
Latest version published 3 months ago

Package Health Score

81 / 100
Full package analysis

Similar packages