Skip to content

Commit

Permalink
Ensure that the model is updated when a window resize is processed.
Browse files Browse the repository at this point in the history
  • Loading branch information
knz committed Nov 4, 2022
1 parent 3113f03 commit 784087a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func (d *driver) processTeaMsgs(trace bool) {
fmt.Fprintf(&d.result, "TEA PRINT: %v\n", msg)
case szType:
fmt.Fprintf(&d.result, "TEA WINDOW SIZE: %v\n", msg)
// Window size is also visible to the model.
newM, newCmd := d.m.Update(msg)
d.m = newM
d.addCmds(newCmd)
case quitType:
fmt.Fprintf(&d.result, "TEA QUIT\n")
case execType:
Expand Down
1 change: 1 addition & 0 deletions testdata/simple
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ run
resize 80 25
----
TEA WINDOW SIZE: {80 25}
TEA PRINT: {MODEL UPDATE}
-- view:
MODEL VIEW🛇

Expand Down
1 change: 1 addition & 0 deletions testdata/window_size
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ run
----
TEA PRINT: {MODEL INIT}
TEA WINDOW SIZE: {80 25}
TEA PRINT: {MODEL UPDATE}
-- view:
MODEL VIEW🛇

0 comments on commit 784087a

Please sign in to comment.