1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Removed horizontal paging

This commit is contained in:
James Booth 2014-07-18 22:28:49 +01:00
parent 32527eb766
commit 2a435cd3de
3 changed files with 4 additions and 37 deletions

View File

@ -1951,14 +1951,10 @@ _win_handle_page(const wint_t * const ch)
{
ProfWin *current = wins_get_current();
int rows = getmaxy(stdscr);
int cols = getmaxx(stdscr);
int x = getmaxx(current->win);
int y = getcury(current->win);
int page_space = rows - 4;
int horiz_page_space = cols;
int *page_start = &(current->y_pos);
int *horiz_page_start = &(current->x_pos);
if (prefs_get_boolean(PREF_MOUSE)) {
MEVENT mouse_event;
@ -1997,34 +1993,8 @@ _win_handle_page(const wint_t * const ch)
}
}
// ctrl+P
if (*ch == 16) {
*horiz_page_start -= horiz_page_space;
// went past beginning, show first page
if (*horiz_page_start < 0)
*horiz_page_start = 0;
current->paged = 1;
win_update_virtual(current);
// ctrl+N
} else if (*ch == 14) {
*horiz_page_start += horiz_page_space;
// only got half a screen, show full screen
if ((x - (*horiz_page_start)) < horiz_page_space)
*horiz_page_start = x - horiz_page_space;
// went past end, show full screen
else if (*horiz_page_start >= x)
*horiz_page_start = x - horiz_page_space;
current->paged = 1;
win_update_virtual(current);
// page up
} else if (*ch == KEY_PPAGE) {
if (*ch == KEY_PPAGE) {
*page_start -= page_space;
// went past beginning, show first page
@ -2051,7 +2021,7 @@ _win_handle_page(const wint_t * const ch)
}
// switch off page if last line visible
if ((y-1) - *page_start == page_space && *horiz_page_start == 0) {
if ((y-1) - *page_start == page_space) {
current->paged = 0;
}
}

View File

@ -46,7 +46,6 @@ win_create(const char * const title, int cols, win_type_t type)
wbkgd(new_win->win, COLOUR_TEXT);
new_win->buffer = buffer_create();
new_win->y_pos = 0;
new_win->x_pos = 0;
new_win->paged = 0;
new_win->unread = 0;
new_win->history_shown = 0;
@ -72,7 +71,7 @@ win_update_virtual(ProfWin *window)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
pnoutrefresh(window->win, window->y_pos, window->x_pos, 1, 0, rows-3, cols-1);
pnoutrefresh(window->win, window->y_pos, 0, 1, 0, rows-3, cols-1);
}
void
@ -85,7 +84,6 @@ win_move_to_end(ProfWin *window)
int size = rows - 3;
window->y_pos = y - (size - 1);
window->x_pos = 0;
if (window->y_pos < 0) {
window->y_pos = 0;
}
@ -428,4 +426,4 @@ win_redraw(ProfWin *window)
ProfBuffEntry e = buffer_yield_entry(window->buffer, i);
win_print(window, e.show_char, e.date_fmt, e.flags, e.attrs, e.from, e.message);
}
}
}

View File

@ -58,7 +58,6 @@ typedef struct prof_win_t {
win_type_t type;
gboolean is_otr;
gboolean is_trusted;
int x_pos;
int y_pos;
int paged;
int unread;