Skip to content

Conversation

LabibUF
Copy link

@LabibUF LabibUF commented Oct 2, 2025

No description provided.

Copy link
Collaborator

@djmitche djmitche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, but some comments below.

It would be great to have a test for this new functionality, too, just to prevent regressing it.

const size_t valueWidth = termWidth > approxNameCol ? termWidth - approxNameCol : termWidth;

for (const auto& anno : task.getAnnotations()) {
// first line looks exactly like before: <indent><timestamp><space>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"before" won't mean much to a reader outside the context of this PR -- rephrase to the context of the code

Suggested change
// first line looks exactly like before: <indent><timestamp><space>
// first line looks like <indent><timestamp><space>

Comment on lines +51 to +52
static std::string wrapWithPrefixes(const std::string& text, size_t width,
const std::string& prefixFirst, const std::string& prefixCont) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's existing wrapping support in src/libshared/src/shared.cpp, and I think that could be re-used for this purpose rather than re-implementing it.

Comment on lines +162 to +164
const size_t termWidth = Context::getContext().getWidth();
const size_t approxNameCol = 20; // conservative; covers labels like "Last modified"
const size_t valueWidth = termWidth > approxNameCol ? termWidth - approxNameCol : termWidth;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, this seems a bit of a hack, as it's "guessing" the size of the [Table](https://github.com/GothenburgBitFactory/libshared/blob/master/src/Table.h) column, and wrapping to that length. I suppose if the guess is incorrect you just get some weirdly line-broken text, so not a horrible bug. But maybe we could do better?

If that requires improvements to the libshared repo, that's fine -- it's only used by Taskwarrior and Timewarrior so we can modify it pretty easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants