Use A_DIM when highlighting
- this makes the highlight different from the cursor - I think this is what vim does
This commit is contained in:
12
babi.py
12
babi.py
@@ -36,6 +36,7 @@ VERSION_STR = 'babi v0'
|
|||||||
TCallable = TypeVar('TCallable', bound=Callable[..., Any])
|
TCallable = TypeVar('TCallable', bound=Callable[..., Any])
|
||||||
EditResult = enum.Enum('EditResult', 'EXIT NEXT PREV')
|
EditResult = enum.Enum('EditResult', 'EXIT NEXT PREV')
|
||||||
PromptResult = enum.Enum('PromptResult', 'CANCELLED')
|
PromptResult = enum.Enum('PromptResult', 'CANCELLED')
|
||||||
|
HIGHLIGHT = curses.A_REVERSE | curses.A_DIM
|
||||||
|
|
||||||
|
|
||||||
def _line_x(x: int, width: int) -> int:
|
def _line_x(x: int, width: int) -> int:
|
||||||
@@ -825,8 +826,7 @@ class File:
|
|||||||
self.highlight(
|
self.highlight(
|
||||||
screen.stdscr, screen.margin,
|
screen.stdscr, screen.margin,
|
||||||
y=self.y, x=self.x, n=len(match[0]),
|
y=self.y, x=self.x, n=len(match[0]),
|
||||||
color=curses.A_REVERSE,
|
color=HIGHLIGHT, include_edge=True,
|
||||||
include_edge=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@@ -1205,24 +1205,24 @@ class File:
|
|||||||
self.highlight(
|
self.highlight(
|
||||||
stdscr, margin,
|
stdscr, margin,
|
||||||
y=s_y, x=s_x, n=e_x - s_x,
|
y=s_y, x=s_x, n=e_x - s_x,
|
||||||
color=curses.A_REVERSE, include_edge=True,
|
color=HIGHLIGHT, include_edge=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.highlight(
|
self.highlight(
|
||||||
stdscr, margin,
|
stdscr, margin,
|
||||||
y=s_y, x=s_x, n=len(self.lines[s_y]) - s_x + 1,
|
y=s_y, x=s_x, n=len(self.lines[s_y]) - s_x + 1,
|
||||||
color=curses.A_REVERSE, include_edge=True,
|
color=HIGHLIGHT, include_edge=True,
|
||||||
)
|
)
|
||||||
for l_y in range(s_y + 1, e_y):
|
for l_y in range(s_y + 1, e_y):
|
||||||
self.highlight(
|
self.highlight(
|
||||||
stdscr, margin,
|
stdscr, margin,
|
||||||
y=l_y, x=0, n=len(self.lines[l_y]) + 1,
|
y=l_y, x=0, n=len(self.lines[l_y]) + 1,
|
||||||
color=curses.A_REVERSE, include_edge=True,
|
color=HIGHLIGHT, include_edge=True,
|
||||||
)
|
)
|
||||||
self.highlight(
|
self.highlight(
|
||||||
stdscr, margin,
|
stdscr, margin,
|
||||||
y=e_y, x=0, n=e_x,
|
y=e_y, x=0, n=e_x,
|
||||||
color=curses.A_REVERSE, include_edge=True,
|
color=HIGHLIGHT, include_edge=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
def highlight(
|
def highlight(
|
||||||
|
|||||||
Reference in New Issue
Block a user