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