Beispiel #1
0
    def testToOneWordLineWithLeadingWhitespace(self):
        set_text(self.view, '::\n bar')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_word_start(self.view, r.b, internal=True)
        self.assertEqual(pt, 2)
Beispiel #2
0
    def testMove2ToLineWithLeadingWhiteSpaceFromWordStart(self):
        set_text(self.view, '(foo)\n\nbar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 7)
Beispiel #3
0
    def testMove2ToEol(self):
        set_text(self.view, 'foo bar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 7)
Beispiel #4
0
    def testToWhitespaceLine(self):
        set_text(self.view, '\n  ')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b, internal=True)
        self.assertEqual(pt, 0)
Beispiel #5
0
    def testMove10(self):
        set_text(self.view, ''.join(('(foo) bar\n',) * 5))
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b, count=9)
        self.assertEqual(pt, 46)
Beispiel #6
0
    def testToEmptyLine(self):
        set_text(self.view, ':\n\n\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 2)
Beispiel #7
0
    def testToEof(self):
        set_text(self.view, '::')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 2)
Beispiel #8
0
    def testMove1ToWhitespaceLine(self):
        set_text(self.view, '\n  \n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, count=1, internal=True)
        self.assertEqual(pt, 1)
Beispiel #9
0
    def testMove2ToOneWordLine(self):
        set_text(self.view, '\nfoo\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 5)
Beispiel #10
0
    def testMove10(self):
        set_text(self.view, ''.join(('foo bar\n', ) * 5))
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, count=9)
        self.assertEqual(pt, 36)
Beispiel #11
0
    def testMove2ToLineWithLeadingWhiteSpace(self):
        set_text(self.view, '\n bar')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, count=2, internal=True)
        self.assertEqual(pt, 6)
Beispiel #12
0
    def testMove2(self):
        set_text(self.view, 'foo bar fizz\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, count=2)
        self.assertEqual(pt, 8)
Beispiel #13
0
    def testMove1(self):
        set_text(self.view, 'foo bar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b)
        self.assertEqual(pt, 4)
Beispiel #14
0
    def testToWhitespaceLine(self):
        set_text(self.view, '\n  ')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_word_start(self.view, r.b, internal=True)
        self.assertEqual(pt, 3)
Beispiel #15
0
    def testMove2ToOneWordLineFromWordStart(self):
        set_text(self.view, 'foo\nbar\nccc\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 8)
Beispiel #16
0
    def testMove3AndSwallowLastNewlineChar(self):
        set_text(self.view, '\nfoo\n bar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=3)
        self.assertEqual(pt, 10)
Beispiel #17
0
    def testMove1ToEol(self):
        set_text(self.view, 'x\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=1)
        self.assertEqual(pt, 1)
Beispiel #18
0
    def testToOneWordLineWithLeadingWhitespace(self):
        set_text(self.view, '   \n foo\nbar')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 4)
Beispiel #19
0
    def testToEofWithNewline(self):
        set_text(self.view, '\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 1)
Beispiel #20
0
    def testMove2ToLineWithLeadingWhiteSpaceFromWordStart(self):
        set_text(self.view, 'foo\n\nbar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 5)
Beispiel #21
0
    def testToOneCharWord(self):
        set_text(self.view, '::a bar\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 4)
Beispiel #22
0
    def testMove2ToOneWordLineFromWord(self):
        set_text(self.view, 'foo\nbar\nccc\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 7)
Beispiel #23
0
    def testMove1(self):
        set_text(self.view, '(foo) bar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b)
        self.assertEqual(pt, 6)
Beispiel #24
0
    def testMove2ToWhitespacelineFollowedByLeadingWhitespaceFromWord(self):
        set_text(self.view, 'foo\n  \n ccc\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 11)
Beispiel #25
0
    def testMove1ToWhitespaceLine(self):
        set_text(self.view, '\n  \n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b, count=1, internal=True)
        self.assertEqual(pt, 1)
Beispiel #26
0
    def testMove2ToEol(self):
        set_text(self.view, 'foo bar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 7)
Beispiel #27
0
    def testMove2ToWhitespaceline(self):
        set_text(self.view, '(foo)\n  \nccc\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 12)
Beispiel #28
0
    def testToOneCharLine(self):
        set_text(self.view, '  \na\n\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 3)
Beispiel #29
0
    def testToPunctuationStart(self):
        set_text(self.view, '(foo) (bar)\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 6)
Beispiel #30
0
 def testCanRetrieveMarkInTheCurrentBufferAsTuple2(self):
     set_text(TestsState.view, '\n'.join(('foo bar ' * 30, ) * 50))
     TestsState.view.sel().clear()
     TestsState.view.sel().add(sublime.Region(25, 25))
     self.marks.add('a', TestsState.view)
     self.assertEqual(self.marks.get_as_encoded_address('a'),
                      sublime.Region(25, 25))
Beispiel #31
0
    def testMove2ToEmptyLineFromWord(self):
        set_text(self.view, 'foo\n\nbar\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 4)
Beispiel #32
0
    def testReturnsFullWord_CountOne(self):
        set_text(self.view, 'foo bar baz\n')
        r = self.R(5, 5)
        add_sel(self.view, r)

        reg = a_word(self.view, r.b)
        self.assertEqual('bar ', self.view.substr(reg))
Beispiel #33
0
    def testToOneCharWord(self):
        set_text(self.view, '  a foo bar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 2)
Beispiel #34
0
    def testReturnsWordAndAllPrecedingWhiteSpace_CountOne(self):
        set_text(self.view, '(foo   bar) baz\n')
        r = self.R(8, 8)
        add_sel(self.view, r)

        reg = a_word(self.view, r.b)
        self.assertEqual('   bar', self.view.substr(reg))
Beispiel #35
0
    def testToWordStart(self):
        set_text(self.view, ':foo\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 5)
    def testMovesCaretToEol(self):
        set_text(self.view, 'abc')
        add_sel(self.view, self.R((0, 0), (0, 2)))

        self.view.run_command('_vi_big_a', {'mode': modes.VISUAL, 'count': 1})

        self.assertEqual(self.R(2, 2), first_sel(self.view))
Beispiel #37
0
    def testToOneWordLineWithLeadingWhitespace(self):
        set_text(self.view, ':\n bar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 2)
Beispiel #38
0
    def testToEof(self):
        set_text(self.view, '(foo)')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 5)
Beispiel #39
0
    def testToOneCharLine(self):
        set_text(self.view, '\na\n\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 1)
Beispiel #40
0
    def testToOneWordLineWithLeadingWhitespace(self):
        set_text(self.view, '(foo)\n bar\nbaz')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 6)
Beispiel #41
0
    def testToOneWordLine(self):
        set_text(self.view, '::\nbar\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 3)
Beispiel #42
0
    def testToOneCharLine(self):
        set_text(self.view, '(foo)\na\n\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 6)
Beispiel #43
0
    def testToOneCharLineWithLeadingWhitespace(self):
        set_text(self.view, '::\n a\n\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 3)
Beispiel #44
0
    def testToOneWordLine(self):
        set_text(self.view, ':\nbar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 2)
Beispiel #45
0
    def testToOneWordLineWithLeadingWhitespace(self):
        set_text(self.view, '\n bar')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b, internal=True)
        self.assertEqual(pt, 0)
Beispiel #46
0
    def testToOneCharWord(self):
        set_text(self.view, ':a bar\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 3)
Beispiel #47
0
    def testMove2(self):
        set_text(self.view, '(foo) bar fizz\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b, count=2)
        self.assertEqual(pt, 10)
Beispiel #48
0
    def testToOneCharLineWithLeadingWhitespace(self):
        set_text(self.view, ':\n a\n\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 2)
Beispiel #49
0
    def testMove2ToLineWithLeadingWhiteSpace(self):
        set_text(self.view, '\n (bar)')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b, count=2, internal=True)
        self.assertEqual(pt, 6)
Beispiel #50
0
    def testToWordStart(self):
        set_text(self.view, '\nfoo\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 1)
Beispiel #51
0
    def testMove3AndSwallowLastNewlineChar(self):
        set_text(self.view, '\nfoo\n (bar)\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b, internal=True, count=3)
        self.assertEqual(pt, 12)
Beispiel #52
0
    def testToPunctuationStart(self):
        set_text(self.view, '\n (foo)\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 1)
Beispiel #53
0
    def testMove2ToOneWordLineFromWord(self):
        set_text(self.view, '(foo)\nbar\nccc\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 9)
Beispiel #54
0
    def testToWhitespaceLine(self):
        set_text(self.view, '\n  \n\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 1)
Beispiel #55
0
    def testMove2ToWhitespacelineFollowedByLeadingWhitespaceFromWordStart(self):
        set_text(self.view, '(foo)\n  \n ccc\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = big_word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 14)
Beispiel #56
0
    def testToEofWithNewline(self):
        set_text(self.view, '\n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 1)
Beispiel #57
0
    def testToWordStart(self):
        set_text(self.view, '(foo) bar\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 6)
Beispiel #58
0
    def testMove2ToLineWithLeadingWhiteSpace(self):
        set_text(self.view, '\nfoo\n  \n')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 5)
Beispiel #59
0
    def testToWhitespaceLine(self):
        set_text(self.view, '(foo)\n  \n\n')
        r = self.R((0, 1), (0, 1))
        add_sel(self.view, r)

        pt = next_big_word_start(self.view, r.b)
        self.assertEqual(pt, 6)
Beispiel #60
0
    def testToEof(self):
        set_text(self.view, '   ')
        r = self.R((0, 0), (0, 0))
        add_sel(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 3)