dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
22.74k stars 380 forks source link

🐛 White space before 2nd, 3rd `k` shouldn't be in highlighted scope #1598

Closed Freed-Wu closed 6 months ago

Freed-Wu commented 9 months ago

Thanks for filing a Delta bug report!

I rename n_file to k:

diff --git a/project-spec/meta-user/recipes-apps/autostart/src/master.c b/project-spec/meta-user/recipes-apps/autostart/src/master.c
index bc2a368..55e4b80 100644
--- a/project-spec/meta-user/recipes-apps/autostart/src/master.c
+++ b/project-spec/meta-user/recipes-apps/autostart/src/master.c
@@ -223,18 +223,21 @@ int main(int argc, char *argv[]) {
   fd_to_epoll_fds(fd, &send_fd, &recv_fd);
   syslog(LOG_NOTICE, "%s: initial successfully, data will be saved to %s",
          opt.tty, opt.out_dir);
+  n_file_t *n_files = malloc(sizeof(n_file_t) * opt.number);
+  for (int k = 0; k < opt.number; k++)
+    n_files[k] = k;

   // send data
   receive_and_drop(recv_fd, TIMEOUT);
   syslog(LOG_NOTICE, "=== send data ===");
   frame_t input_frame, output_frame = {.address = TP_ADDRESS_MASTER};
-  for (n_file_t n_file = 0; n_file < opt.number; n_file++) {
+  for (n_file_t k = 0; k < opt.number; k++) {
     // prepare to send data

Screenshot from 2024-01-06 15-55-03

White space before 2nd, 3rd k shouldn't be in highlighted scope.

phillipwood commented 6 months ago

Looking at the second screenshot I think this is the same issue as #1658 so can be closed. Sorry for opening a duplicate, I didn't notice this one yesterday.

dandavison commented 6 months ago

Great! Closing.