Ticket #1514 (show right margin)

* added new color pair EDITOR_RIGHT_MARGIN_COLOR
    * show right margin. Used EDITOR_RIGHT_MARGIN_COLOR color for drawing text beyond rigth edge.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
Ilia Maslakov 2009-11-19 15:35:00 +03:00
parent eaf0ff08bb
commit 5203d6739d
6 changed files with 27 additions and 9 deletions

View File

@ -288,9 +288,18 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
int y = row + EDIT_TEXT_VERTICAL_OFFSET;
int cols_to_skip = abs (x);
if (-edit->start_col < option_word_wrap_line_length) {
tty_setcolor (EDITOR_NORMAL_COLOR);
tty_draw_hline (edit->widget.y + y, edit->widget.x + x1,
' ', end_col + 1 - start_col);
tty_draw_hline (edit->widget.y + y,
edit->widget.x + x1,
' ',
option_word_wrap_line_length - edit->start_col);
}
tty_setcolor (EDITOR_RIGHT_MARGIN_COLOR);
tty_draw_hline (edit->widget.y + y,
edit->widget.x + x1 + option_word_wrap_line_length + edit->start_col,
' ',
end_col + 1 - start_col);
if (option_line_state) {
int i;
@ -305,7 +314,7 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
edit_move (x1 + FONT_OFFSET_X, y + FONT_OFFSET_Y);
p = line;
int i = 1;
while (p->ch) {
int style;
unsigned int textchar;
@ -348,8 +357,11 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
tty_lowlevel_setcolor (color);
}
}
if (i > option_word_wrap_line_length + edit->start_col)
tty_setcolor (EDITOR_RIGHT_MARGIN_COLOR);
tty_print_anychar (textchar);
p++;
i++;
}
}

View File

@ -73,6 +73,7 @@
linestate=white;cyan
bookmark=white;red
bookmarkfound=black;green
editrightmargin=white;blue
[viewer]
viewunderline=brightred;black

View File

@ -78,6 +78,7 @@
linestate=white;cyan
bookmark=white;red
bookmarkfound=black;green
editbeyondwrap=brightblue;black
[viewer]
viewunderline=brightred;blue

View File

@ -74,6 +74,7 @@
linestate=white;cyan
bookmark=white;red
bookmarkfound=black;green
editbeyondwrap=brightblue;black
[viewer]
viewunderline=brightred;blue

View File

@ -226,7 +226,9 @@ mc_skin_color_cache_init (void)
EDITOR_BOLD_COLOR = mc_skin_color_get ("editor", "editbold");
EDITOR_MARKED_COLOR = mc_skin_color_get ("editor", "editmarked");
EDITOR_WHITESPACE_COLOR = mc_skin_color_get ("editor", "editwhitespace");
EDITOR_RIGHT_MARGIN_COLOR = mc_skin_color_get ("editor", "editrightmargin");
LINE_STATE_COLOR = mc_skin_color_get ("editor", "linestate");
BOOK_MARK_COLOR = mc_skin_color_get ("editor", "bookmark");
BOOK_MARK_FOUND_COLOR = mc_skin_color_get ("editor", "bookmarkfound");
BUTTONBAR_HOTKEY_COLOR = mc_skin_color_get ("buttonbar", "hotkey");

View File

@ -61,15 +61,16 @@
#define EDITOR_BOLD_COLOR mc_skin_color__cache[26]
#define EDITOR_MARKED_COLOR mc_skin_color__cache[27]
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[28]
#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[29]
/* color of left 8 char status per line */
#define LINE_STATE_COLOR mc_skin_color__cache[29]
#define BOOK_MARK_COLOR mc_skin_color__cache[30]
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[31]
#define LINE_STATE_COLOR mc_skin_color__cache[30]
#define BOOK_MARK_COLOR mc_skin_color__cache[31]
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[32]
#define BUTTONBAR_HOTKEY_COLOR mc_skin_color__cache[32]
#define BUTTONBAR_BUTTON_COLOR mc_skin_color__cache[33]
#define BUTTONBAR_HOTKEY_COLOR mc_skin_color__cache[33]
#define BUTTONBAR_BUTTON_COLOR mc_skin_color__cache[34]
#define MC_SKIN_COLOR_CACHE_COUNT 34
#define MC_SKIN_COLOR_CACHE_COUNT 35
/*** enums ***************************************************************************************/