mirror of
https://github.com/yudai/gotty.git
synced 2025-12-24 03:10:13 +01:00
Simplify title format output procedure
This commit is contained in:
parent
46e33887c4
commit
f72b18052a
9 changed files with 147 additions and 232 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"log"
|
||||
|
|
@ -118,19 +119,14 @@ func (context *clientContext) sendInitialize() error {
|
|||
RemoteAddr: context.request.RemoteAddr,
|
||||
}
|
||||
|
||||
context.writeMutex.Lock()
|
||||
writer, err := context.connection.NextWriter(websocket.TextMessage)
|
||||
if err != nil {
|
||||
titleBuffer := new(bytes.Buffer)
|
||||
if err := context.app.titleTemplate.Execute(titleBuffer, titleVars); err != nil {
|
||||
context.writeMutex.Unlock()
|
||||
return err
|
||||
}
|
||||
writer.Write([]byte{SetWindowTitle})
|
||||
if err = context.app.titleTemplate.Execute(writer, titleVars); err != nil {
|
||||
context.writeMutex.Unlock()
|
||||
if err := context.write(append([]byte{SetWindowTitle}, titleBuffer.Bytes()...)); err != nil {
|
||||
return err
|
||||
}
|
||||
writer.Close()
|
||||
context.writeMutex.Unlock()
|
||||
|
||||
htermPrefs := make(map[string]interface{})
|
||||
for key, value := range context.app.options.Preferences {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue