| File src/ui/ui.c changed (mode: 100644) (index 66b56cd04..4ec4d28e3) |
| ... |
... |
static void update_window_lazy(WINDOW *win); |
| 171 |
171 |
static void update_term_size(void); |
static void update_term_size(void); |
| 172 |
172 |
static void update_statusbar_layout(void); |
static void update_statusbar_layout(void); |
| 173 |
173 |
static int are_statusbar_widgets_visible(void); |
static int are_statusbar_widgets_visible(void); |
| 174 |
|
static int get_ruler_width(view_t *view); |
|
|
174 |
|
static int get_ruler_width(void); |
|
175 |
|
static int get_fileview_ruler_width(view_t *view); |
| 175 |
176 |
static char * expand_ruler_macros(view_t *view, const char format[]); |
static char * expand_ruler_macros(view_t *view, const char format[]); |
| 176 |
177 |
static int locate_view(unsigned int id, int *tab_idx, view_t **side); |
static int locate_view(unsigned int id, int *tab_idx, view_t **side); |
| 177 |
178 |
static void switch_panes_content(void); |
static void switch_panes_content(void); |
| |
| ... |
... |
update_statusbar_layout(void) |
| 1539 |
1540 |
getmaxyx(stdscr, screen_y, screen_x); |
getmaxyx(stdscr, screen_y, screen_x); |
| 1540 |
1541 |
|
|
| 1541 |
1542 |
int max_ruler_width = screen_x - INPUT_WIN_WIDTH - 1; |
int max_ruler_width = screen_x - INPUT_WIN_WIDTH - 1; |
| 1542 |
|
int ruler_width = MIN(get_ruler_width(curr_view), max_ruler_width); |
|
|
1543 |
|
int ruler_width = MIN(get_ruler_width(), max_ruler_width); |
| 1543 |
1544 |
/* The minimal start position is 1, not 0, because otherwise the ruler is |
/* The minimal start position is 1, not 0, because otherwise the ruler is |
| 1544 |
1545 |
* hidden by a single-character status bar window. */ |
* hidden by a single-character status bar window. */ |
| 1545 |
1546 |
int fields_pos = screen_x - (INPUT_WIN_WIDTH + ruler_width); |
int fields_pos = screen_x - (INPUT_WIN_WIDTH + ruler_width); |
| |
| ... |
... |
are_statusbar_widgets_visible(void) |
| 1572 |
1573 |
|
|
| 1573 |
1574 |
/* Gets "recommended" width for the ruler. Returns the width. */ |
/* Gets "recommended" width for the ruler. Returns the width. */ |
| 1574 |
1575 |
static int |
static int |
| 1575 |
|
get_ruler_width(view_t *view) |
|
|
1576 |
|
get_ruler_width(void) |
| 1576 |
1577 |
{ |
{ |
| 1577 |
|
char *expanded; |
|
| 1578 |
|
int len; |
|
| 1579 |
|
int list_pos; |
|
| 1580 |
|
|
|
| 1581 |
1578 |
if(vle_mode_is(VIEW_MODE)) |
if(vle_mode_is(VIEW_MODE)) |
| 1582 |
1579 |
{ |
{ |
| 1583 |
1580 |
return modview_get_ruler_width(); |
return modview_get_ruler_width(); |
| |
| ... |
... |
get_ruler_width(view_t *view) |
| 1586 |
1583 |
{ |
{ |
| 1587 |
1584 |
return modmenu_get_ruler_width(); |
return modmenu_get_ruler_width(); |
| 1588 |
1585 |
} |
} |
|
1586 |
|
return get_fileview_ruler_width(curr_view); |
|
1587 |
|
} |
| 1589 |
1588 |
|
|
| 1590 |
|
/* Size must correspond to the "worst case" of the last list item. */ |
|
| 1591 |
|
list_pos = view->list_pos; |
|
|
1589 |
|
/* Computes "recommended" width for a fileview ruler. Returns the width. */ |
|
1590 |
|
static int |
|
1591 |
|
get_fileview_ruler_width(view_t *view) |
|
1592 |
|
{ |
|
1593 |
|
/* Size must correspond to the "worst case" of the last list item. |
|
1594 |
|
* XXX: would be great to avoid modifying view for this. */ |
|
1595 |
|
int list_pos = view->list_pos; |
| 1592 |
1596 |
view->list_pos = (view->list_rows == 0) ? 0 : (view->list_rows - 1); |
view->list_pos = (view->list_rows == 0) ? 0 : (view->list_rows - 1); |
| 1593 |
1597 |
|
|
| 1594 |
|
expanded = expand_ruler_macros(view, cfg.ruler_format); |
|
| 1595 |
|
len = strlen(expanded); |
|
|
1598 |
|
char *expanded = expand_ruler_macros(view, cfg.ruler_format); |
|
1599 |
|
int len = strlen(expanded); |
| 1596 |
1600 |
free(expanded); |
free(expanded); |
| 1597 |
1601 |
|
|
| 1598 |
1602 |
view->list_pos = list_pos; |
view->list_pos = list_pos; |