Skip to content

Commit

Permalink
Fix line splitting logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
maksverver authored and jonls committed Apr 20, 2014
1 parent c65af6e commit 39f8074
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/redshift-gtk/statusicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def child_key_change_cb(self, key, value):
if key == 'Status':
self.change_status(value != 'Disabled')
elif key == 'Color temperature':
self.change_temperature(int(value[:-1], 10))
self.change_temperature(int(value.rstrip('K'), 10))
elif key == 'Period':
self.change_period(value)
elif key == 'Location':
Expand All @@ -308,9 +308,10 @@ def child_data_cb(self, f, cond, data):
ib.buf += os.read(f, 256).decode('utf-8')

# Split input at line break
sep = True
while sep != '':
while True:
first, sep, last = ib.buf.partition('\n')
if sep == '':
break
ib.buf = last
ib.lines.append(first)
if stdout:
Expand Down

0 comments on commit 39f8074

Please sign in to comment.