~taiite/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH senpai 1/2] commands: do not handle s == ""

Details
Message ID
<20210521175245.22221-1-yyp@disroot.org>
DKIM signature
pass
Download raw message
Patch: +0 -4
handleInput already checks for this.
---
 commands.go | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/commands.go b/commands.go
index 6e68d27..380bac9 100644
--- a/commands.go
+++ b/commands.go
@@ -412,10 +412,6 @@ func fieldsN(s string, n int) []string {
}

func parseCommand(s string) (command, args string, isCommand bool) {
	if s == "" {
		return "", "", false
	}

	if s[0] != '/' {
		return "", s, false
	}
-- 
2.31.1

[PATCH senpai 2/2] commands: use rawArgs on non-command

Details
Message ID
<20210521175245.22221-2-yyp@disroot.org>
In-Reply-To
<20210521175245.22221-1-yyp@disroot.org> (view parent)
DKIM signature
pass
Download raw message
Patch: +1 -1
This way, the first slash when doing //-message is not deleted because
parseMessage writes the result to rawArgs, instead of the editor
content.

Fixes #63
---
 commands.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands.go b/commands.go
index 380bac9..790b900 100644
--- a/commands.go
+++ b/commands.go
@@ -438,7 +438,7 @@ func (app *App) handleInput(buffer, content string) error {

	cmdName, rawArgs, isCommand := parseCommand(content)
	if !isCommand {
		return noCommand(app, buffer, content)
		return noCommand(app, buffer, rawArgs)
	}
	if cmdName == "" {
		return fmt.Errorf("lone slash at the begining")
-- 
2.31.1
Details
Message ID
<20210525124134.78960930@vroom.localdomain>
In-Reply-To
<20210521175245.22221-1-yyp@disroot.org> (view parent)
DKIM signature
pass
Download raw message
Thanks, pushed both patches.

To git.sr.ht:~taiite/senpai
   ab6c067..2b3c8d2  master -> master
Reply to thread Export thread (mbox)