summaryrefslogtreecommitdiff
path: root/client/application.go
diff options
context:
space:
mode:
authorcitrons <citrons@mondecitronne.com>2025-06-02 17:38:27 -0500
committercitrons <citrons@mondecitronne.com>2025-06-07 16:02:14 -0500
commit035344054768562bee7db12e02e3bec1c8409210 (patch)
tree8e1c116daa1f3db6ff242b532c9ad87439f57fed /client/application.go
parent5a9d7f9db6212260dd18a45d6279d1377daa5857 (diff)
window history
Diffstat (limited to 'client/application.go')
-rw-r--r--client/application.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/client/application.go b/client/application.go
index fb12717..35f38c8 100644
--- a/client/application.go
+++ b/client/application.go
@@ -17,6 +17,7 @@ type application struct {
cache object.ObjCache
windowCache window.WindowCache
currentWindow window.Location
+ windowHist []window.Location
cmdWindow cmdWindow
prompts []window.Prompt
}
@@ -24,7 +25,7 @@ type application struct {
func newApplication(serverAddress string) *application {
var app application
app.Client = client.New(serverAddress)
- app.currentWindow = app.cmdWindow.Location()
+ app.goTo(app.cmdWindow.Location())
app.cache = object.NewCache(&app)
app.windowCache = window.NewCache()
@@ -68,6 +69,11 @@ func (a *application) OnEvent(cmd proto.Command) {
}
case "delete":
a.cache.Gone(cmd.Target)
+ cl := channelLocation {cmd.Target}
+ if a.windowCache.Get(cl) != nil {
+ a.windowCache.Evict(cl)
+ a.removeFromHistory(cl)
+ }
}
}
@@ -164,7 +170,7 @@ func (a *application) join(channelName string) {
a.Request(proto.NewCmd("join", ch.Id), func(response proto.Command) {
switch response.Kind {
case "ok":
- a.currentWindow = channelLocation {id: ch.Id}
+ a.goTo(channelLocation {id: ch.Id})
case "fail":
if len(response.Args) > 0 {
f := proto.Fail(response.Args[0])
@@ -182,7 +188,7 @@ func (a *application) createChannel(name string) {
case "create":
if len(response.Args) > 0 {
ch := response.Args[0]
- a.currentWindow = channelLocation {id: ch.Id}
+ a.goTo(channelLocation {id: ch.Id})
}
case "fail":
if len(response.Args) > 0 {