Skip to content

Commit

Permalink
wxGUI: Show line numbers in the Python editor (pyedit and gmodeler) (#…
Browse files Browse the repository at this point in the history
…284)

Line numbers are important for error messages/tracebacks and teaching.
Margin size scales with the font size, but only 2 or 3 digit numbers
are supported (users are not expected to write really long files).
  • Loading branch information
wenzeslaus authored and neteler committed Jan 28, 2020
1 parent 8299d38 commit b407ca8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gui/wxpython/gui_core/pystc.py
Expand Up @@ -70,6 +70,11 @@ def __init__(self, parent, id=wx.ID_ANY, statusbar=None):
self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
self.SetEdgeColumn(78)

# show line numbers
self.SetMarginType(1, wx.stc.STC_MARGIN_NUMBER)
# supporting only 2 or 3 digit line numbers
self.SetMarginWidth(1, 3 * self.faces["size2"])

# setup a margin to hold fold markers
self.SetMarginType(2, stc.STC_MARGIN_SYMBOL)
self.SetMarginMask(2, stc.STC_MASK_FOLDERS)
Expand Down

0 comments on commit b407ca8

Please sign in to comment.