cleanup selected process file list (scrollable now)
authorJulien Desfossez <julien.desfossez@efficios.com>
Thu, 19 Apr 2012 16:13:59 +0000 (12:13 -0400)
committerJulien Desfossez <julien.desfossez@efficios.com>
Thu, 19 Apr 2012 16:13:59 +0000 (12:13 -0400)
Signed-off-by: Julien Desfossez <julien.desfossez@efficios.com>
src/cursesdisplay.c

index af09cb2df1280a7bb1292d988ad052ca83998c84..b9429db70708bfaa4e30382f4206fbac9b3bb9c1 100644 (file)
@@ -418,6 +418,7 @@ void update_cputop_display()
                        nblinedisplayed < max_center_lines; i++) {
                tmp = g_ptr_array_index(data->process_table, i);
 
+               /* FIXME : random segfault here */
                if (process_selected(tmp)) {
                        wattron(center, COLOR_PAIR(6));
                        mvwhline(center, current_line + header_offset, 1, ' ', COLS-3);
@@ -494,6 +495,7 @@ void update_process_details()
        struct files *file_tmp;
        int i, j = 0;
        char unit[4];
+       char filename_buf[COLS];
 
        set_window_title(center, "Process details");
 
@@ -535,7 +537,8 @@ void update_process_details()
        mvwprintw(center, 8, 24, "FILENAME");
        wattroff(center, A_BOLD);
 
-       for (i = 0; i < tmp->process_files_table->len; i++) {
+       for (i = selected_line; i < tmp->process_files_table->len &&
+                       i < (selected_line + max_center_lines - 7); i++) {
                file_tmp = get_file(tmp, i);
                if (file_tmp != NULL) {
                        mvwprintw(center, 9 + j, 1, "%d", i);
@@ -543,7 +546,8 @@ void update_process_details()
                        mvwprintw(center, 9 + j, 10, "%s", unit);
                        scale_unit(file_tmp->write, unit);
                        mvwprintw(center, 9 + j, 17, "%s", unit);
-                       mvwprintw(center, 9 + j, 24, "%s", file_tmp->name);
+                       snprintf(filename_buf, COLS - 25, "%s", file_tmp->name);
+                       mvwprintw(center, 9 + j, 24, "%s", filename_buf);
                        j++;
                }
        }
This page took 0.02528 seconds and 4 git commands to generate.