* [PATCH master] edit: don't change terminal mode if sedit would fail to read file
@ 2021-04-10 11:02 Ahmad Fatoum
2021-04-13 7:23 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-04-10 11:02 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Failing to read the file, e.g. because the file is actually a directory
will normally result in an appropriate error message.
When using vi or sedit however, we change cursor position beforehand
and then directly exit, which messes up the terminal output and
can even make the shell unusable (as on my Laptop's UEFI).
Move the check earlier to avoid this.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
commands/edit.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/commands/edit.c b/commands/edit.c
index 3ab4beaa4ffb..f1e4e4d5c260 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -495,6 +495,10 @@ static int do_edit(int argc, char *argv[])
if (argc != 2)
return COMMAND_ERROR_USAGE;
+ buffer = NULL;
+ if(edit_read_file(argv[1]))
+ return 1;
+
screenwidth = 80;
/*
@@ -517,10 +521,6 @@ static int do_edit(int argc, char *argv[])
is_vi = true;
}
- buffer = NULL;
- if(edit_read_file(argv[1]))
- return 1;
-
cursx = 0;
cursy = 0;
textx = 0;
--
2.30.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH master] edit: don't change terminal mode if sedit would fail to read file
2021-04-10 11:02 [PATCH master] edit: don't change terminal mode if sedit would fail to read file Ahmad Fatoum
@ 2021-04-13 7:23 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-04-13 7:23 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Sat, Apr 10, 2021 at 01:02:50PM +0200, Ahmad Fatoum wrote:
> Failing to read the file, e.g. because the file is actually a directory
> will normally result in an appropriate error message.
>
> When using vi or sedit however, we change cursor position beforehand
> and then directly exit, which messes up the terminal output and
> can even make the shell unusable (as on my Laptop's UEFI).
> Move the check earlier to avoid this.
>
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
> commands/edit.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/commands/edit.c b/commands/edit.c
> index 3ab4beaa4ffb..f1e4e4d5c260 100644
> --- a/commands/edit.c
> +++ b/commands/edit.c
> @@ -495,6 +495,10 @@ static int do_edit(int argc, char *argv[])
> if (argc != 2)
> return COMMAND_ERROR_USAGE;
>
> + buffer = NULL;
> + if(edit_read_file(argv[1]))
> + return 1;
> +
> screenwidth = 80;
>
> /*
> @@ -517,10 +521,6 @@ static int do_edit(int argc, char *argv[])
> is_vi = true;
> }
>
> - buffer = NULL;
> - if(edit_read_file(argv[1]))
> - return 1;
> -
> cursx = 0;
> cursy = 0;
> textx = 0;
> --
> 2.30.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-13 7:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-10 11:02 [PATCH master] edit: don't change terminal mode if sedit would fail to read file Ahmad Fatoum
2021-04-13 7:23 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox