Skip to content

Commit 40ca959

Browse files
committed
feat: ✨ tst
1 parent a59d75c commit 40ca959

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fresh-client"
3-
version = "1.1.1"
3+
version = "1.1.2"
44
authors = ["David Frnoch <frnoch@pm.me>"]
55
edition = "2021"
66
repository = "https://github.com/lnxcz/fresh"

client/src/connection.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
use crate::input::Mode;
22
use common::{config::ClientConfig, proto::Sndr, socket::Socket};
3-
use std::net::TcpStream;
3+
use crossterm::event::KeyCode;
4+
use std::{net::TcpStream, time::Instant};
45

56
pub struct State {
67
pub username: String,
78
pub room_name: String,
89
pub mode: Mode,
910
pub buffered_messages: Vec<String>,
11+
pub last_key: Option<(Instant, KeyCode)>,
1012
pub local_address: String,
1113
pub server_address: String,
1214
pub socket: Socket,

client/src/input.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,7 @@ fn input_key(event: event::KeyEvent, screen: &mut Screen, state: &mut State) {
126126
pub fn process_user_typing(screen: &mut Screen, state: &mut State) -> crossterm::Result<bool> {
127127
let mut should_refresh = false;
128128

129-
while event::poll(Duration::default())? {
130-
#[cfg(windows)]
131-
{
132-
use std::io::Write;
133-
std::io::stdout().flush().unwrap();
134-
}
135-
129+
while event::poll(Duration::from_millis(0))? {
136130
let prev_mode = state.mode;
137131

138132
if let Ok(Event::Key(event)) = event::read() {
@@ -149,6 +143,8 @@ pub fn process_user_typing(screen: &mut Screen, state: &mut State) -> crossterm:
149143
write_mode_line(screen, state);
150144
}
151145
should_refresh = true;
146+
147+
break;
152148
}
153149

154150
Ok(should_refresh)

client/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ fn main() {
105105
mode: Mode::Insert,
106106
local_address: String::default(),
107107
buffered_messages: Vec::new(),
108+
last_key: None,
108109
server_address: socket.get_addr().unwrap(),
109110
socket,
110111
cmd: cfg.cmd_char,

server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fresh-server"
3-
version = "1.1.1"
3+
version = "1.1.2"
44
authors = ["David Frnoch <frnoch@pm.me>"]
55
edition = "2021"
66
repository = "https://github.com/lnxcz/fresh"

0 commit comments

Comments
 (0)