Make set_pointer_shapes private

This commit is contained in:
Kovid Goyal
2023-10-17 21:47:03 +05:30
parent 45a98b19c5
commit 6a50af12d3
2 changed files with 19 additions and 18 deletions

View File

@@ -472,22 +472,6 @@ func (self *Loop) ClearPointerShapes() (ans []PointerShape) {
return ans
}
func (self *Loop) SetPointerShapes(ps []PointerShape) {
self.pointer_shapes = ps
if len(ps) > 0 {
s := strings.Builder{}
s.WriteString("\x1b]22;>")
for i, x := range ps {
s.WriteString(x.String())
if i+1 < len(ps) {
s.WriteByte(',')
}
}
s.WriteString("\x1b\\")
self.QueueWriteString(s.String())
}
}
func (self *Loop) CurrentPointerShape() (ans PointerShape, has_shape bool) {
if len(self.pointer_shapes) > 0 {
has_shape = true

View File

@@ -9,6 +9,7 @@ import (
"io"
"os"
"os/signal"
"strings"
"time"
"golang.org/x/sys/unix"
@@ -47,6 +48,22 @@ func kill_self(sig unix.Signal) {
time.Sleep(20 * time.Millisecond)
}
func (self *Loop) set_pointer_shapes(ps []PointerShape) {
self.pointer_shapes = ps
if len(ps) > 0 {
s := strings.Builder{}
s.WriteString("\x1b]22;>")
for i, x := range ps {
s.WriteString(x.String())
if i+1 < len(ps) {
s.WriteByte(',')
}
}
s.WriteString("\x1b\\")
self.QueueWriteString(s.String())
}
}
func (self *Loop) update_screen_size() error {
if self.controlling_term == nil {
return fmt.Errorf("No controlling terminal cannot update screen size")
@@ -388,7 +405,7 @@ func (self *Loop) run() (err error) {
return err
}
write_id = self.QueueWriteString(self.terminal_options.SetStateEscapeCodes())
self.SetPointerShapes(ps)
self.set_pointer_shapes(ps)
needs_reset_escape_codes = true
return self.wait_for_write_to_complete(write_id, self.tty_write_channel, write_done_channel, 2*time.Second)
}
@@ -410,7 +427,7 @@ func (self *Loop) run() (err error) {
return err
}
write_id = self.QueueWriteString(self.terminal_options.SetStateEscapeCodes())
self.SetPointerShapes(ps)
self.set_pointer_shapes(ps)
needs_reset_escape_codes = true
err = self.wait_for_write_to_complete(write_id, self.tty_write_channel, write_done_channel, 2*time.Second)
if err != nil {