Skip to content

Commit dc866b7

Browse files
committed
Implement line length checking feature
1 parent cc9c4af commit dc866b7

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

addon/globalPlugins/devBox/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import scriptHandler
1010
import speech
1111
import textInfos
12+
import ui
1213

1314
from . import interface
1415
from .features.diff_sounds import DiffSoundsFeature
@@ -113,3 +114,11 @@ def report_diff_line_status(self):
113114
if not text or text[0] not in DIFF_SOUNDS:
114115
return
115116
nvwave.playWaveFile(DIFF_SOUNDS[text[0]])
117+
118+
@scriptHandler.script(description=_("Report current line length"))
119+
def script_report_current_line_length(self, gesture):
120+
obj = api.getCaretObject()
121+
text_info = obj.makeTextInfo(textInfos.POSITION_CARET)
122+
text_info.expand(textInfos.UNIT_LINE)
123+
line = text_info.text.rstrip("\r\n")
124+
ui.message(str(len(line)))

0 commit comments

Comments
 (0)