"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scrollback.c" between
multitail-6.4.2.tgz and multitail-6.5.0.tgz

About: multitail lets you view one or multiple files like the original tail program.

scrollback.c  (multitail-6.4.2.tgz):scrollback.c  (multitail-6.5.0.tgz)
skipping to change at line 22 skipping to change at line 22
#include "mt.h" #include "mt.h"
#include "error.h" #include "error.h"
#include "my_pty.h" #include "my_pty.h"
#include "utils.h" #include "utils.h"
#include "term.h" #include "term.h"
#include "help.h" #include "help.h"
#include "mem.h" #include "mem.h"
#include "ui.h" #include "ui.h"
#include "misc.h" #include "misc.h"
#include "globals.h" #include "globals.h"
#include "xclip.h" #include "clipboard.h"
int scrollback_search_to_new_window(buffer *pbuf, char *org_title, char *find_st r, mybool_t case_insensitive); int scrollback_search_to_new_window(buffer *pbuf, char *org_title, char *find_st r, mybool_t case_insensitive);
int find_string(buffer *pbuf, char *find, int offset, char direction, mybool_t c ase_insensitive) int find_string(buffer *pbuf, char *find, int offset, char direction, mybool_t c ase_insensitive)
{ {
int loop, index = -1, rc; int loop, index = -1, rc;
regex_t regex; regex_t regex;
/* compile the searchstring (which can be a regular expression) */ /* compile the searchstring (which can be a regular expression) */
if ((rc = regcomp(&regex, find, REG_EXTENDED | (case_insensitive == MY_TR UE?REG_ICASE:0)))) if ((rc = regcomp(&regex, find, REG_EXTENDED | (case_insensitive == MY_TR UE?REG_ICASE:0))))
skipping to change at line 214 skipping to change at line 214
{ {
cur_line_meta -> cdef.colorize = old_color_settings; cur_line_meta -> cdef.colorize = old_color_settings;
} }
} }
else /* an empty line */ else /* an empty line */
{ {
/* do nothing */ /* do nothing */
} }
} }
void compute_text_dimensions(int *nlines, int *ncols, char fullscreen)
{
if (fullscreen)
{
*nlines = max_y;
*ncols = max_x;
}
else
{
*nlines = max_y - 6;
*ncols = max_x - 6;
}
}
void create_scrollback_windows(NEWWIN **mywin1, NEWWIN **mywin2, int nlines, int
ncols, char fullscreen)
{
/* Delete existing windows, if any. */
if (*mywin1)
{
delete_popup(*mywin1);
}
if (*mywin2)
{
delete_popup(*mywin2);
}
/* Re-create windows, according to fullscreen flag */
if (fullscreen)
{
*mywin1 = NULL;
*mywin2 = create_popup(max_y, max_x);
scrollok((*mywin2) -> win, FALSE); /* supposed to always return O
K, according to the manpage */
}
else
{
*mywin1 = create_popup(max_y - 4, max_x - 4);
*mywin2 = create_popup(nlines, ncols);
scrollok((*mywin2) -> win, FALSE); /* supposed to always return O
K, according to the manpage */
}
}
int scrollback_do(int window_nr, buffer *pbuf, int *winnrs, char *header) int scrollback_do(int window_nr, buffer *pbuf, int *winnrs, char *header)
{ {
int rc = 0; int rc = 0;
char *find = NULL; char *find = NULL;
NEWWIN *mywin1, *mywin2; char fullscreen = scrollback_fullscreen_default;
int nlines = max_y - 6, ncols = max_x - 6; NEWWIN *mywin1 = NULL, *mywin2 = NULL;
int offset = max(0, pbuf -> curpos - nlines); // FIXME: aantal regels lat
en afhangen van lengte int nlines, ncols;
compute_text_dimensions(&nlines, &ncols, fullscreen);
int offset = max(0, pbuf -> curpos - nlines); /* FIXME: aantal regels lat
en afhangen van lengte */
char redraw = 2; char redraw = 2;
int line_offset = 0; int line_offset = 0;
char show_winnr = default_sb_showwinnr; char show_winnr = default_sb_showwinnr;
mybool_t case_insensitive = re_case_insensitive; mybool_t case_insensitive = re_case_insensitive;
buffer cur_lb; buffer cur_lb;
int loop = 0; int loop = 0;
char fullscreen = 0;
memset(&cur_lb, 0x00, sizeof(cur_lb)); memset(&cur_lb, 0x00, sizeof(cur_lb));
for(loop=0; loop<pbuf -> curpos; loop++) for(loop=0; loop<pbuf -> curpos; loop++)
{ {
if ((pbuf -> be)[loop].Bline == NULL) if ((pbuf -> be)[loop].Bline == NULL)
continue; continue;
cur_lb.be = myrealloc(cur_lb.be, (cur_lb.curpos + 1) * sizeof(buf fered_entry)); cur_lb.be = myrealloc(cur_lb.be, (cur_lb.curpos + 1) * sizeof(buf fered_entry));
cur_lb.be[cur_lb.curpos].pi = (pbuf -> be)[loop].pi; cur_lb.be[cur_lb.curpos].pi = (pbuf -> be)[loop].pi;
skipping to change at line 257 skipping to change at line 303
cur_lb.be[cur_lb.curpos].ts = (pbuf -> be)[loop].ts; cur_lb.be[cur_lb.curpos].ts = (pbuf -> be)[loop].ts;
cur_lb.curpos++; cur_lb.curpos++;
} }
LOG("---\n"); LOG("---\n");
if (global_highlight_str) if (global_highlight_str)
{ {
find = mystrdup(global_highlight_str); find = mystrdup(global_highlight_str);
} }
mywin1 = create_popup(max_y - 4, max_x - 4); create_scrollback_windows(&mywin1, &mywin2, nlines, ncols, fullscreen);
mywin2 = create_popup(nlines, ncols);
scrollok(mywin2 -> win, FALSE); /* supposed to always return OK, accordin
g to the manpage */
for(;;) for(;;)
{ {
int c, uc; int c, uc;
if (redraw == 2) if (redraw == 2)
{ {
int index = 0; int index = 0;
int lines_used = 0; int lines_used = 0;
skipping to change at line 365 skipping to change at line 409
send_to_clipboard(pbuf); send_to_clipboard(pbuf);
} }
else if (c == 'Y') else if (c == 'Y')
{ {
no_linewrap = !no_linewrap; no_linewrap = !no_linewrap;
redraw = 2; redraw = 2;
line_offset = 0; line_offset = 0;
} }
else if (c == KEY_F(9) || c == 23) /* ^w */ else if (c == KEY_F(9) || c == 23) /* ^w */
{ {
if (fullscreen) fullscreen = ! fullscreen;
{
delete_popup(mywin2);
mywin1 = create_popup(max_y - 4, max_x - 4);
mywin2 = create_popup(nlines, ncols);
scrollok(mywin2 -> win, FALSE); /* supposed to al
ways return OK, according to the manpage */
}
else
{
delete_popup(mywin1);
delete_popup(mywin2);
mywin1 = NULL; compute_text_dimensions(&nlines, &ncols, fullscreen);
mywin2 = create_popup(max_y, max_x);
scrollok(mywin2 -> win, FALSE); /* supposed to al
ways return OK, according to the manpage */
}
fullscreen = ! fullscreen; create_scrollback_windows(&mywin1, &mywin2, nlines, ncols , fullscreen);
redraw = 2; redraw = 2;
} }
else if (c == 't') else if (c == 't')
{ {
statistics_menu(); statistics_menu();
} }
else if ((c == KEY_LEFT || c == KEY_BACKSPACE) && no_linewrap) else if ((c == KEY_LEFT || c == KEY_BACKSPACE) && no_linewrap)
{ {
if (line_offset > 0) if (line_offset > 0)
skipping to change at line 439 skipping to change at line 469
} }
else if (c == KEY_RIGHT && no_linewrap) else if (c == KEY_RIGHT && no_linewrap)
{ {
line_offset++; line_offset++;
redraw = 2; redraw = 2;
} }
else if ((c == KEY_UP || else if ((c == KEY_UP ||
c == 'y' || c == 'y' ||
c == 25 || /* ^y */ c == 25 || /* ^y */
c == 'k' || c == 'k' ||
/* c == 11 || *//* ^k */ /* c == 11 || */ /* ^k */
c == 16) /* ^p */ c == 16) /* ^p */
&& (offset > 0 || (!no_linewrap && line_offset > 0))) && (offset > 0 || (!no_linewrap && line_offset > 0)))
{ {
if (no_linewrap) if (no_linewrap)
{ {
offset--; offset--;
} }
else if (line_offset > 0) else if (line_offset > 0)
{ {
line_offset = max(0, line_offset - ncols); line_offset = max(0, line_offset - ncols);
 End of changes. 9 change blocks. 
30 lines changed or deleted 60 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)