disable buggy cursor move in windows
This commit is contained in:
parent
8689d712a3
commit
a99601668a
11
ui.go
11
ui.go
@ -9,6 +9,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -497,6 +498,14 @@ func (ui *ui) loadFile(nav *nav) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func moveCursor(y, x int) {
|
||||||
|
// TODO: implement for windows
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Printf("\033[%d;%dH", y, x)
|
||||||
|
}
|
||||||
|
|
||||||
func (ui *ui) draw(nav *nav) {
|
func (ui *ui) draw(nav *nav) {
|
||||||
fg, bg := termbox.ColorDefault, termbox.ColorDefault
|
fg, bg := termbox.ColorDefault, termbox.ColorDefault
|
||||||
|
|
||||||
@ -566,7 +575,7 @@ func (ui *ui) draw(nav *nav) {
|
|||||||
|
|
||||||
if ui.cmdpref == "" {
|
if ui.cmdpref == "" {
|
||||||
// leave the cursor at the beginning of the current file for screen readers
|
// leave the cursor at the beginning of the current file for screen readers
|
||||||
fmt.Printf("\033[%d;%dH", ui.wins[woff+length-1].y+nav.dirs[doff+length-1].pos+1, ui.wins[woff+length-1].x+1)
|
moveCursor(ui.wins[woff+length-1].y+nav.dirs[doff+length-1].pos+1, ui.wins[woff+length-1].x+1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user