<commit_before>class Anchors(object):
    def __init__(self, area):
        area.add_mode('ANCHORS')
        self.area  = area
        area.install(('NORMAL', '<Alt-b>', lambda event: area.chmode('ANCHORS')),
                     ('ANCHORS', '<Key>', self.drop_anchor))

    def drop_anchor(self, event):
        try:
            name = '(ANCHORS-%s)' % event.keysym
            pos0 = self.area.index(name)
        except Exception:
            self.area.mark_set(name, 'insert')
        else:
            if not self.area.compare(pos0, '==', 'insert'):
                self.area.mark_set('insert', name)
            else:
                self.area.mark_unset(name)
        self.area.chmode('NORMAL')

install = Anchors
<commit_msg>Improving anchors code.<commit_after>class Anchors(object):
    def __init__(self, area):
        area.add_mode('ANCHORS')
        self.area  = area
        area.install(('NORMAL', '<Alt-b>', lambda event: area.chmode('ANCHORS')),
                     ('ANCHORS', '<Key>', self.drop_anchor))

    def drop_anchor(self, event):
        try:
            name = '(ANCHORS-%s)' % event.keysym
            pos0 = self.area.index(name)
        except Exception:
            self.area.mark_set(name, 'insert')
        else:
            if self.area.compare(pos0, '==', 'insert'):
                self.area.mark_unset(name)
            else:
                self.area.seecur(name)

        self.area.chmode('NORMAL')

install = Anchors


{'fraction_non_alphanumeric': 0.14774281805745554, 'fraction_numerical': 0.0027359781121751026, 'mean_word_length': 1.9377510040160641, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '482981', 'n_tokens_mistral': 465, 'n_tokens_neox': 460, 'n_words': 82}