tty: add events to parser handling, update comment
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
parent
8caa67d5b3
commit
25d844702f
1 changed files with 24 additions and 3 deletions
27
src/Tty.zig
27
src/Tty.zig
|
@ -134,7 +134,10 @@ pub fn run(
|
|||
const result = try parser.parse(buf[start..n]);
|
||||
start = result.n;
|
||||
// TODO: if we get 0 byte read, copy the remaining bytes to the
|
||||
// beginning of the buffer and read mmore?
|
||||
// beginning of the buffer and read mmore? this should only happen
|
||||
// if we are in the middle of a grapheme at and filled our
|
||||
// buffer. Probably can happen on large pastes so needs to be
|
||||
// implemented but low priority
|
||||
|
||||
const event = result.event orelse continue;
|
||||
switch (event) {
|
||||
|
@ -143,8 +146,26 @@ pub fn run(
|
|||
vx.postEvent(.{ .key_press = key });
|
||||
}
|
||||
},
|
||||
.focus_in => {},
|
||||
.focus_out => {},
|
||||
.focus_in => {
|
||||
if (@hasField(EventType, "focus_in")) {
|
||||
vx.postEvent(.focus_in);
|
||||
}
|
||||
},
|
||||
.focus_out => {
|
||||
if (@hasField(EventType, "focus_out")) {
|
||||
vx.postEvent(.focus_out);
|
||||
}
|
||||
},
|
||||
.paste_start => {
|
||||
if (@hasField(EventType, "paste_start")) {
|
||||
vx.postEvent(.paste_start);
|
||||
}
|
||||
},
|
||||
.paste_end => {
|
||||
if (@hasField(EventType, "paste_end")) {
|
||||
vx.postEvent(.paste_end);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue