#705 bugfix datechange injected under read marker

after #708 was merged, if a date change message is
injected underneath the read marker the read
marker would be one line too low. Now, the read
marker will adjust properly when a date change
message is injected above and below the read
marker.

thanks lorenzhs for spotting that
paste-quickfix
Patrick Melanson 10 years ago
parent ef8d32221b
commit 19c408ba13
  1. 4
      js/handlers.js

@ -50,7 +50,11 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
new_date.setHours(0, 0, 0, 0); new_date.setHours(0, 0, 0, 0);
// Check if the date changed // Check if the date changed
if (old_date.valueOf() !== new_date.valueOf()) { if (old_date.valueOf() !== new_date.valueOf()) {
if (buffer.lastSeen + 1 < buffer.lines.length) {
// if the date change should be injected below the read marker,
// adjust the read marker up to make sure it stays under the read marker
++buffer.lastSeen; ++buffer.lastSeen;
}
var old_date_plus_one = old_date; var old_date_plus_one = old_date;
old_date_plus_one.setDate(old_date.getDate() + 1); old_date_plus_one.setDate(old_date.getDate() + 1);
// it's not always true that a date with time 00:00:00 // it's not always true that a date with time 00:00:00

Loading…
Cancel
Save