jcs
/amend
/amendments
/57
browser+committer: Use a null caretHook on read-only TextEdits
This allows us to still use TEActivate to get proper highlighting but
without showing an errant, sometimes blinking cursor.
jcs made amendment 57 over 2 years ago
--- browser.c Sat Jan 22 12:35:00 2022
+++ browser.c Thu Feb 3 16:39:41 2022
@@ -167,6 +167,7 @@ browser_init(struct repo *repo)
TETabWidth = settings.tabwidth;
TEAutoView(true, browser->diff_te);
TETabEnable(browser->diff_te);
+ (*(browser->diff_te))->caretHook = NullCaretHook;
TEActivate(browser->diff_te);
/* scrollbar for diff text */
--- committer.c Sat Jan 22 12:34:31 2022
+++ committer.c Thu Feb 3 16:38:11 2022
@@ -52,7 +52,7 @@ void diff_finish(void);
void
committer_init(struct browser *browser)
{
- char title[256], filename[256];
+ Str255 title, filename;
struct committer *committer;
Rect bounds = { 0 }, te_bounds = { 0 };
TextStyle style;
@@ -69,10 +69,10 @@ committer_init(struct browser *browser)
bounds.right = screenBits.bounds.right - 1 - (padding / 2);
bounds.bottom = screenBits.bounds.bottom - 1 - (padding / 2);
- memcpy(filename, browser->repo->bile->filename, 255);
+ memcpy(filename, browser->repo->bile->filename, sizeof(filename));
PtoCstr(filename);
- snprintf(title, sizeof(title), "%s: %s: diff", PROGRAM_NAME,
- (browser->repo ? filename : "No repo open"));
+ snprintf((char *)&title, sizeof(title), "%s: %s: diff",
+ PROGRAM_NAME, (browser->repo ? (char *)filename : "No repo open"));
committer->win = NewWindow(0L, &bounds, CtoPstr(title), false,
noGrowDocProc, (WindowPtr)-1L, true, 0);
@@ -97,7 +97,8 @@ committer_init(struct browser *browser)
TESetStyle(doFont | doSize, &style, false, committer->log_te);
TEAutoView(true, committer->log_te);
TETabEnable(committer->log_te);
-
+ TEActivate(committer->log_te);
+
/* scrollbar for log message */
bounds.left = bounds.right;
bounds.right += SCROLLBAR_WIDTH;
@@ -118,7 +119,9 @@ committer_init(struct browser *browser)
committer->diff_te = TEStylNew(&te_bounds, &bounds);
TEAutoView(true, committer->diff_te);
TETabEnable(committer->diff_te);
-
+ (*(committer->diff_te))->caretHook = NullCaretHook;
+ TEActivate(committer->diff_te);
+
/* scrollbar for diff */
bounds.left = bounds.right;
bounds.right += SCROLLBAR_WIDTH;
@@ -216,8 +219,10 @@ committer_update(struct committer *committer, EventRec
case activateEvt:
if (event->modifiers & activeFlag) {
TEActivate(committer->log_te);
+ TEActivate(committer->diff_te);
} else {
TEDeactivate(committer->log_te);
+ TEDeactivate(committer->diff_te);
}
break;
}
--- patch.c Tue Jan 11 20:33:45 2022
+++ patch.c Mon Jan 24 16:24:41 2022
@@ -44,7 +44,7 @@ patch_open_source_file(struct repo *repo, char *filena
if (strcmp(repo->files[i]->filename, filename) != 0)
continue;
- memcpy(&pfilename, filename, sizeof(pfilename));
+ memcpy(pfilename, filename, sizeof(pfilename));
CtoPstr(pfilename);
error = FSOpen(pfilename, repo->bile->vrefnum, &ret);
@@ -135,7 +135,7 @@ patch_process(struct repo *repo, Str255 filename, shor
tofilename[0] = '\0';
for (i = 0; i < linelen; i++) {
if (line[i] == '\0' || line[i] == '\t') {
- memcpy(&tofilename, line, i);
+ memcpy(tofilename, line, i);
tofilename[i + 1] = '\0';
break;
}
--- repo.c Sat Jan 22 08:11:49 2022
+++ repo.c Mon Jan 24 17:17:15 2022
@@ -45,7 +45,7 @@ repo_open(AppFile *file)
if (file) {
reply.vRefNum = file->vRefNum;
- memcpy(&reply.fName, file->fName, sizeof(reply.fName));
+ memcpy(reply.fName, file->fName, sizeof(reply.fName));
} else {
types[0] = REPO_TYPE;
@@ -65,7 +65,9 @@ repo_open(AppFile *file)
return NULL;
}
+ progress("Verifying repository...");
bile_verify(bile);
+ progress(NULL);
return repo_init(bile, 0);
}