~hedy/inbox

gelim: Do not show error message on exit through CTRL-D v1 APPLIED

codesoap: 2
 Do not show error message on exit through CTRL-D
 Do not show error message on exit through CTRL-D

 2 files changed, 11 insertions(+), 2 deletions(-)
Can be improved but I'll do it, thanks!
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~hedy/inbox/patches/25912/mbox | git am -3
Learn more about email & git

[PATCH gelim] Do not show error message on exit through CTRL-D Export this patch

---
First time using git send-email; hope this works... Thanks for writing
this gemini client, it's my favourite so far, after trying most of the
"mainstream" ones! I usually exit programs, that give me readlines with
CTRL-D. Before this patch, gelim would exit on CTRL-D, but also display
an error message.

 gelim.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gelim.go b/gelim.go
index 1953c30..3f6938c 100644
--- a/gelim.go
+++ b/gelim.go
@@ -151,7 +151,11 @@ func main() {
		}
		color.Unset()

		if err != nil {
		if err == io.EOF {
			// Exit by CTRL-D.
			fmt.Println("")
			c.QuitClient(0)
		} else if err != nil {
			if err != ln.ErrPromptAborted {
				c.style.ErrorMsg("error reading line input: " + err.Error())
			}
-- 
2.33.0
(oops I didn't reply all, ignore the double email)

***

Hi! Sorry for the delay. Your patch sent successfully :)

I'm glad it's your favorite client. It's a pity that I haven't
been able to work on it for quite a long time due to IRL issues,
but I'm sure I'll find time for it real soon.

[PATCH gelim] Do not show error message on exit through CTRL-D Export this patch

---
Is this what you had in mind? I would still add an additional 'if' to
exit with exit code 0 on CTLR-D.

 gelim.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gelim.go b/gelim.go
index 1953c30..066a2ec 100644
--- a/gelim.go
+++ b/gelim.go
@@ -152,9 +152,14 @@ func main() {
		color.Unset()

		if err != nil {
			if err != ln.ErrPromptAborted {
			if err != ln.ErrPromptAborted && err != io.EOF {
				c.style.ErrorMsg("error reading line input: " + err.Error())
			}
			fmt.Println("")
			if err == io.EOF {
				// Exit by CTRL-D.
				c.QuitClient(0)
			}
			// Exiting because it will cause an infinite loop of error if used 'continue' here
			c.QuitClient(1)
		}
-- 
2.33.0
Can be improved but I'll do it, thanks!