diff --git a/src/editor/edit-impl.h b/src/editor/edit-impl.h index 593eaf091..6dc031364 100644 --- a/src/editor/edit-impl.h +++ b/src/editor/edit-impl.h @@ -254,6 +254,7 @@ void edit_refresh_cmd (void); void edit_syntax_onoff_cmd (Dlg_head * h); void edit_show_tabs_tws_cmd (Dlg_head * h); void edit_show_margin_cmd (Dlg_head * h); +void edit_show_numbers_cmd (Dlg_head * h); void edit_date_cmd (WEdit * edit); void edit_goto_cmd (WEdit * edit); int eval_marks (WEdit * edit, long *start_mark, long *end_mark); diff --git a/src/editor/edit.c b/src/editor/edit.c index 4bef9d1d7..081699b80 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -2176,10 +2176,7 @@ edit_init (WEdit * edit, int y, int x, int lines, int cols, const vfs_path_t * f gboolean to_free = FALSE; option_auto_syntax = 1; /* Resetting to auto on every invokation */ - if (option_line_state) - option_line_state_width = LINE_STATE_WIDTH; - else - option_line_state_width = 0; + option_line_state_width = option_line_state ? LINE_STATE_WIDTH : 0; if (edit != NULL) edit_purge_widget (edit); @@ -3928,12 +3925,6 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion) edit_mark_current_line_cmd (edit); break; - case CK_ShowNumbers: - option_line_state = !option_line_state; - option_line_state_width = option_line_state ? LINE_STATE_WIDTH : 0; - edit->force |= REDRAW_PAGE; - break; - case CK_Bookmark: book_mark_clear (edit, edit->curs_line, BOOK_MARK_FOUND_COLOR); if (book_mark_query_color (edit, edit->curs_line, BOOK_MARK_COLOR)) diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index 910ddbd72..045420763 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -1530,6 +1530,22 @@ edit_show_margin_cmd (Dlg_head * h) dlg_redraw (h); } +/* --------------------------------------------------------------------------------------------- */ +/** + * Toggle line numbers showing in all editor windows. + * + * @param h root widget for all windows + */ + +void +edit_show_numbers_cmd (Dlg_head * h) +{ + option_line_state = !option_line_state; + option_line_state_width = option_line_state ? LINE_STATE_WIDTH : 0; + g_list_foreach (h->widgets, edit_redraw_page_cb, NULL); + dlg_redraw (h); +} + /* --------------------------------------------------------------------------------------------- */ void diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c index 5520df311..580f204f7 100644 --- a/src/editor/editwidget.c +++ b/src/editor/editwidget.c @@ -590,6 +590,9 @@ edit_dialog_command_execute (Dlg_head * h, unsigned long command) case CK_ShowMargin: edit_show_margin_cmd (h); break; + case CK_ShowNumbers: + edit_show_numbers_cmd (h); + break; case CK_Refresh: edit_refresh_cmd (); break;