colors: safe curses.A_ITALIC
Missing on macOS?
This commit is contained in:
parent
9140cedad0
commit
3f2792d359
|
@ -16,7 +16,7 @@ from bebop.bookmarks import (
|
|||
get_bookmarks_document,
|
||||
save_bookmark,
|
||||
)
|
||||
from bebop.colors import ColorPair, init_colors
|
||||
from bebop.colors import A_ITALIC, ColorPair, init_colors
|
||||
from bebop.config import RENDER_MODES
|
||||
from bebop.command_line import CommandLine
|
||||
from bebop.external import open_external_program
|
||||
|
@ -290,7 +290,7 @@ class Browser:
|
|||
|
||||
def set_status(self, text):
|
||||
"""Set a regular message in the status bar."""
|
||||
self.status_data = text, ColorPair.NORMAL, curses.A_ITALIC
|
||||
self.status_data = text, ColorPair.NORMAL, A_ITALIC
|
||||
self.refresh_status_line()
|
||||
|
||||
def reset_status(self):
|
||||
|
|
|
@ -21,6 +21,9 @@ class ColorPair(IntEnum):
|
|||
LINK_PREVIEW = 10
|
||||
|
||||
|
||||
A_ITALIC = curses.A_ITALIC if hasattr(curses, "A_ITALIC") else curses.A_NORMAL
|
||||
|
||||
|
||||
def init_colors():
|
||||
curses.use_default_colors()
|
||||
curses.init_pair(ColorPair.NORMAL, curses.COLOR_WHITE, -1)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import curses
|
||||
|
||||
from bebop.colors import ColorPair
|
||||
from bebop.colors import A_ITALIC, ColorPair
|
||||
from bebop.metalines import LineType
|
||||
|
||||
|
||||
|
@ -48,7 +48,7 @@ def render_line(metaline, window, max_width):
|
|||
attributes = (
|
||||
curses.color_pair(ColorPair.LINK_PREVIEW)
|
||||
| curses.A_DIM
|
||||
| curses.A_ITALIC
|
||||
| A_ITALIC
|
||||
)
|
||||
window.addstr(url_text, attributes)
|
||||
|
||||
|
@ -70,6 +70,6 @@ def get_base_line_attributes(line_type) -> int:
|
|||
elif line_type == LineType.PREFORMATTED:
|
||||
return curses.color_pair(ColorPair.PREFORMATTED)
|
||||
elif line_type == LineType.BLOCKQUOTE:
|
||||
return curses.color_pair(ColorPair.BLOCKQUOTE) | curses.A_ITALIC
|
||||
return curses.color_pair(ColorPair.BLOCKQUOTE) | A_ITALIC
|
||||
else: # includes LineType.PARAGRAPH
|
||||
return curses.color_pair(ColorPair.NORMAL)
|
||||
|
|
Reference in a new issue