csi: use osc 1 and 2 instead of L and l for title
cursor: reorder cursor shapes to match tcell
fix: remove log call on unknown ansi code
A virtual terminal widget for tcell
s, err := tcell.NewScreen()
if err != nil {
panic(err)
}
quit := make(chan struct{})
termRedraw := make(chan struct{})
w, h := s.Size()
cmd := exec.Cmd("less", "/etc/hosts")
termWidth, termHeight := w / 2, h / 2
termX, termY := w / 4, h / 4
term := tcellterm.New()
//run command in term
go func() {
term.Run(cmd, termRedraw, termWidth, termHeight)
cmd.Wait()
quit <- struct{}{}
}()
//event loop
go func() {
for {
ev := s.PollEvent()
switch ev := ev.(type) {
case *tcell.EventKey:
//send key events to the terminal
term.Event(ev)
case *tcell.EventResize:
w, h := s.Size()
lh := h / 2
lw := w / 2
//resize event for the terminal
term.Resize(lw, lh)
s.Sync()
}
}
}()
//draw loop
loop:
for {
select {
case <-quit:
break loop
//terminal wants to be redrawn
case <-termRedraw:
}
term.Draw(s, termX, termY)
}
s.Fini()
For general discussion or patches, use the mailing list: ~ghost08/tcell-term@lists.sr.ht.
Anyone can contribute to tcell-term:
Once you are happy with your work, you can create a commit (or several commits). Follow these general rules:
git log --oneline
.Fixes:
trailer with the commit id and its title.There is a great reference for commit messages in the Linux kernel documentation.
Before sending the patch, you should configure your local clone with sane defaults:
git config format.subjectPrefix "PATCH tcell-term"
git config sendemail.to "~ghost08/tcell-term@lists.sr.ht"
And send the patch to the mailing list:
git sendemail --annotate -1
Wait for feedback. Address comments and amend changes to your original commit. Then you should send a v2:
git sendemail --in-reply-to=$first_message_id --annotate -v2 -1