vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

term.ui flashes on mouse move

familyfriendlymikey opened this issue · comments

V doctor:

OS: macos, macOS, 12.1, 21C52
Processor: 8 cpus, 64bit, little endian, Apple M1
CC version: Apple clang version 13.0.0 (clang-1300.0.27.3)

getwd: /Users/user/Desktop
vmodules: /Users/user/.vmodules
vroot: /usr/local/Cellar/vlang/0.2.4/libexec
vexe: /usr/local/Cellar/vlang/0.2.4/libexec/v
vexe mtime: 2021-08-30 19:25:14
is vroot writable: true
is vmodules writable: true
V full version: V 0.2.4 b72a2de

Git version: git version 2.30.1 (Apple Git-130)
Git vroot status: Error: fatal: not a git repository (or any of the parent directories): .git
.git/config present: false
thirdparty/tcc: N/A

What did you do?
v -g -o vdbg cmd/v && vdbg test.v

import term.ui as tui

struct App {
    tui &tui.Context = 0

fn event(e &tui.Event, x voidptr) {
    if e.typ == .key_down && e.code == .escape {

fn frame(x voidptr) {
    mut app := &App(x)

    app.tui.set_bg_color(r: 63, g: 81, b: 181)
    app.tui.draw_rect(20, 6, 41, 10)
    app.tui.draw_text(24, 8, 'Hello from V!')
    app.tui.set_cursor_position(0, 0)


fn main() {
    mut app := &App{}
    app.tui = tui.init(
        user_data: app
        event_fn: event
        frame_fn: frame
        hide_cursor: true

What did you expect to see?

A normal TUI.

What did you see instead?

The TUI flashes with what appears to be event information:

�[22;0tV panic: optional not set (not running under a TTY)
v hash: b72a2de
0   test                                0x0000000102d5151a panic_optional_not_set + 138
1   test                                0x0000000102d788cf main__main + 431
2   test                                0x0000000102d79457 main + 39
3   test                                0x0000000102d3e1f4 start + 52
ezoic increase your site revenue