Skip to content

Commit

Permalink
board/common: replace default editor, nano -> mg
Browse files Browse the repository at this point in the history
This reverts an earlier change where nano was made the default editor in
a misguided attemt by yours truly to accomodate beginner users.

With the recent improvements of the CLI and the fact that the NETCONF
support has matured greatly, the need for a user-friendly editor have
diminished drastically.  Editing system files is now limited to devs
and the core team prefers Mg over nano and vi.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
  • Loading branch information
troglobit committed Jul 23, 2023
1 parent 8f29d71 commit dda7b37
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 2 deletions.
1 change: 1 addition & 0 deletions board/common/rootfs/etc/profile.d/convenience.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ alias ll='ls -alF'
alias ls='ls --color=auto'

export EDITOR=/usr/bin/edit
export VISUAL=/usr/bin/edit
export LESS="-P %f (press h for help or q to quit)"
alias vim='vi'
alias view='vi -R'
Expand Down
2 changes: 1 addition & 1 deletion board/common/rootfs/usr/bin/edit
2 changes: 1 addition & 1 deletion board/common/rootfs/usr/bin/editor
73 changes: 73 additions & 0 deletions patches/mg/3.5/0001-Backport-v3.7-help-text-fixes-to-v3.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From eb6a25f194bc76f2fefff319bcf9cb7d64b17e11 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 23 Jul 2023 10:44:46 +0200
Subject: [PATCH] Backport v3.7 help text fixes to v3.5
Organization: Addiva Elektronik

- Follow-up to #17: reorder and imporve *quick* buffer
- Replace 2nd undo command in *quick* with mark-all instead
- Move C + M help last on the line
- Redcuce *quick* size and make help text in status area permanent

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/echo.c | 1 +
src/help.c | 16 +++++++---------
2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/echo.c b/src/echo.c
index 12a0853..e7388c9 100644
--- a/src/echo.c
+++ b/src/echo.c
@@ -46,6 +46,7 @@ eerase(void)
tteeol();
ttflush();
epresf = FALSE;
+ ewprintf(" %s", hlp);
}

/*
diff --git a/src/help.c b/src/help.c
index 19fe9bf..980b0ae 100644
--- a/src/help.c
+++ b/src/help.c
@@ -19,7 +19,7 @@

#define KEYNAMESZ 6 /* max is "C-SPC" */

-const char *hlp = "C-h q toggle quick help | C-h t show tutorial | C-h b show key bindings";
+const char *hlp = "C-h q quick help | C-h t tutorial | C-h b key bindings | C = Ctrl | M = Alt";

static int showall(struct buffer *, KEYMAP *, char *);
static int findbind(KEYMAP *, PF, char *, size_t);
@@ -237,13 +237,11 @@ quickhelp(int f, int n)
bp->b_flag |= BFREADONLY;

addline(bp, "FILE BUFFER WINDOW MARK/KILL MISC");
- addline(bp, "C-x C-c exit C-x C-k close C-0 only other C-space mark C-_ undo");
- addline(bp, "C-x C-f find C-x k other C-1 only this C-w wipe C-s search");
- addline(bp, "C-x C-s save C-x C-b list C-2 split two C-k close C-r r-search");
- addline(bp, "C-x s all C-x b switch C-x ^ enlarge C-y yank M-% replace");
- addline(bp, "C-x i insert C-x g goto ln C-x o other win C-x C-x swap M-q reformat");
- addline(bp, "______________________________________________________________________________");
- addlinef(bp, "%s", hlp);
+ addline(bp, "C-x C-c exit C-x b switch C-x 0 only other C-space mark C-_ undo");
+ addline(bp, "C-x C-f find C-x k close C-x 1 only this C-w kill-rg C-s search");
+ addline(bp, "C-x C-s save C-x C-b list C-x 2 split two C-k kill-ln C-r r-search");
+ addline(bp, "C-x s save-all C-x h mark C-x ^ enlarge C-y yank M-% replace");
+ addline(bp, "C-x i insert C-x g goto-ln C-x o other win C-x C-x swap M-q reformat");

rc = popbuftop(bp, WNONE);
if (rc == TRUE) {
@@ -252,7 +250,7 @@ quickhelp(int f, int n)
prevwind(0, 0);

/* Attempt to shkrink window to size fo quick help */
- n = curwp->w_ntrows - 8;
+ n = curwp->w_ntrows - 6;
shrinkwind(FFRAND, n);

prevwind(0, 0);
--
2.34.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
From 2effd39272fb6137220700f00e3901e4575772ac Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 23 Jul 2023 10:44:46 +0200
Subject: [PATCH 1/2] Redcuce *quick* size and make help text in status area
permanent
Organization: Addiva Elektronik

In an effort to improve on the usability for beginners, without getting
in the way of experienced Mg users, the initial help text in the status
area is now shown permanently. I.e., whenever Mg clears the statis area
we show the help text.

Since we now show the help text in the status area we can drop it from
the *quick* help buffer and reduce the height to save screen estate.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/echo.c | 1 +
src/help.c | 4 +---
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/echo.c b/src/echo.c
index 397ddc4..46a095f 100644
--- a/src/echo.c
+++ b/src/echo.c
@@ -46,6 +46,7 @@ eerase(void)
tteeol();
ttflush();
epresf = FALSE;
+ ewprintf(" %s", hlp);
}

/*
diff --git a/src/help.c b/src/help.c
index 03bd8f8..cc49bed 100644
--- a/src/help.c
+++ b/src/help.c
@@ -239,8 +239,6 @@ quickhelp(int f, int n)
addline(bp, "C-x C-s save C-x C-b list C-x 2 split two C-k kill-ln C-r r-search");
addline(bp, "C-x s save-all C-x h mark C-x ^ enlarge C-y yank M-% replace");
addline(bp, "C-x i insert C-x g goto-ln C-x o other win C-x C-x swap M-q reformat");
- addline(bp, "______________________________________________________________________________");
- addlinef(bp, "%s", hlp);

rc = popbuftop(bp, WNONE);
if (rc == TRUE) {
@@ -249,7 +247,7 @@ quickhelp(int f, int n)
prevwind(0, 0);

/* Attempt to shkrink window to size fo quick help */
- n = curwp->w_ntrows - 8;
+ n = curwp->w_ntrows - 6;
shrinkwind(FFRAND, n);

prevwind(0, 0);
--
2.34.1

0 comments on commit dda7b37

Please sign in to comment.