Skip to content

Commit

Permalink
skip line breaks (i.e. jump to the next real glyph)
Browse files Browse the repository at this point in the history
  • Loading branch information
justanotherfoundry committed Jun 5, 2018
1 parent 386fd6b commit fd5077e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion Edit Next Glyph.py
Expand Up @@ -9,4 +9,15 @@
Activates the next glyph in the tab for editing. You can give it a keyboard shortcut in the macOS system preferences.
"""

Font.currentTab.textCursor = (Font.currentTab.textCursor + 1) % len(Font.currentTab.layers)
initialCursor = Font.currentTab.textCursor
while 1:
Font.currentTab.textCursor = (Font.currentTab.textCursor + 1) % len(Font.currentTab.layers)
# in case there are no real glyphs in the tab, we need to prevent an infinite loop
if Font.currentTab.textCursor == initialCursor:
break
try:
if Glyphs.font.selectedLayers[0].parent.name:
break
except:
# this happens when the cursor reaches a line break
pass
13 changes: 12 additions & 1 deletion Edit Previous Glyph.py
Expand Up @@ -9,4 +9,15 @@
Activates the previous glyph in the tab for editing. You can give it a keyboard shortcut in the macOS system preferences.
"""

Font.currentTab.textCursor = (Font.currentTab.textCursor - 1) % len(Font.currentTab.layers)
initialCursor = Font.currentTab.textCursor
while 1:
Font.currentTab.textCursor = (Font.currentTab.textCursor - 1) % len(Font.currentTab.layers)
# in case there are no real glyphs in the tab, we need to prevent an infinite loop
if Font.currentTab.textCursor == initialCursor:
break
try:
if Glyphs.font.selectedLayers[0].parent.name:
break
except:
# this happens when the cursor reaches a line break
pass

0 comments on commit fd5077e

Please sign in to comment.