mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
add option_line_status and option_line_status_width.
if option_line_status = 1 then show line numbers
This commit is contained in:
parent
406e83eac4
commit
0bc82a444b
10
edit/edit.c
10
edit/edit.c
@ -66,6 +66,8 @@ int option_save_mode = EDIT_QUICK_SAVE;
|
|||||||
int option_save_position = 1;
|
int option_save_position = 1;
|
||||||
int option_max_undo = 32768;
|
int option_max_undo = 32768;
|
||||||
int option_persistent_selections = 1;
|
int option_persistent_selections = 1;
|
||||||
|
int option_line_status = 0;
|
||||||
|
int option_line_status_width = 0;
|
||||||
|
|
||||||
int option_edit_right_extreme = 0;
|
int option_edit_right_extreme = 0;
|
||||||
int option_edit_left_extreme = 0;
|
int option_edit_left_extreme = 0;
|
||||||
@ -627,7 +629,11 @@ edit_init (WEdit *edit, int lines, int columns, const char *filename,
|
|||||||
{
|
{
|
||||||
int to_free = 0;
|
int to_free = 0;
|
||||||
option_auto_syntax = 1; /* Resetting to auto on every invokation */
|
option_auto_syntax = 1; /* Resetting to auto on every invokation */
|
||||||
|
if ( option_line_status ) {
|
||||||
|
option_line_status_width = LINE_STATUS_WIDTH;
|
||||||
|
} else {
|
||||||
|
option_line_status_width = 0;
|
||||||
|
}
|
||||||
if (!edit) {
|
if (!edit) {
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
/*
|
/*
|
||||||
@ -1483,7 +1489,7 @@ void edit_update_curs_row (WEdit * edit)
|
|||||||
|
|
||||||
void edit_update_curs_col (WEdit * edit)
|
void edit_update_curs_col (WEdit * edit)
|
||||||
{
|
{
|
||||||
edit->curs_col = edit_move_forward3(edit, edit_bol(edit, edit->curs1), 0, edit->curs1) + 8;
|
edit->curs_col = edit_move_forward3(edit, edit_bol(edit, edit->curs1), 0, edit->curs1) + option_line_status_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*moves the display start position up by i lines */
|
/*moves the display start position up by i lines */
|
||||||
|
@ -288,6 +288,8 @@ extern int option_return_does_auto_indent;
|
|||||||
extern int option_backspace_through_tabs;
|
extern int option_backspace_through_tabs;
|
||||||
extern int option_fake_half_tabs;
|
extern int option_fake_half_tabs;
|
||||||
extern int option_persistent_selections;
|
extern int option_persistent_selections;
|
||||||
|
extern int option_line_status;
|
||||||
|
extern int option_line_status_width;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EDIT_QUICK_SAVE = 0,
|
EDIT_QUICK_SAVE = 0,
|
||||||
|
@ -247,7 +247,7 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
|
|||||||
{
|
{
|
||||||
struct line_s *p;
|
struct line_s *p;
|
||||||
int x = start_col_real + EDIT_TEXT_HORIZONTAL_OFFSET;
|
int x = start_col_real + EDIT_TEXT_HORIZONTAL_OFFSET;
|
||||||
int x1 = LINE_STATUS_WIDTH + start_col + EDIT_TEXT_HORIZONTAL_OFFSET;
|
int x1 = option_line_status_width + start_col + EDIT_TEXT_HORIZONTAL_OFFSET;
|
||||||
int y = row + EDIT_TEXT_VERTICAL_OFFSET;
|
int y = row + EDIT_TEXT_VERTICAL_OFFSET;
|
||||||
int cols_to_skip = abs (x);
|
int cols_to_skip = abs (x);
|
||||||
unsigned char str[6 + 1];
|
unsigned char str[6 + 1];
|
||||||
@ -256,14 +256,16 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
|
|||||||
edit_move (x1, y);
|
edit_move (x1, y);
|
||||||
hline (' ', end_col + 1 - EDIT_TEXT_HORIZONTAL_OFFSET - x1);
|
hline (' ', end_col + 1 - EDIT_TEXT_HORIZONTAL_OFFSET - x1);
|
||||||
|
|
||||||
|
if ( option_line_status ) {
|
||||||
for (int i = 0; i < LINE_STATUS_WIDTH; i++) {
|
for (int i = 0; i < LINE_STATUS_WIDTH; i++) {
|
||||||
if ( status[i] == '\0' ) {
|
if ( status[i] == '\0' ) {
|
||||||
status[i] = ' ';
|
status[i] = ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set_color (MENU_ENTRY_COLOR);
|
set_color (MENU_ENTRY_COLOR);
|
||||||
edit_move (x1 + FONT_OFFSET_X - LINE_STATUS_WIDTH, y + FONT_OFFSET_Y);
|
edit_move (x1 + FONT_OFFSET_X - option_line_status_width, y + FONT_OFFSET_Y);
|
||||||
addstr (status);
|
addstr (status);
|
||||||
|
}
|
||||||
|
|
||||||
set_color (EDITOR_NORMAL_COLOR);
|
set_color (EDITOR_NORMAL_COLOR);
|
||||||
edit_move (x1 + FONT_OFFSET_X, y + FONT_OFFSET_Y);
|
edit_move (x1 + FONT_OFFSET_X, y + FONT_OFFSET_Y);
|
||||||
@ -354,14 +356,15 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
|
|||||||
c1 = min (edit->column1, edit->column2);
|
c1 = min (edit->column1, edit->column2);
|
||||||
c2 = max (edit->column1, edit->column2);
|
c2 = max (edit->column1, edit->column2);
|
||||||
unsigned long cur_line = edit->start_line + row;
|
unsigned long cur_line = edit->start_line + row;
|
||||||
|
if ( option_line_status ) {
|
||||||
if ( cur_line < edit->total_lines ) {
|
if ( cur_line < edit->total_lines ) {
|
||||||
g_snprintf(line_stat, LINE_STATUS_WIDTH + 1, "%7ld ", cur_line + 1);
|
g_snprintf(line_stat, LINE_STATUS_WIDTH + 1, "%7ld ", cur_line + 1);
|
||||||
} else if ( cur_line == edit->total_lines ) {
|
} else if ( cur_line == edit->total_lines ) {
|
||||||
g_snprintf(line_stat, LINE_STATUS_WIDTH + 1, " <EOF>");
|
g_snprintf(line_stat, LINE_STATUS_WIDTH + 1, "eof");
|
||||||
} else {
|
} else {
|
||||||
line_stat[0] = '\0';
|
line_stat[0] = '\0';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (col + 16 > -edit->start_col) {
|
if (col + 16 > -edit->start_col) {
|
||||||
eval_marks (edit, &m1, &m2);
|
eval_marks (edit, &m1, &m2);
|
||||||
|
|
||||||
|
@ -221,6 +221,7 @@ static const struct {
|
|||||||
{ "editor_persistent_selections", &option_persistent_selections },
|
{ "editor_persistent_selections", &option_persistent_selections },
|
||||||
{ "editor_visible_tabs", &visible_tabs },
|
{ "editor_visible_tabs", &visible_tabs },
|
||||||
{ "editor_visible_spaces", &visible_tws },
|
{ "editor_visible_spaces", &visible_tws },
|
||||||
|
{ "editor_line_status", &option_line_status },
|
||||||
#endif /* USE_INTERNAL_EDIT */
|
#endif /* USE_INTERNAL_EDIT */
|
||||||
|
|
||||||
{ "nice_rotating_dash", &nice_rotating_dash },
|
{ "nice_rotating_dash", &nice_rotating_dash },
|
||||||
|
Loading…
Reference in New Issue
Block a user