se

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

line_count_relative.h (824B)


      1 static char* line_count_relative(struct window_buffer* wb, int y, int lines_left, int minx, int maxx, struct glyph* attr)
      2 {
      3 	static char line[LINE_MAX_LEN];
      4 	int tmp, tmp2, cy;
      5 	fb_offset_to_xy(get_fb(wb), wb->cursor_offset, 0, wb->y_scroll, &tmp, &cy, &tmp2);
      6 
      7 	cy += wb->y_scroll + 1;
      8 	y += wb->y_scroll + 1;
      9 
     10 	if (y == cy) {
     11 		attr->fg = yellow;
     12 		attr->bg = alternate_bg_bright;
     13 		snprintf(line, LINE_MAX_LEN, "%3d ", y);
     14 	} else {
     15 		int tmp_y = y;
     16 		char* offset = line;
     17 		while(tmp_y >= 1000 && offset - line < LINE_MAX_LEN) {
     18 			*offset++ = ' ';
     19 			tmp_y /= 10;
     20 		}
     21 		snprintf(offset, LINE_MAX_LEN - (offset - line), "%3d ", abs(cy - y));
     22 	}
     23 
     24 	return line;
     25 }
     26 
     27 // add with this
     28 // char*(*wb_new_line_draw)(struct window_buffer* wb, int y, int lines_left, int minx, int maxx, struct glyph* attr) = line_count_relative;