If parsed data has shortened, overwrite end of line with spaces#1201
Conversation
51b204c to
0196bdc
Compare
|
Hello @simonkerscher i saw your pull request and tried to reproduce it. But unfortunatelly i did not saw a real bug with the current develop branch. Can you explain what is your fault? The line |
f624897 to
9f08a80
Compare
|
Hi @pkess . Apologies for the unclear instructions. I have amended my commit message and quoted code blocks to make sure commands don't get edited by Github directly. Thes bug could easily be replicated by running: Currently, the output is: |
|
Ok, now i was able to reproduce this. But wouldn't it be easier to always write spaces until end of line than remember the old line length? Maybe @hardbyte or @felixdivo can add some comment here |
Codecov Report
@@ Coverage Diff @@
## develop #1201 +/- ##
===========================================
+ Coverage 65.65% 65.89% +0.23%
===========================================
Files 86 86
Lines 8846 8875 +29
===========================================
+ Hits 5808 5848 +40
+ Misses 3038 3027 -11 |
This bug could easily be replicated by running: `python can_viewer.py -c vcan0 -i socketcan -d "123:>BB"` In another terminal send: `cansend vcan0 123#FFFF` Followed by: `cansend vcan0 123#0001`
9f08a80 to
bbecf66
Compare
As this is the last field, I guess we could write spaces until the end of the line. I was trying to follow the approach used for a shortened message in lines 210-217, only overwriting spaces that had changed. |
I think you are looking in the wrong place. Why is there a |
No, the Sending both messages in order, we get |
| self.ids[key]["previous_values_string_length"] = len(values_string) | ||
|
|
||
| if len(values_string) < previousLength: | ||
| values_string += " " * (previousLength - len(values_string)) |
There was a problem hiding this comment.
| values_string += " " * (previousLength - len(values_string)) | |
| values_string += " " * (self.x- len(values_string)) |
Wouldn't it be easier to fill all available space? Then you don't have to keep track of line length.
I didn't test this.
There was a problem hiding this comment.
I have included this suggestion, but have kept saving the length of the values_string to enable testing this behaviour.
as suggedted by @zariiii9003
|
@zariiii9003 Can we merge this? |
If parsed data has shortened, overwrite end of line with spaces
This bug could easily be replicated by running:
python can_viewer.py -c vcan0 -i socketcan -d "123:>BB"In another terminal send:
cansend vcan0 123#FFFFFollowed by:
cansend vcan0 123#0001