gosmartkeyboard/tools/Editor.md

39 lines
543 B
Markdown
Raw Normal View History

2023-01-22 00:55:58 +00:00
# Input Method Editor
This tool uses your $EDITOR to buffer keystrokes.
2023-01-23 04:59:12 +00:00
``` go
--- /tools/editor/editor.go
package main
import (
"io/ioutil"
"os"
)
// #include <stdlib.h>
//
// void vim() {
// system("vi inputfile");
// }
import "C"
func main() {
var inputFile := "inputFile"
@{get client fifo input file from environment}
C.vim()
data, _ := ioutil.ReadFile(inputFile)
f, err := os.OpenFile(clientFifoInputFile, os.O_WRONLY, 0600)
if err != nil {
panic(err)
}
f.Write(data)
os.Remove(inputFile)
}
---
```