From 4c1c425bbbc364b7e4c98088ef9bef64b871d959 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 28 Apr 2018 11:44:53 +0200
Subject: [PATCH] bindings: add the 'linenumbers' bindable function

This makes the line-numbers toggle rebindable, like all the others.
---
 doc/nano.texi | 3 +++
 doc/nanorc.5  | 3 +++
 src/global.c  | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/doc/nano.texi b/doc/nano.texi
index 03c7afb8..0f924959 100644
--- a/doc/nano.texi
+++ b/doc/nano.texi
@@ -1359,6 +1359,9 @@ Toggles smooth scrolling (when moving around with the arrow keys).
 @item softwrap
 Toggles the displaying of overlong lines on multiple screen lines.
 
+@item linenumbers
+Toggles the display of line numbers in front of the text.
+
 @item whitespacedisplay
 Toggles the showing of whitespace.
 
diff --git a/doc/nanorc.5 b/doc/nanorc.5
index 6a931f96..e901db60 100644
--- a/doc/nanorc.5
+++ b/doc/nanorc.5
@@ -715,6 +715,9 @@ Toggles smooth scrolling (when moving around with the arrow keys).
 .B softwrap
 Toggles the displaying of overlong lines on multiple screen lines.
 .TP
+.B linenumbers
+Toggles the display of line numbers in front of the text.
+.TP
 .B whitespacedisplay
 Toggles the showing of whitespace.
 .TP
diff --git a/src/global.c b/src/global.c
index 22495a62..faae60b0 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1667,6 +1667,10 @@ sc *strtosc(const char *input)
 			s->toggle = SMOOTH_SCROLL;
 		else if (!strcasecmp(input, "softwrap"))
 			s->toggle = SOFTWRAP;
+#ifdef ENABLE_LINENUMBERS
+		else if (!strcasecmp(input, "linenumbers"))
+			s->toggle = LINE_NUMBERS;
+#endif
 		else if (!strcasecmp(input, "whitespacedisplay"))
 			s->toggle = WHITESPACE_DISPLAY;
 #ifdef ENABLE_COLOR
-- 
GitLab