From 3787fe136e7b47981cb8cb531c3469e0a71d4427 Mon Sep 17 00:00:00 2001 From: faissaloo Date: Mon, 5 Sep 2016 21:21:54 +0100 Subject: [PATCH 18/20] Made line numbering toggleable --- src/global.c | 6 ++++++ src/winio.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/global.c b/src/global.c index d72ec40..50884de 100644 --- a/src/global.c +++ b/src/global.c @@ -1163,6 +1163,8 @@ void shortcut_init(void) #ifndef NANO_TINY /* Group of "Appearance" toggles. */ + add_to_sclist(MMAIN, "M-#", do_toggle_void, LINE_NUM); + add_to_sclist(MMAIN, "M-!", do_toggle_void, HEX_LINE_NUM); add_to_sclist(MMAIN, "M-X", do_toggle_void, NO_HELP); add_to_sclist(MMAIN, "M-C", do_toggle_void, CONST_UPDATE); add_to_sclist(MMAIN, "M-O", do_toggle_void, MORE_SPACE); @@ -1348,6 +1350,10 @@ const char *flagtostr(int flag) return N_("No conversion from DOS/Mac format"); case SUSPEND: return N_("Suspension"); + case LINE_NUM: + return N_("Line numbering"); + case HEX_LINE_NUM: + return N_("Hex line numbering"); default: return "?????"; } diff --git a/src/winio.c b/src/winio.c index a06a426..d760a26 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2245,6 +2245,10 @@ void edit_draw(filestruct *fileptr, const char *converted, int margin - (hexlen(fileptr->lineno) + 2), "%X│", fileptr->lineno); } + else + { + margin = 0; + } #endif #if !defined(NANO_TINY) || !defined(DISABLE_COLOR) size_t startpos = actual_x(fileptr->data, start); -- 2.7.4