Browse files

camptail: notice room changes during grep

Because grep treats the messages as a single stream,
regardless of room, if we are grepping with -A/-B, we may
end up showing unrelated messages from another room.

This has always been the case, and in the context of
matching "recent" messages, it is not that bad.
Conversations from another room might actually be relevant.
But with transcripts, they are almost certainly not, because
we lose all time locality.

And especially when you are grepping, it gives you a bunch
of irrelevant context lines to read through, which is
annoying. So let's just drop it.
  • Loading branch information...
peff committed Apr 6, 2011
1 parent 87474cd commit 8ccf8a75fd01934c261f9022b7db377f6e37ce4d
Showing with 7 additions and 0 deletions.
  1. +7 −0
@@ -152,9 +152,16 @@ sub setup_callback {
my @window;
my $want_after;
my $old_room;
sub grep_message {
my ($message, $room) = @_;
if (!defined $old_room || $old_room->id != $room->id) {
@window = ();
$want_after = 0;
$old_room = $room;
if ($grep_callback->(@_)) {
print_message(@$_) foreach @window;

0 comments on commit 8ccf8a7

Please sign in to comment.