Skip to content

Commit

Permalink
Fix broken git hook and the formatting it missed
Browse files Browse the repository at this point in the history
And tidy up logic for exit adding docs
  • Loading branch information
andydotxyz committed May 6, 2020
1 parent 68d0757 commit a3e84c1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cmd/fyneterm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ func main() {
setupListener(t, w)
w.SetContent(fyne.NewContainerWithLayout(layout.NewMaxLayout(), bg, img, t))
w.Canvas().AddShortcut(&desktop.CustomShortcut{
KeyName: fyne.KeyD,
KeyName: fyne.KeyD,
Modifier: desktop.ControlModifier,
}, func (_ fyne.Shortcut) {
t.Close()
}, func(_ fyne.Shortcut) {
t.Exit()
})

cellSize := guessCellSize()
Expand Down
4 changes: 2 additions & 2 deletions output.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (t *Terminal) handleOutput(buf []byte) {
if r == '\t' { // TODO handle tab
r = ' '
}

cellStyle := &widget.CustomTextGridStyle{FGColor: currentFG, BGColor: currentBG}

for len(t.content.Rows[t.cursorRow].Cells)-1 < t.cursorCol {
Expand All @@ -123,7 +123,7 @@ func (t *Terminal) handleOutput(buf []byte) {

// record progress for next chunk of buffer
if state.esc != noEscape {
state.esc = -1-(len(state.code))
state.esc = -1 - (len(state.code))
previous = state
}
}
Expand Down
12 changes: 9 additions & 3 deletions term.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,14 @@ func (t *Terminal) open() error {
return nil
}

func (t *Terminal) Close() {
t.pty.Write([]byte("exit\n"))
// Exit requests that this terminal exits.
// If there are embedded shells it will exit the child one only.
func (t *Terminal) Exit() {
_, _ = t.pty.Write([]byte("exit\n"))
}

func (t *Terminal) close() error {
return t.pty.Close()
}

// don't call often - should we cache?
Expand Down Expand Up @@ -151,7 +157,7 @@ func (t *Terminal) Run() error {

t.run()

return t.pty.Close()
return t.close()
}

// NewTerminal sets up a new terminal instance with the bash shell
Expand Down

0 comments on commit a3e84c1

Please sign in to comment.