本文整理汇总了Python中pyqode.core.api.utils.TextHelper.line_count方法的典型用法代码示例。如果您正苦于以下问题:Python TextHelper.line_count方法的具体用法?Python TextHelper.line_count怎么用?Python TextHelper.line_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqode.core.api.utils.TextHelper
的用法示例。
在下文中一共展示了TextHelper.line_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cut_no_selection
# 需要导入模块: from pyqode.core.api.utils import TextHelper [as 别名]
# 或者: from pyqode.core.api.utils.TextHelper import line_count [as 别名]
def test_cut_no_selection(editor):
assert isinstance(editor, CodeEdit)
editor.setPlainText('''Line 1
Line 2
Line 3''', '', '')
helper = TextHelper(editor)
# eat empty line
helper.goto_line(0)
assert helper.line_count() == 3
editor.cut()
assert helper.line_count() == 2
示例2: __swapLine
# 需要导入模块: from pyqode.core.api.utils import TextHelper [as 别名]
# 或者: from pyqode.core.api.utils.TextHelper import line_count [as 别名]
def __swapLine(self, up: bool):
helper = TextHelper(self)
text = helper.current_line_text()
line_nbr = helper.current_line_nbr()
if up:
swap_line_nbr = line_nbr - 1
else:
swap_line_nbr = line_nbr + 1
swap_text = helper.line_text(swap_line_nbr)
if (swap_line_nbr < helper.line_count()
and line_nbr < helper.line_count()):
helper.set_line_text(line_nbr, swap_text)
helper.set_line_text(swap_line_nbr, text)
示例3: goto_line
# 需要导入模块: from pyqode.core.api.utils import TextHelper [as 别名]
# 或者: from pyqode.core.api.utils.TextHelper import line_count [as 别名]
def goto_line(self):
"""
Shows the *go to line dialog* and go to the selected line.
"""
helper = TextHelper(self)
line, result = DlgGotoLine.get_line(self, helper.current_line_nbr(), helper.line_count())
if not result:
return
return helper.goto_line(line, move=True)