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/


_______________________________________________
Weechat-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/weechat-dev

Reply via email to