mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
add new etitor parameter editor_show_right_margin
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
parent
5203d6739d
commit
7c2692cf8c
@ -85,6 +85,7 @@ int option_edit_top_extreme = 0;
|
||||
int option_edit_bottom_extreme = 0;
|
||||
int enable_show_tabs_tws = 1;
|
||||
int option_check_nl_at_eof = 0;
|
||||
int show_right_margin = 0;
|
||||
|
||||
const char *option_whole_chars_search = "0123456789abcdefghijklmnopqrstuvwxyz_";
|
||||
char *option_backup_ext = NULL;
|
||||
|
@ -61,6 +61,7 @@ extern int visible_tws;
|
||||
|
||||
extern int simple_statusbar;
|
||||
extern int option_check_nl_at_eof;
|
||||
extern int show_right_margin;
|
||||
|
||||
/* used in main() */
|
||||
void edit_stack_init (void);
|
||||
|
@ -288,18 +288,23 @@ 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,
|
||||
' ',
|
||||
option_word_wrap_line_length - edit->start_col);
|
||||
|
||||
if (!show_right_margin && -edit->start_col < option_word_wrap_line_length) {
|
||||
tty_draw_hline (edit->widget.y + y, edit->widget.x + x1,
|
||||
' ', end_col + 1 - start_col);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
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;
|
||||
@ -357,11 +362,13 @@ 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);
|
||||
if (show_right_margin) {
|
||||
if (i > option_word_wrap_line_length + edit->start_col)
|
||||
tty_setcolor (EDITOR_RIGHT_MARGIN_COLOR);
|
||||
i++;
|
||||
}
|
||||
tty_print_anychar (textchar);
|
||||
p++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,6 +222,7 @@ static const struct {
|
||||
{ "editor_line_state", &option_line_state },
|
||||
{ "editor_simple_statusbar", &simple_statusbar },
|
||||
{ "editor_check_new_line", &option_check_nl_at_eof },
|
||||
{ "editor_show_right_margin", &show_right_margin },
|
||||
#endif /* USE_INTERNAL_EDIT */
|
||||
|
||||
{ "nice_rotating_dash", &nice_rotating_dash },
|
||||
|
Loading…
Reference in New Issue
Block a user