Show More
@@ -1517,39 +1517,11 b' pgup/K: move patch up, pgdn/J: move patc' | |||||
1517 | b'main': (mainlen, maxx), |
|
1517 | b'main': (mainlen, maxx), | |
1518 | } |
|
1518 | } | |
1519 |
|
1519 | |||
1520 |
|
1520 | def render_rules(self, rulesscr): | ||
1521 | def _chisteditmain(repo, rules, stdscr): |
|
1521 | rules = self.rules | |
1522 | try: |
|
1522 | pos = self.pos | |
1523 | curses.use_default_colors() |
|
1523 | selected = self.selected | |
1524 | except curses.error: |
|
1524 | start = self.modes[MODE_RULES][b'line_offset'] | |
1525 | pass |
|
|||
1526 |
|
||||
1527 | # initialize color pattern |
|
|||
1528 | curses.init_pair(COLOR_HELP, curses.COLOR_WHITE, curses.COLOR_BLUE) |
|
|||
1529 | curses.init_pair(COLOR_SELECTED, curses.COLOR_BLACK, curses.COLOR_WHITE) |
|
|||
1530 | curses.init_pair(COLOR_WARN, curses.COLOR_BLACK, curses.COLOR_YELLOW) |
|
|||
1531 | curses.init_pair(COLOR_OK, curses.COLOR_BLACK, curses.COLOR_GREEN) |
|
|||
1532 | curses.init_pair(COLOR_CURRENT, curses.COLOR_WHITE, curses.COLOR_MAGENTA) |
|
|||
1533 | curses.init_pair(COLOR_DIFF_ADD_LINE, curses.COLOR_GREEN, -1) |
|
|||
1534 | curses.init_pair(COLOR_DIFF_DEL_LINE, curses.COLOR_RED, -1) |
|
|||
1535 | curses.init_pair(COLOR_DIFF_OFFSET, curses.COLOR_MAGENTA, -1) |
|
|||
1536 | curses.init_pair(COLOR_ROLL, curses.COLOR_RED, -1) |
|
|||
1537 | curses.init_pair( |
|
|||
1538 | COLOR_ROLL_CURRENT, curses.COLOR_BLACK, curses.COLOR_MAGENTA |
|
|||
1539 | ) |
|
|||
1540 | curses.init_pair(COLOR_ROLL_SELECTED, curses.COLOR_RED, curses.COLOR_WHITE) |
|
|||
1541 |
|
||||
1542 | # don't display the cursor |
|
|||
1543 | try: |
|
|||
1544 | curses.curs_set(0) |
|
|||
1545 | except curses.error: |
|
|||
1546 | pass |
|
|||
1547 |
|
||||
1548 | def renderrules(rulesscr, state): |
|
|||
1549 | rules = state.rules |
|
|||
1550 | pos = state.pos |
|
|||
1551 | selected = state.selected |
|
|||
1552 | start = state.modes[MODE_RULES][b'line_offset'] |
|
|||
1553 |
|
1525 | |||
1554 | conflicts = [r.ctx for r in rules if r.conflicts] |
|
1526 | conflicts = [r.ctx for r in rules if r.conflicts] | |
1555 | if len(conflicts) > 0: |
|
1527 | if len(conflicts) > 0: | |
@@ -1559,7 +1531,7 b' def _chisteditmain(repo, rules, stdscr):' | |||||
1559 | addln(rulesscr, -1, 0, line, curses.color_pair(COLOR_WARN)) |
|
1531 | addln(rulesscr, -1, 0, line, curses.color_pair(COLOR_WARN)) | |
1560 |
|
1532 | |||
1561 | for y, rule in enumerate(rules[start:]): |
|
1533 | for y, rule in enumerate(rules[start:]): | |
1562 |
if y >= s |
|
1534 | if y >= self.page_height: | |
1563 | break |
|
1535 | break | |
1564 | if len(rule.conflicts) > 0: |
|
1536 | if len(rule.conflicts) > 0: | |
1565 | rulesscr.addstr(y, 0, b" ", curses.color_pair(COLOR_WARN)) |
|
1537 | rulesscr.addstr(y, 0, b" ", curses.color_pair(COLOR_WARN)) | |
@@ -1592,6 +1564,34 b' def _chisteditmain(repo, rules, stdscr):' | |||||
1592 |
|
1564 | |||
1593 | rulesscr.noutrefresh() |
|
1565 | rulesscr.noutrefresh() | |
1594 |
|
1566 | |||
|
1567 | ||||
|
1568 | def _chisteditmain(repo, rules, stdscr): | |||
|
1569 | try: | |||
|
1570 | curses.use_default_colors() | |||
|
1571 | except curses.error: | |||
|
1572 | pass | |||
|
1573 | ||||
|
1574 | # initialize color pattern | |||
|
1575 | curses.init_pair(COLOR_HELP, curses.COLOR_WHITE, curses.COLOR_BLUE) | |||
|
1576 | curses.init_pair(COLOR_SELECTED, curses.COLOR_BLACK, curses.COLOR_WHITE) | |||
|
1577 | curses.init_pair(COLOR_WARN, curses.COLOR_BLACK, curses.COLOR_YELLOW) | |||
|
1578 | curses.init_pair(COLOR_OK, curses.COLOR_BLACK, curses.COLOR_GREEN) | |||
|
1579 | curses.init_pair(COLOR_CURRENT, curses.COLOR_WHITE, curses.COLOR_MAGENTA) | |||
|
1580 | curses.init_pair(COLOR_DIFF_ADD_LINE, curses.COLOR_GREEN, -1) | |||
|
1581 | curses.init_pair(COLOR_DIFF_DEL_LINE, curses.COLOR_RED, -1) | |||
|
1582 | curses.init_pair(COLOR_DIFF_OFFSET, curses.COLOR_MAGENTA, -1) | |||
|
1583 | curses.init_pair(COLOR_ROLL, curses.COLOR_RED, -1) | |||
|
1584 | curses.init_pair( | |||
|
1585 | COLOR_ROLL_CURRENT, curses.COLOR_BLACK, curses.COLOR_MAGENTA | |||
|
1586 | ) | |||
|
1587 | curses.init_pair(COLOR_ROLL_SELECTED, curses.COLOR_RED, curses.COLOR_WHITE) | |||
|
1588 | ||||
|
1589 | # don't display the cursor | |||
|
1590 | try: | |||
|
1591 | curses.curs_set(0) | |||
|
1592 | except curses.error: | |||
|
1593 | pass | |||
|
1594 | ||||
1595 | def renderstring(win, state, output, diffcolors=False): |
|
1595 | def renderstring(win, state, output, diffcolors=False): | |
1596 | maxy, maxx = win.getmaxyx() |
|
1596 | maxy, maxx = win.getmaxyx() | |
1597 | length = min(maxy - 1, len(output)) |
|
1597 | length = min(maxy - 1, len(output)) | |
@@ -1679,7 +1679,7 b' def _chisteditmain(repo, rules, stdscr):' | |||||
1679 | elif curmode == MODE_HELP: |
|
1679 | elif curmode == MODE_HELP: | |
1680 | renderstring(mainwin, state, __doc__.strip().splitlines()) |
|
1680 | renderstring(mainwin, state, __doc__.strip().splitlines()) | |
1681 | else: |
|
1681 | else: | |
1682 |
renderrules(mainwin |
|
1682 | state.render_rules(mainwin) | |
1683 | state.render_commit(commitwin) |
|
1683 | state.render_commit(commitwin) | |
1684 | state.render_help(helpwin) |
|
1684 | state.render_help(helpwin) | |
1685 | curses.doupdate() |
|
1685 | curses.doupdate() |
General Comments 0
You need to be logged in to leave comments.
Login now