Пример #1
0
    def testToOneCharLine(self):
        set_text(self.view, '  \na\n\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_end(self.view, r.b)
        self.assertEqual(pt, 4)
Пример #2
0
    def testMove2ToWhitespacelineFollowedByLeadingWhitespaceFromWordStart(self):
        set_text(self.view, 'foo\n  \n ccc\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 12)
Пример #3
0
    def testMove2ToEol(self):
        set_text(self.view, 'foo bar\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 7)
Пример #4
0
    def testMove3AndSwallowLastNewlineChar(self):
        set_text(self.view, '\nfoo\n bar\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=3)
        self.assertEqual(pt, 10)
Пример #5
0
    def testMove2ToOneWordLineFromWord(self):
        set_text(self.view, 'foo\nbar\nccc\n')
        r = self.R((0, 1), (0, 1))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 7)
Пример #6
0
    def testMove10(self):
        set_text(self.view, ''.join(('foo bar\n',) * 5))
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, count=9)
        self.assertEqual(pt, 36)
Пример #7
0
    def testMove1ToWhitespaceLine(self):
        set_text(self.view, '\n  \n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, count=1, internal=True)
        self.assertEqual(pt, 1)
Пример #8
0
    def testToWordStart(self):
        set_text(self.view, '::foo\n')
        r = self.R((0, 1), (0, 1))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 2)
Пример #9
0
    def testToPunctuationStart(self):
        set_text(self.view, ':: (foo)\n')
        r = self.R((0, 1), (0, 1))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 3)
Пример #10
0
    def testToWhitespaceLine(self):
        set_text(self.view, ':\n  \n\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 2)
Пример #11
0
    def testToEmptyLine(self):
        set_text(self.view, '\n\n\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 1)
Пример #12
0
    def testMove1FromEmptyLineToLineWithLeadingWhiteSpace(self):
        set_text(self.view, '\n bar\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = words(self.view, r.b, internal=True)
        self.assertEqual(pt, 1)
Пример #13
0
    def testToOneWordLineWithLeadingWhitespace(self):
        set_text(self.view, '\n bar')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b, classes=CLASS_VI_INTERNAL_WORD_START)
        self.assertEqual(pt, 2)
Пример #14
0
    def testToWhitespaceLine(self):
        set_text(self.view, '\n  ')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b, classes=CLASS_VI_INTERNAL_WORD_START)
        self.assertEqual(pt, 3)
Пример #15
0
    def testMove1(self):
        set_text(self.view, 'foo bar\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b)
        self.assertEqual(pt, 4)
Пример #16
0
    def testToEofWithNewline(self):
        set_text(self.view, '::\n')
        r = self.R((0, 1), (0, 1))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 3)
Пример #17
0
    def testMove2(self):
        set_text(self.view, 'foo bar fizz\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, count=2)
        self.assertEqual(pt, 8)
Пример #18
0
    def testToOneWordLineWithLeadingWhitespace(self):
        set_text(self.view, '::\n bar\n')
        r = self.R((0, 1), (0, 1))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 3)
Пример #19
0
    def testMove2ToLineWithLeadingWhiteSpace(self):
        set_text(self.view, '\n bar')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, count=2, internal=True)
        self.assertEqual(pt, 6)
Пример #20
0
    def testToOneCharLine(self):
        set_text(self.view, '::\na\n\n')
        r = self.R((0, 1), (0, 1))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 3)
Пример #21
0
    def testMove2ToOneWordLine(self):
        set_text(self.view, '\nfoo\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 5)
Пример #22
0
    def testToEof(self):
        set_text(self.view, '   ')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 3)
Пример #23
0
    def testMove2ToLineWithLeadingWhiteSpaceFromWordStart(self):
        set_text(self.view, 'foo\n\nbar\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 5)
Пример #24
0
    def testToWhitespaceLine(self):
        set_text(self.view, '\n  ')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b, internal=True)
        self.assertEqual(pt, 3)
Пример #25
0
    def testMove2ToWhitespaceline(self):
        set_text(self.view, 'foo\n  \nccc\n')
        r = self.R((0, 1), (0, 1))
        add_selection(self.view, r)

        pt = word_starts(self.view, r.b, internal=True, count=2)
        self.assertEqual(pt, 10)
Пример #26
0
    def testToOneWordLine(self):
        set_text(self.view, '   \nfoo\nbar')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 4)
Пример #27
0
    def testToOneCharWord(self):
        set_text(self.view, '  a foo bar\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 2)
Пример #28
0
    def testToOneWordLineWithLeadingWhitespace(self):
        set_text(self.view, '\n bar')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b, internal=True)
        self.assertEqual(pt, 2)
Пример #29
0
    def testToOneCharLineWithLeadingWhitespace(self):
        set_text(self.view, '  \n a\n\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = next_word_start(self.view, r.b)
        self.assertEqual(pt, 3)
Пример #30
0
    def testMove1ToEol(self):
        set_text(self.view, 'x\n')
        r = self.R((0, 0), (0, 0))
        add_selection(self.view, r)

        pt = word_ends(self.view, r.b, internal=True, count=1)
        self.assertEqual(pt, 0)