weechat-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Weechat-dev] [task #12775] Display a "day changed" notification when tw


From: Peter Boström
Subject: [Weechat-dev] [task #12775] Display a "day changed" notification when two messages in buffer are on different days
Date: Wed, 21 Aug 2013 12:01:20 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36

Follow-up Comment #3, task #12775 (project weechat):

Suggested display pseudo-code for display which should be ok with corner cases
(any number of lines), if you want some inspiration, this is how I think it
should work to display lines. Totally ignoring how display works at the
moment, feel free to completely ignore:

display() {
  time = now()
  index = buffer.num_lines - 1
  while(!window.full() && index >= 0) {
    line = buffer.lines[index]
    if (time - line.time() >= 1day) {
      window.push_back(day_change(line.time(), time))
      time = line.time()
      continue;
    }
    window.push_back(line)
    --index;
  }
  display window # window.line[0] is bottom of the screen
}

day_change(now, before) {
  from_string = ""
  if (now - before >= 2days) {
    from_string = "from %t" % before.date
  }
  return "Day changed %s to %t" % (from_string, now.date)
}

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/task/?12775>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]