Skip to content

Commit bedf386

Browse files
Accept multiple bytes on stdin, to fix cut and paste without delay
1 parent be140f3 commit bedf386

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ pub fn raw_mode_start() !void {
5050
termios.lflag.IEXTEN = false;
5151
termios.lflag.ISIG = false;
5252
termios.cflag.CSIZE = .CS8;
53+
5354
termios.cc[@intFromEnum(std.posix.V.TIME)] = 0;
54-
termios.cc[@intFromEnum(std.posix.V.MIN)] = 1;
55+
termios.cc[@intFromEnum(std.posix.V.MIN)] = 0;
5556

5657
try std.posix.tcsetattr(handle, .FLUSH, termios);
5758

@@ -426,6 +427,7 @@ pub fn commloop(allocator: std.mem.Allocator, conf: *config.Config) !void {
426427
.revents = undefined,
427428
},
428429
};
430+
429431
const ready = try std.posix.poll(&fds, 1000);
430432

431433
if (fds[0].revents != std.posix.POLL.IN and fds[0].revents != 0) {
@@ -448,7 +450,7 @@ pub fn commloop(allocator: std.mem.Allocator, conf: *config.Config) !void {
448450
}
449451
// stdin read
450452
if (fds[1].revents == std.posix.POLL.IN) {
451-
var buf: [1]u8 = undefined;
453+
var buf: [4096]u8 = undefined;
452454
const count = try stdin_reader.readSliceShort(&buf);
453455
if (count > 0) {
454456
handleKeyboardData(conf, serial, buf[0..count]) catch {

0 commit comments

Comments
 (0)