Fix highlight color in replace/selection

This commit is contained in:
Anthony Sottile
2020-03-21 21:08:43 -07:00
parent f1772ec829
commit bf1c3d1ee1
8 changed files with 41 additions and 47 deletions

View File

@@ -2,12 +2,13 @@ import io
import pytest
from babi.color_manager import ColorManager
from babi.file import File
from babi.file import get_lines
def test_position_repr():
ret = repr(File('f.txt', ()))
ret = repr(File('f.txt', ColorManager.make(), ()))
assert ret == "<File 'f.txt'>"

View File

@@ -78,11 +78,16 @@ def syntax(tmpdir):
def test_init_screen_low_color(stdscr, syntax):
with FakeCurses.patch(n_colors=16, can_change_color=False) as fake_curses:
syntax._init_screen(stdscr)
assert syntax.color_manager.colors == {}
assert syntax.color_manager.raw_pairs == {}
assert syntax.color_manager.colors == {
Color.parse('#cccccc'): -1,
Color.parse('#333333'): -1,
Color.parse('#000000'): -1,
Color.parse('#009900'): -1,
}
assert syntax.color_manager.raw_pairs == {(-1, -1): 1}
assert fake_curses.colors == {}
assert fake_curses.pairs == {}
assert stdscr.attr == 0
assert fake_curses.pairs == {1: (-1, -1)}
assert stdscr.attr == 1 << 8
def test_init_screen_256_color(stdscr, syntax):