mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
line archived (not line:hidden). remove some debugging code
This commit is contained in:
@@ -103,7 +103,7 @@ CREATE TABLE line (
|
||||
ephemeral boolean NOT NULL,
|
||||
contentheight int NOT NULL,
|
||||
star int NOT NULL,
|
||||
hidden boolean NOT NULL,
|
||||
archived boolean NOT NULL,
|
||||
PRIMARY KEY (sessionid, windowid, lineid)
|
||||
);
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ func init() {
|
||||
registerCmdFn("line", LineCommand)
|
||||
registerCmdFn("line:show", LineShowCommand)
|
||||
registerCmdFn("line:star", LineStarCommand)
|
||||
registerCmdFn("line:hide", LineHideCommand)
|
||||
registerCmdFn("line:archive", LineArchiveCommand)
|
||||
registerCmdFn("line:purge", LinePurgeCommand)
|
||||
|
||||
registerCmdFn("_history", HistoryCommand)
|
||||
@@ -1781,13 +1781,13 @@ func LineStarCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sst
|
||||
return sstore.ModelUpdate{Line: lineObj}, nil
|
||||
}
|
||||
|
||||
func LineHideCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.UpdatePacket, error) {
|
||||
func LineArchiveCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.UpdatePacket, error) {
|
||||
ids, err := resolveUiIds(ctx, pk, R_Session|R_Screen|R_Window)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(pk.Args) == 0 {
|
||||
return nil, fmt.Errorf("/line:hide requires an argument (line number or id)")
|
||||
return nil, fmt.Errorf("/line:archive requires an argument (line number or id)")
|
||||
}
|
||||
lineArg := pk.Args[0]
|
||||
lineId, err := sstore.FindLineIdByArg(ctx, ids.SessionId, ids.WindowId, lineArg)
|
||||
@@ -1797,17 +1797,17 @@ func LineHideCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sst
|
||||
if lineId == "" {
|
||||
return nil, fmt.Errorf("line %q not found", lineArg)
|
||||
}
|
||||
shouldHide := true
|
||||
shouldArchive := true
|
||||
if len(pk.Args) >= 2 {
|
||||
shouldHide = resolveBool(pk.Args[1], true)
|
||||
shouldArchive = resolveBool(pk.Args[1], true)
|
||||
}
|
||||
err = sstore.SetLineHiddenById(ctx, lineId, shouldHide)
|
||||
err = sstore.SetLineArchivedById(ctx, lineId, shouldArchive)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("/line:hide error updating hidden status: %v", err)
|
||||
return nil, fmt.Errorf("/line:archive error updating hidden status: %v", err)
|
||||
}
|
||||
lineObj, err := sstore.GetLineById(ctx, lineId)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("/line:star error getting line: %v", err)
|
||||
return nil, fmt.Errorf("/line:archive error getting line: %v", err)
|
||||
}
|
||||
if lineObj == nil {
|
||||
// no line (which is strange given we checked for it above). just return a nop.
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"github.com/scripthaus-dev/sh2-server/pkg/remote"
|
||||
)
|
||||
|
||||
// PTERM=WxH,Wx25
|
||||
// PTERM="Wx25!"
|
||||
// PTERM=MxM,Mx25
|
||||
// PTERM="Mx25!"
|
||||
// PTERM=80x25,80x35
|
||||
|
||||
type PTermOptsType struct {
|
||||
|
||||
@@ -525,7 +525,6 @@ func DoCompGen(ctx context.Context, cmdStr utilfn.StrWithPos, compCtx CompContex
|
||||
words := shparse.Tokenize(cmdStr.Str)
|
||||
cmds := shparse.ParseCommands(words)
|
||||
compPos := shparse.FindCompletionPos(cmds, cmdStr.Pos)
|
||||
fmt.Printf("comppos: %v\n", compPos)
|
||||
if compPos.CompType == shparse.CompTypeInvalid {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package shparse
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/scripthaus-dev/sh2-server/pkg/utilfn"
|
||||
@@ -278,7 +277,6 @@ func (cpos CompletionPos) Extend(origStr utilfn.StrWithPos, extensionStr string,
|
||||
compWord = MakeEmptyWord(WordTypeLit, nil, cpos.RawPos, true)
|
||||
}
|
||||
realOffset := compWord.Offset + cpos.SuperOffset
|
||||
fmt.Printf("cpos-extend: %d[%s] ext[%s] cword[%v] off:%d super:%d real:%d\n", len([]rune(origStr.Str)), origStr, extensionStr, compWord, compWord.Offset, cpos.SuperOffset, realOffset)
|
||||
if strings.HasSuffix(extensionStr, "/") {
|
||||
extensionComplete = false
|
||||
}
|
||||
|
||||
+5
-5
@@ -687,8 +687,8 @@ func InsertLine(ctx context.Context, line *LineType, cmd *CmdType) error {
|
||||
query = `SELECT nextlinenum FROM window WHERE sessionid = ? AND windowid = ?`
|
||||
nextLineNum := tx.GetInt(query, line.SessionId, line.WindowId)
|
||||
line.LineNum = int64(nextLineNum)
|
||||
query = `INSERT INTO line ( sessionid, windowid, userid, lineid, ts, linenum, linenumtemp, linelocal, linetype, text, cmdid, ephemeral, contentheight, star, hidden)
|
||||
VALUES (:sessionid,:windowid,:userid,:lineid,:ts,:linenum,:linenumtemp,:linelocal,:linetype,:text,:cmdid,:ephemeral,:contentheight,:star,:hidden)`
|
||||
query = `INSERT INTO line ( sessionid, windowid, userid, lineid, ts, linenum, linenumtemp, linelocal, linetype, text, cmdid, ephemeral, contentheight, star, archived)
|
||||
VALUES (:sessionid,:windowid,:userid,:lineid,:ts,:linenum,:linenumtemp,:linelocal,:linetype,:text,:cmdid,:ephemeral,:contentheight,:star,:archived)`
|
||||
tx.NamedExecWrap(query, line)
|
||||
query = `UPDATE window SET nextlinenum = ? WHERE sessionid = ? AND windowid = ?`
|
||||
tx.ExecWrap(query, nextLineNum+1, line.SessionId, line.WindowId)
|
||||
@@ -1741,10 +1741,10 @@ func GetLineById(ctx context.Context, lineId string) (*LineType, error) {
|
||||
return rtn, nil
|
||||
}
|
||||
|
||||
func SetLineHiddenById(ctx context.Context, lineId string, hidden bool) error {
|
||||
func SetLineArchivedById(ctx context.Context, lineId string, archived bool) error {
|
||||
txErr := WithTx(ctx, func(tx *TxWrap) error {
|
||||
query := `UPDATE line SET hidden = ? WHERE lineid = ?`
|
||||
tx.ExecWrap(query, hidden, lineId)
|
||||
query := `UPDATE line SET archived = ? WHERE lineid = ?`
|
||||
tx.ExecWrap(query, archived, lineId)
|
||||
return nil
|
||||
})
|
||||
return txErr
|
||||
|
||||
@@ -590,7 +590,7 @@ type LineType struct {
|
||||
Ephemeral bool `json:"ephemeral,omitempty"`
|
||||
ContentHeight int64 `json:"contentheight,omitempty"`
|
||||
Star bool `json:"star,omitempty"`
|
||||
Hidden bool `json:"hidden,omitempty"`
|
||||
Archived bool `json:"archived,omitempty"`
|
||||
Remove bool `json:"remove,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user