Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

description.truncated_count report column is ignored #65

Closed
desbma opened this issue Jan 30, 2021 · 23 comments · Fixed by #66, #69 or #75
Closed

description.truncated_count report column is ignored #65

desbma opened this issue Jan 30, 2021 · 23 comments · Fixed by #66, #69 or #75
Labels
bug Something isn't working

Comments

@desbma
Copy link
Contributor

desbma commented Jan 30, 2021

My default report has a column with the description.truncated_count format which taskwarrior-tui does not recognize and it removes the column.

Steps to reproduce the behavior:

Modify ~/.taskrc to add description.truncated_count in your default report.

@desbma desbma added the bug Something isn't working label Jan 30, 2021
@kdheepak
Copy link
Owner

Thanks for opening an issue! This was on my todo list for a while now. I've made a new release where this should be fixed! You can find the release here: https://github.com/kdheepak/taskwarrior-tui/releases/tag/v0.9.6.

@desbma
Copy link
Contributor Author

desbma commented Jan 30, 2021

I can confirm it is fixed.

Thanks for the quick fix, you rock!

@kdheepak
Copy link
Owner

I'm glad it solves your problem! It's been something I've been meaning to get to for a while. Feel free to open more issues if you have other problems or feature requests.

@desbma
Copy link
Contributor Author

desbma commented Jan 31, 2021

Actually there is a small bug: the description is always truncated at 23 chars even if terminal is very large, whereas taskwarrior only truncates if description does not fit in the line.

@kdheepak
Copy link
Owner

kdheepak commented Feb 1, 2021

This is not straight forward to fix because of the way taskwarrior-tui renders tables. In taskwarrior-tui all the tables widths are calculated dynamically. In taskwarrior, the description is rendered based on the table width.

I've put in a temporary hack for now, which renders the correct text on the next iteration, meaning if you change the terminal width while taskwarrior is running it'll update in the next cycle. It should solve your problem for now :)

@kdheepak
Copy link
Owner

kdheepak commented Feb 1, 2021

I made a new release where this is fixed: https://github.com/kdheepak/taskwarrior-tui/releases/tag/v0.9.7

@desbma
Copy link
Contributor Author

desbma commented Feb 2, 2021

Unfortunately, it's still not working as expected. The first rendering seems right with the full description, but it quickly vanishes, and the result is excessively truncated :
Selection_2021-02-02_13-07-28

@kdheepak
Copy link
Owner

kdheepak commented Feb 4, 2021

I'm not able to replicate this? Can you share your terminal width? If I'm able to reproduce it I may be able to resolve it.

@desbma
Copy link
Contributor Author

desbma commented Feb 4, 2021

$ echo $COLUMNS
79

EDIT : It does not seem to happen for other larger terminals with size 118 or 215. It didn't test the exact threshold though.

@kdheepak
Copy link
Owner

kdheepak commented Feb 4, 2021

This is a screenshot of a terminal with width 79 and the my task list in a pane of the same width.

Screen Shot 2021-02-04 at 10 15 58 AM

Are you using the latest version? taskwarrior-tui-v0.9.8

If you can share your task list I can try it using that. Alternatively, if you are able to build from source, I can ask you to add a print statement in a couple of places and run it on your machine so that we can debug what is going on.

@desbma
Copy link
Contributor Author

desbma commented Feb 4, 2021

I am using version 0.9.8 (was 0.9.7 previously) and its reproducible.

The last line in your screenshot exhibits the same issue I think, and probably line 7 too. Spacing between columns should be 3 spaces for the line where the spacing is the shortest.

I can help you debug by running a special build if that helps, of course. I won't send you my task list, but if you provide the dummy task list you are using above, we might be able to test the same thing.

@kdheepak
Copy link
Owner

kdheepak commented Feb 4, 2021

The last line in your screenshot exhibits the same issue I think, and probably line 7 too. Spacing between columns should be 3 spaces for the line where the spacing is the shortest.

Sorry, I'm not sure if I'm following.

This is what the taskwarrior's task output is:

Screen Shot 2021-02-04 at 11 13 38 AM

Here's my task list in json form:

[
{"id":1,"description":"тесd","entry":"20200805T071145Z","modified":"20200808T165132Z","status":"pending","uuid":"c490691d-67e1-4bea-92d7-6b9237c54560","urgency":1.00274},
{"id":2,"description":"ähe","entry":"20200808T151946Z","modified":"20200808T165525Z","status":"pending","uuid":"1861bcb6-a199-4bf4-b8b9-d4011749906c","urgency":0.986301},
{"id":3,"description":"Adding task with 😂","entry":"20200808T153128Z","modified":"20200808T153128Z","status":"pending","uuid":"60391ac0-1c29-4ad8-b5c4-b3660422060a","urgency":0.986301},
{"id":4,"description":"ähellasd","entry":"20200808T165250Z","modified":"20200808T165250Z","status":"pending","uuid":"ca22ab2b-8182-4735-b7d7-d47e6fba3e81","urgency":0.986301},
{"id":5,"description":"whatever","entry":"20201010T033113Z","modified":"20201010T033113Z","status":"pending","uuid":"cf7b68e4-1c7b-47ae-9706-65e66b605053","urgency":0.641096},
{"id":6,"description":"Maßnahmen","entry":"20201109T125507Z","modified":"20201109T125507Z","status":"pending","uuid":"4748c6a4-8f98-4bb7-8650-a92c971e17e0","urgency":0.476712},
{"id":7,"description":"tui","entry":"20200713T111226Z","modified":"20200805T053509Z","start":"20200805T053509Z","status":"pending","uuid":"f3151f54-5628-49be-b977-0f9beb6dd1f4","urgency":5.12877},
{"id":8,"description":"new task","entry":"20200804T111805Z","modified":"20200804T111805Z","status":"pending","uuid":"d63bb624-27f6-4ba5-bb3e-9eed3fb6f389","urgency":1.00822},
{"id":9,"description":"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","entry":"20210102T175934Z","modified":"20210102T175934Z","status":"pending","uuid":"30fdbcb9-37b9-44ce-8132-35d912bdd087","urgency":0.180822},
{"id":10,"description":"asddsfsdfsdfdsfdsfdsfdsfsdfsdfsdfafasfasfdsfsdfsdfsdfsdfsdfsdsfdsfsdfsdfds","entry":"20210130T223803Z","modified":"20210130T224450Z","status":"pending","uuid":"1e3b4865-d02f-4d41-8f3f-69b53b88c456","annotations":[{"entry":"20210130T224442Z","description":"dja"},{"entry":"20210130T224450Z","description":"dasd"}],"urgency":0.921918},
{"id":11,"description":"das","entry":"20210130T224447Z","modified":"20210130T224447Z","status":"pending","uuid":"acd790f8-47bd-4bdd-ab34-4614f054c864","urgency":0.0219178},
{"id":0,"description":"gdsds","end":"20201010T033032Z","entry":"20201010T033032Z","modified":"20201010T033032Z","status":"completed","uuid":"a177437b-7ad6-4569-b7eb-f89e9d7fa905","urgency":0.641096},
{"id":0,"description":"gasfsd","end":"20201010T033104Z","entry":"20201010T033104Z","modified":"20201010T033104Z","status":"completed","uuid":"f3a91c08-78ae-4aae-91ba-5c6b17745493","urgency":0.641096},
{"id":0,"description":"gsdfsd","end":"20201010T033105Z","entry":"20201010T033105Z","modified":"20201010T033105Z","status":"completed","uuid":"a0609c14-6f4c-4856-9933-adf0e82a0b6b","urgency":0.641096}
]

@kdheepak
Copy link
Owner

kdheepak commented Feb 4, 2021

There is a issue with the description of task id 9, it is truncated too early. I'll look into that.

@kdheepak kdheepak reopened this Feb 4, 2021
@kdheepak
Copy link
Owner

kdheepak commented Feb 4, 2021

Can you try this release now: https://github.com/kdheepak/taskwarrior-tui/releases/tag/v0.9.9

@desbma
Copy link
Contributor Author

desbma commented Feb 4, 2021

There are still several issues which I will try to describe precisely :

  1. for a terminal of width 94, with the task data imported from your json above, edit task 1 (hit m), then hit any key => crash thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/string.rs:1293:9
  2. for a terminal of width 94, with the task data imported from your json above, add a task with string 000000000000000000000000000000000000000000000000000000000000000000022 the description is then "truncated" to 0000000000000000000000000000000000000000000000000000000000000000000... even though it makes the description one char longer. Tip: you might want to use the unicode char which is a single char wide.
  3. it looks like there is an off by one error somewhere, see in the following screenshot, taskwarrior has a single space char between the description of task 9 and the urgency column, and taskwarrior-tui has 2 for no apparent reason. Fun fact: taskwarrior also has display bug for task 3, I guess it wrongly calculated the length of the unicode char.
    Selection_2021-02-04_21-19-43

@kdheepak
Copy link
Owner

kdheepak commented Feb 4, 2021

Thanks for the detailed description, I'll look into this.

@kdheepak
Copy link
Owner

kdheepak commented Feb 6, 2021

for a terminal of width 94, with the task data imported from your json above, edit task 1 (hit m), then hit any key => crash thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/string.rs:1293:9

I've fixed this in 79951e8. I've also added a better stacktrace when taskwarrior-tui panics in 79f1b9c.

for a terminal of width 94, with the task data imported from your json above, add a task with string 000000000000000000000000000000000000000000000000000000000000000000022 the description is then "truncated" to 0000000000000000000000000000000000000000000000000000000000000000000... even though it makes the description one char longer. Tip: you might want to use the unicode char … which is a single char wide.

Using is a great idea! Thanks for the tip! See cf918a5.

it looks like there is an off by one error somewhere, see in the following screenshot, taskwarrior has a single space char between the description of task 9 and the urgency column, and taskwarrior-tui has 2 for no apparent reason. Fun fact: taskwarrior also has display bug for task 3, I guess it wrongly calculated the length of the unicode char.

After some experimenting, I've changed the width for the table to be more "tight" now: a9fb965

Screen Shot 2021-02-05 at 5 16 37 PM

I think this should do the right thing now. Can you take a look?

@kdheepak
Copy link
Owner

kdheepak commented Feb 6, 2021

I've made a new release here: https://github.com/kdheepak/taskwarrior-tui/releases/tag/v0.9.10.

@desbma
Copy link
Contributor Author

desbma commented Feb 6, 2021

Thanks, all the issues I mentioned above are now fixed.

However, for the spacing fix, I think you changed it for the description column but the issue is still there for some other columns. For example in your screenshot above there are 2 spaces between the Age and Description columns, but only one between ID and Active columns or Active and Age columns.

Another minor nitpick: taskwarrior right aligns number (ie ID) which is prettier IMO.

@kdheepak
Copy link
Owner

kdheepak commented Feb 8, 2021

Thanks for your comments and your nitpicks. I've made more progress on this:

Screen Shot 2021-02-08 at 5 18 04 AM

There is still an issue with the spacing. I think I can make it such that the empty spacing after the last column is also removed. Once I fix that I'll close this issue.

@kdheepak
Copy link
Owner

kdheepak commented Feb 8, 2021

Okay, it should be doing the right thing now!

Screen Shot 2021-02-08 at 5 35 46 AM

@kdheepak
Copy link
Owner

kdheepak commented Feb 8, 2021

@desbma
Copy link
Contributor Author

desbma commented Feb 8, 2021

Works like a charm, thank you very much for the many fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants