From f46b0b2c44d8b15a649ab5903ffd61c68172871d Mon Sep 17 00:00:00 2001 From: decentral1se Date: Mon, 24 Jul 2023 12:33:17 +0200 Subject: [PATCH] wip: capitalisation, help help & remapping scroll --- conn.go | 6 +++--- input.go | 16 ++++++++-------- model.go | 20 +++++++++++--------- render.go | 4 ++-- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/conn.go b/conn.go index f4d905e..5f0ce7d 100644 --- a/conn.go +++ b/conn.go @@ -78,7 +78,7 @@ func connInit(m *model) tea.Msg { return errMsg{Err: fmt.Errorf("unable to initialise torrc builder: %s", err)} } - m.sendStatus("initialising Tor ACN...") + m.sendStatus("Initialising Tor ACN...") acn, err := tor.NewTorACNWithAuth( path.Join(m.userDir, "/.tor"), @@ -93,7 +93,7 @@ func connInit(m *model) tea.Msg { return errMsg{Err: fmt.Errorf("unable to bootstrap tor: %s", err)} } - m.sendStatus("waiting for Tor ACN to bootstrap...") + m.sendStatus("Waiting for ACN to bootstrap...") if err := acn.WaitTillBootstrapped(); err != nil { return errMsg{Err: fmt.Errorf("unable to initialise tor: %s", err)} @@ -111,7 +111,7 @@ func connInit(m *model) tea.Msg { app := app.NewApp(acn, m.userDir, settingsFile) app.InstallEngineHooks(connections.DefaultEngineHooks{}) - m.sendStatus("the Tor ACN is up") + m.sendStatus("Tor ACN is up and running, all engines go") return appInitialisedMsg{ app: app, diff --git a/input.go b/input.go index c088612..3442f6e 100644 --- a/input.go +++ b/input.go @@ -6,14 +6,14 @@ import ( tea "github.com/charmbracelet/bubbletea" ) -const cmdHelp = `/clear -/connect -/help -/profile create -/profile info -/profile unlock -/start -/quit` +const cmdHelp = `/clear | Clear the screen +/connect | Start the Tor ACN +/help | Show this help +/profile create | Create a new profile +/profile info | Show profile information +/profile unlock | Unlock profile(s) +/start | Show getting started guide +/quit | Quit the program` func isHelpCmd(cmds []string) bool { if cmds[0] == "help" { diff --git a/model.go b/model.go index 982a50a..ced373d 100644 --- a/model.go +++ b/model.go @@ -24,11 +24,12 @@ const ( Metadata resistant messaging Pre-alpha v0.1.0 -Run /start for the getting started guide -Use the /help command to see the command listing` +Run /start for the getting started guide. +Run /help to see all available commands.` - gettingStartedMessage = ` -== Getting started guide == + gettingStartedMessage = `===================== +Getting started guide +===================== Welcome to Cairde, a terminal client for metadata resistant messaging built on the Cwtch protocol. In order to get started, you'll need to connect to the Tor @@ -37,12 +38,13 @@ network, initialise Cwtch and create your first profile. It's simple! 1. Type /connect to start your Tor engines and initialise Cwtch. 2. Type "/profile create " to create a profile. - Please replace <...> with your own name/passwords. + Please replace <...> with your own name/passwords. Both passwords should + match. WARNING: if you can't remember your password, you can't unlock your + profile, so **write it down somehwere safe**. TODO: * how to invite contacts - * how to toggle contact via menu -` + * how to toggle contact via menu` ) type model struct { @@ -91,7 +93,7 @@ func newModel(username, homeDir string) model { connState: offline, - menuBar: []string{"STATUS", "P1", "P2"}, + menuBar: []string{"STATUS"}, menuState: 0, input: input, @@ -370,7 +372,7 @@ func (m model) View() string { var renderedCmdHelp []string cmdHelp := []string{ "CTRL+N/P", "SWITCH PROFILE", - "CTRL+U/D", "SCROLL UP/DOWN", + "CTRL+J/K", "SCROLL UP/DOWN", "CTRL+L", "CLEAR", "CTRL+C", "EXIT", } diff --git a/render.go b/render.go index ce94c78..fe32838 100644 --- a/render.go +++ b/render.go @@ -30,8 +30,8 @@ func newViewport(width, height int) viewport.Model { viewp.KeyMap = viewport.KeyMap{ PageDown: key.NewBinding(key.WithKeys("pgdown")), PageUp: key.NewBinding(key.WithKeys("pgup")), - HalfPageUp: key.NewBinding(key.WithKeys("ctrl+u")), - HalfPageDown: key.NewBinding(key.WithKeys("ctrl+d")), + HalfPageUp: key.NewBinding(key.WithKeys("ctrl+k")), + HalfPageDown: key.NewBinding(key.WithKeys("ctrl+j")), } return viewp }