X-Git-Url: http://cgit.babelmonkeys.de/?p=jubjub.git;a=blobdiff_plain;f=src%2Fgui%2Fcli%2FJubCLIChatUI.m;h=19e3629c87f21c4d1b42005724cf5019023495a9;hp=5803ba75589c0ca95cc383cbf15164ea495b944f;hb=74bc901b59ed844b3308224b7acdb78a9446d27a;hpb=1a38d433f22f577feb4007160d7a591b00518c9f diff --git a/src/gui/cli/JubCLIChatUI.m b/src/gui/cli/JubCLIChatUI.m index 5803ba7..19e3629 100644 --- a/src/gui/cli/JubCLIChatUI.m +++ b/src/gui/cli/JubCLIChatUI.m @@ -1,6 +1,8 @@ #import "JubCLIChatUI.h" #import "JubCLIColor.h" +#import "linenoise.h" + @implementation JubCLIChatUI - initWithTitle: (OFString*)title closeBlock: (jub_close_block_t)closeBlock @@ -10,6 +12,7 @@ @try { _sendBlock = [sendBlock copy]; + _title = [title copy]; } @catch (id e) { [self release]; @throw e; @@ -21,17 +24,23 @@ - (void)dealloc { [_sendBlock release]; + [_title release]; [super dealloc]; } - (void)addMessage: (OFString*)text sender: (OFString*)sender { - [of_stdout writeFormat: BOLD("%@:") @" %@\n", sender, text]; + [of_stdout writeString: @"\r" COL_IN(@"-> ")]; + [of_stdout writeFormat: BOLD(@"%@:") @" %@\n", sender, text]; + [[Linenoise sharedLinenoise] refreshLine]; } - (void)send: (OFString*)text { + [of_stdout writeString: @"\033[1A" COL_OUT(@"<- ")]; + [of_stdout writeFormat: BOLD(@"%@:") @" %@\n", _title, text]; + _sendBlock(text); } @end