move grammarName out of loops
@@ -1413,13 +1413,13 @@ class TextBuffer(BackingTextBuffer):
window.addStr(i, col, line, color)
if node.grammar.get('spelling', True):
# Highlight spelling errors
+ grammarName = node.grammar.get('name', 'unknown')
colors = [131, 231]
color = 0
for found in re.finditer(app.selectable.kReSubwords, line):
for reg in found.regs:
word = line[reg[0]:reg[1]]
- if not app.spelling.isCorrect(word, node.grammar.get(
- 'name', 'unknown')):
+ if not app.spelling.isCorrect(word, grammarName):
window.addStr(i, col+reg[0], word,
curses.color_pair(colors[color%2]))
color += 1
