mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
id 'tab' for current tabid (#891)
This commit is contained in:
parent
5d8fa2e8d9
commit
52cb36bc37
@ -112,7 +112,7 @@ func setTermHtmlMode() {
|
||||
var oidRe = regexp.MustCompile(`^[0-9a-f]{8}$`)
|
||||
|
||||
func validateEasyORef(oref string) error {
|
||||
if oref == "this" {
|
||||
if oref == "this" || oref == "tab" {
|
||||
return nil
|
||||
}
|
||||
if num, err := strconv.Atoi(oref); err == nil && num >= 1 {
|
||||
|
@ -33,6 +33,7 @@ import (
|
||||
)
|
||||
|
||||
const SimpleId_This = "this"
|
||||
const SimpleId_Tab = "tab"
|
||||
|
||||
var SimpleId_BlockNum_Regex = regexp.MustCompile(`^\d+$`)
|
||||
|
||||
@ -160,6 +161,16 @@ func resolveSimpleId(ctx context.Context, data wshrpc.CommandResolveIdsData, sim
|
||||
}
|
||||
return &waveobj.ORef{OType: waveobj.OType_Block, OID: data.BlockId}, nil
|
||||
}
|
||||
if simpleId == SimpleId_Tab {
|
||||
if data.BlockId == "" {
|
||||
return nil, fmt.Errorf("no blockid in request")
|
||||
}
|
||||
tabId, err := wstore.DBFindTabForBlockId(ctx, data.BlockId)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error finding tab: %v", err)
|
||||
}
|
||||
return &waveobj.ORef{OType: waveobj.OType_Tab, OID: tabId}, nil
|
||||
}
|
||||
blockNum, err := strconv.Atoi(simpleId)
|
||||
if err == nil {
|
||||
tabId, err := wstore.DBFindTabForBlockId(ctx, data.BlockId)
|
||||
|
Loading…
Reference in New Issue
Block a user