mirror of
https://github.com/fairyglade/ly.git
synced 2026-09-21 19:40:20 +00:00
Fix insert mode hack + fix bugs
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -18,7 +18,7 @@ const Message = struct {
|
||||
fg: u32,
|
||||
};
|
||||
|
||||
label: MessageLabel,
|
||||
label: *MessageLabel,
|
||||
|
||||
pub fn init(
|
||||
allocator: Allocator,
|
||||
@@ -26,9 +26,9 @@ pub fn init(
|
||||
width: usize,
|
||||
arrow_fg: u32,
|
||||
arrow_bg: u32,
|
||||
) InfoLine {
|
||||
) !InfoLine {
|
||||
return .{
|
||||
.label = MessageLabel.init(
|
||||
.label = try MessageLabel.init(
|
||||
allocator,
|
||||
buffer,
|
||||
drawItem,
|
||||
@@ -49,7 +49,7 @@ pub fn deinit(self: *InfoLine) void {
|
||||
pub fn widget(self: *InfoLine) Widget {
|
||||
return Widget.init(
|
||||
"InfoLine",
|
||||
null,
|
||||
self.label.keybinds,
|
||||
self,
|
||||
deinit,
|
||||
null,
|
||||
@@ -91,8 +91,8 @@ fn draw(self: *InfoLine) void {
|
||||
self.label.draw();
|
||||
}
|
||||
|
||||
fn handle(self: *InfoLine, maybe_key: ?keyboard.Key, insert_mode: bool) !void {
|
||||
self.label.handle(maybe_key, insert_mode);
|
||||
fn handle(self: *InfoLine, maybe_key: ?keyboard.Key) !void {
|
||||
self.label.handle(maybe_key);
|
||||
}
|
||||
|
||||
fn drawItem(label: *MessageLabel, message: Message, x: usize, y: usize, width: usize) void {
|
||||
|
||||
@@ -18,7 +18,7 @@ const EnvironmentLabel = CyclableLabel(Env, *UserList);
|
||||
|
||||
const Session = @This();
|
||||
|
||||
label: EnvironmentLabel,
|
||||
label: *EnvironmentLabel,
|
||||
user_list: *UserList,
|
||||
|
||||
pub fn init(
|
||||
@@ -29,9 +29,9 @@ pub fn init(
|
||||
text_in_center: bool,
|
||||
fg: u32,
|
||||
bg: u32,
|
||||
) Session {
|
||||
) !Session {
|
||||
return .{
|
||||
.label = EnvironmentLabel.init(
|
||||
.label = try EnvironmentLabel.init(
|
||||
allocator,
|
||||
buffer,
|
||||
drawItem,
|
||||
@@ -58,7 +58,7 @@ pub fn deinit(self: *Session) void {
|
||||
pub fn widget(self: *Session) Widget {
|
||||
return Widget.init(
|
||||
"Session",
|
||||
null,
|
||||
self.label.keybinds,
|
||||
self,
|
||||
deinit,
|
||||
null,
|
||||
@@ -80,8 +80,8 @@ fn draw(self: *Session) void {
|
||||
self.label.draw();
|
||||
}
|
||||
|
||||
fn handle(self: *Session, maybe_key: ?keyboard.Key, insert_mode: bool) !void {
|
||||
self.label.handle(maybe_key, insert_mode);
|
||||
fn handle(self: *Session, maybe_key: ?keyboard.Key) !void {
|
||||
self.label.handle(maybe_key);
|
||||
}
|
||||
|
||||
fn addedSession(env: Env, user_list: *UserList) void {
|
||||
|
||||
@@ -21,7 +21,7 @@ const UserLabel = CyclableLabel(User, *Session);
|
||||
|
||||
const UserList = @This();
|
||||
|
||||
label: UserLabel,
|
||||
label: *UserLabel,
|
||||
|
||||
pub fn init(
|
||||
allocator: Allocator,
|
||||
@@ -35,7 +35,7 @@ pub fn init(
|
||||
bg: u32,
|
||||
) !UserList {
|
||||
var user_list = UserList{
|
||||
.label = UserLabel.init(
|
||||
.label = try UserLabel.init(
|
||||
allocator,
|
||||
buffer,
|
||||
drawItem,
|
||||
@@ -92,7 +92,7 @@ pub fn deinit(self: *UserList) void {
|
||||
pub fn widget(self: *UserList) Widget {
|
||||
return Widget.init(
|
||||
"UserList",
|
||||
null,
|
||||
self.label.keybinds,
|
||||
self,
|
||||
deinit,
|
||||
null,
|
||||
@@ -111,8 +111,8 @@ fn draw(self: *UserList) void {
|
||||
self.label.draw();
|
||||
}
|
||||
|
||||
fn handle(self: *UserList, maybe_key: ?keyboard.Key, insert_mode: bool) !void {
|
||||
self.label.handle(maybe_key, insert_mode);
|
||||
fn handle(self: *UserList, maybe_key: ?keyboard.Key) !void {
|
||||
self.label.handle(maybe_key);
|
||||
}
|
||||
|
||||
fn usernameChanged(user: User, maybe_session: ?*Session) void {
|
||||
|
||||
Reference in New Issue
Block a user