~delthas/senpai-dev

Handle empty message properly v1 APPLIED

sewn: 1
 Handle empty message properly

 1 files changed, 1 insertions(+), 1 deletions(-)
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/~delthas/senpai-dev/patches/47738/mbox | git am -3
Learn more about email & git

[PATCH v1] Handle empty message properly Export this patch

Sending nothing in senpai makes the if check to work properly, however
if sent nothing but a space, senpai will panic, as parseCommand assumes
it is alphanumerical and not just a space.

This commit fixes it by not allowing a message to only contain just
spaces.

Signed-off-by: sewn <sewn@disroot.org>
---
 commands.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands.go b/commands.go
index cc7282f..fba84d8 100644
--- a/commands.go
+++ b/commands.go
@@ -934,7 +934,7 @@ func (app *App) handleInput(buffer, content string) error {
	confirmed := content == app.lastConfirm
	app.lastConfirm = content

	if content == "" {
	if strings.TrimSpace(content) == "" {
		return nil
	}


base-commit: 5e771831a3196f49d4417e0f913da64a251e8cb5
-- 
2.43.0
Hi,

Thanks for your patch.

Modified the way to address the issue (fix parseCommand rather than an 
early return). And pushed :-)

To git.sr.ht:~delthas/senpai
    edb498b..1ad07b5  master -> master