jcs
/amend
/amendments
/6
commit_list: Only draw first line of log message
Fix drawing coordinates to go from the top to fix short cells at the bottom of the list
jcs made amendment 6 over 3 years ago
--- commit_list.c Mon Oct 18 13:13:50 2021
+++ commit_list.c Tue Oct 19 15:10:47 2021
@@ -58,8 +58,8 @@ commit_list_draw_cell(ListHandle theList, Cell theCell
Rect textRect;
char tmp[50];
struct repo_commit *commit = NULL;
- short offset, len, height;
struct tm *ttm = NULL;
+ short offset, len, height;
LGetCell(&commit, &dataLen, theCell, theList);
if (commit == NULL)
@@ -73,29 +73,33 @@ commit_list_draw_cell(ListHandle theList, Cell theCell
EraseRect(&textRect);
InsetRect(&textRect, 4, 4);
+ HLock(commit->log);
+ for (len = 1; len <= commit->log_len; len++) {
+ if ((*(commit->log))[len - 1] == '\r')
+ break;
+ }
+
height = FontHeight(applFont, 9);
- MoveTo(textRect.left, textRect.bottom - height - 1);
TextFace(bold);
TextFont(applFont);
TextSize(9);
-
- HLock(commit->log);
- DrawText(*(commit->log), 0, commit->log_len);
+ MoveTo(textRect.left, textRect.top + 6);
+ DrawText(*(commit->log), 0, len);
HUnlock(commit->log);
ttm = localtime(&commit->date);
sprintf(tmp, "%04d-%02d-%02d %02d:%02d:%02d", ttm->tm_year + 1900,
ttm->tm_mon + 1, ttm->tm_mday, ttm->tm_hour, ttm->tm_min,
ttm->tm_sec);
- MoveTo(textRect.left, textRect.bottom - 1);
+ MoveTo(textRect.left, textRect.top + height + 6);
TextFace(normal);
DrawText(tmp, 0, strlen(tmp));
- MoveTo(textRect.left + 140, textRect.bottom - 1);
+ MoveTo(textRect.left + 140, textRect.top + height + 6);
DrawText(commit->author, 0, strlen(commit->author));
sprintf(tmp, "%d (+), %d (-)", commit->adds, commit->subs);
- MoveTo(textRect.left + 220, textRect.bottom - 1);
+ MoveTo(textRect.left + 220, textRect.top + height + 6);
DrawText(tmp, 0, strlen(tmp));
if (selected)