mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-20 05:39:52 -07:00
Support completing commands, usernames, and room names (#44)
This commit is contained in:
parent
e3be8c16cb
commit
0ed1d53946
13 changed files with 491 additions and 91 deletions
|
@ -40,7 +40,9 @@ use modalkit::{
|
|||
PositionList,
|
||||
ScrollStyle,
|
||||
WordStyle,
|
||||
WriteFlags,
|
||||
},
|
||||
editing::completion::CompletionList,
|
||||
input::InputContext,
|
||||
widgets::{TermOffset, TerminalCursor, WindowOps},
|
||||
};
|
||||
|
@ -383,10 +385,30 @@ impl WindowOps<IambInfo> for RoomState {
|
|||
}
|
||||
}
|
||||
|
||||
fn close(&mut self, _: CloseFlags, _: &mut ProgramStore) -> bool {
|
||||
// XXX: what's the right closing behaviour for a room?
|
||||
// Should write send a message?
|
||||
true
|
||||
fn close(&mut self, flags: CloseFlags, store: &mut ProgramStore) -> bool {
|
||||
match self {
|
||||
RoomState::Chat(chat) => chat.close(flags, store),
|
||||
RoomState::Space(space) => space.close(flags, store),
|
||||
}
|
||||
}
|
||||
|
||||
fn write(
|
||||
&mut self,
|
||||
path: Option<&str>,
|
||||
flags: WriteFlags,
|
||||
store: &mut ProgramStore,
|
||||
) -> IambResult<EditInfo> {
|
||||
match self {
|
||||
RoomState::Chat(chat) => chat.write(path, flags, store),
|
||||
RoomState::Space(space) => space.write(path, flags, store),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_completions(&self) -> Option<CompletionList> {
|
||||
match self {
|
||||
RoomState::Chat(chat) => chat.get_completions(),
|
||||
RoomState::Space(space) => space.get_completions(),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_cursor_word(&self, style: &WordStyle) -> Option<String> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue