Skip to content

Can't type the closing paren when paren's color is set to default. #873

Closed
@mrillusi0n

Description

@mrillusi0n

I get the following error when trying to pair an opened paren.

>>> print(
Traceback (most recent call last):
  File "/usr/local/bin/bpython", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsies.py", line 191, in main
    exit_value = repl.mainloop(True, paste)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsies.py", line 123, in mainloop
    self.process_event_and_paint(e)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsies.py", line 100, in process_event_and_paint
    array, cursor_pos = self.paint()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsiesfrontend/repl.py", line 1316, in paint
    self.current_cursor_line)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsiesfrontend/repl.py", line 1246, in current_cursor_line
    return (self.current_cursor_line_without_suggestion +
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsiesfrontend/repl.py", line 1237, in current_cursor_line_without_suggestion
    self.display_line_with_prompt))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsiesfrontend/repl.py", line 1230, in display_line_with_prompt
    self.current_line_formatted)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsiesfrontend/repl.py", line 1180, in current_line_formatted
    fs = bpythonparse(format(self.tokenize(self.current_line),
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsiesfrontend/parse.py", line 40, in parse
    return (sum((fs_from_match(d) for d in stuff[1:]), fs_from_match(stuff[0]))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsiesfrontend/parse.py", line 40, in <genexpr>
    return (sum((fs_from_match(d) for d in stuff[1:]), fs_from_match(stuff[0]))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bpython/curtsiesfrontend/parse.py", line 60, in fs_from_match
    color = colors[(colors.index(color) + (len(colors) // 2)) %
ValueError: tuple.index(x): x not in tuple
gruv.theme
# Each letter represents a colour marker:
#   k, r, g, y, b, m, c, w, d
# which stands for:
#   blacK, Red, Green, Yellow, Blue, Magenta, Cyan, White, Default
# Capital letters represent bold
# Copy to $XDG_CONFIG_HOME/bpython/foo.theme and set "color_scheme = foo" in
# $XDG_CONFIG_HOME/bpython/config ($XDG_CONFIG_HOME defaults to ~/.config)

[syntax]
keyword = r
name = g
comment = b
string = m
error = r
number = g
operator = Y
punctuation = y
token = c
paren = d # cause of error as observed 

[interface]
# XXX: gnome-terminal appears to be braindead. The cursor will disappear unless
# you set the background colour to "d".
background = d
output = w
main = c
prompt = c
prompt_more = g
right_arrow_suggestion = k

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions