"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scrollback.c" between
multitail-6.2.1.tgz and multitail-6.4.tgz

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

scrollback.c  (multitail-6.2.1.tgz):scrollback.c  (multitail-6.4.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"
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 225 skipping to change at line 226
int rc = 0; int rc = 0;
char *find = NULL; char *find = NULL;
NEWWIN *mywin1, *mywin2; NEWWIN *mywin1, *mywin2;
int nlines = max_y - 6, ncols = max_x - 6; int nlines = max_y - 6, ncols = max_x - 6;
int offset = max(0, pbuf -> curpos - nlines); // FIXME: aantal regels lat en afhangen van lengte 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; 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 256 skipping to change at line 258
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); mywin1 = create_popup(max_y - 4, max_x - 4);
mywin2 = create_popup(nlines, ncols); mywin2 = create_popup(nlines, ncols);
scrollok(mywin2 -> win, FALSE); /* supposed to always return OK, accordin g to the manpage */ 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;
ui_inverse_on(mywin1); if (mywin1)
mvwprintw(mywin1 -> win, nlines + 1, 1, "%s - %d buffered {
lines", shorten_filename(header, max(24, ncols - 24)), cur_lb.curpos); ui_inverse_on(mywin1);
ui_inverse_off(mywin1); mvwprintw(mywin1 -> win, nlines + 1, 1, "%s - %d
buffered lines", shorten_filename(header, max(24, ncols - 24)), cur_lb.curpos);
if (!no_linewrap) ui_inverse_on(mywin1); ui_inverse_off(mywin1);
mvwprintw(mywin1 -> win, nlines + 1, ncols - 8, "LINEWRAP
"); if (!no_linewrap) ui_inverse_on(mywin1);
if (!no_linewrap) ui_inverse_off(mywin1); mvwprintw(mywin1 -> win, nlines + 1, ncols - 8, "
LINEWRAP");
if (!no_linewrap) ui_inverse_off(mywin1);
}
werase(mywin2 -> win); werase(mywin2 -> win);
if (!no_linewrap && line_offset > 0) if (!no_linewrap && line_offset > 0)
{ {
int temp_line_offset = line_offset; int temp_line_offset = line_offset;
int n_chars_to_display_left = strlen((cur_lb.be)[ offset].Bline) - temp_line_offset; int n_chars_to_display_left = strlen((cur_lb.be)[ offset].Bline) - temp_line_offset;
while(lines_used < nlines && n_chars_to_display_l eft > 0) while(lines_used < nlines && n_chars_to_display_l eft > 0)
{ {
skipping to change at line 335 skipping to change at line 339
if (redraw == 1) if (redraw == 1)
{ {
mydoupdate(); mydoupdate();
redraw = 0; redraw = 0;
} }
c = wait_for_keypress(HELP_SCROLLBACK_HELP, 0, NULL, 1); c = wait_for_keypress(HELP_SCROLLBACK_HELP, 0, NULL, 1);
uc = toupper(c); uc = toupper(c);
if (c == 'q' || uc == 'X' || c == abort_key || c == KEY_CLOSE || c == KEY_EXIT) if (c == 'q' || c == abort_key || c == KEY_CLOSE || c == KEY_EXIT )
{ {
break; break;
} }
else if (c == 'Q' || c == -1) /* Q: close whole stack o f scrollbackwindows, -1: something got closed */ else if (c == 'Q' || c == -1) /* Q: close whole stack o f scrollbackwindows, -1: something got closed */
{ {
rc = -1; rc = -1;
break; break;
} }
else if (c == 20 && winnrs != NULL) /* ^t */ else if (c == 20 && winnrs != NULL) /* ^t */
{ {
show_winnr = 1 - show_winnr; show_winnr = 1 - show_winnr;
redraw = 2; redraw = 2;
} }
else if (c == 'x')
{
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 */
{
if (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;
mywin2 = create_popup(max_y, max_x);
scrollok(mywin2 -> win, FALSE); /* supposed to al
ways return OK, according to the manpage */
}
fullscreen = ! fullscreen;
redraw = 2;
}
else if (c == 't') else if (c == 't')
{ {
statistics_menu(); statistics_menu();
} }
else if ((c == KEY_LEFT || else if ((c == KEY_LEFT || c == KEY_BACKSPACE) && no_linewrap)
c == KEY_BACKSPACE)
&& no_linewrap)
{ {
if (line_offset > 0) if (line_offset > 0)
line_offset--; line_offset--;
redraw = 2; redraw = 2;
} }
else if (c == KEY_SLEFT && no_linewrap) else if (c == KEY_SLEFT && no_linewrap)
{ {
if (line_offset >= (ncols / 2)) if (line_offset >= (ncols / 2))
line_offset -= (ncols / 2); line_offset -= (ncols / 2);
skipping to change at line 695 skipping to change at line 725
toggle_subwindow_nr(); toggle_subwindow_nr();
redraw = 2; /* force redraw */ redraw = 2; /* force redraw */
} }
else else
{ {
wrong_key(); wrong_key();
} }
} }
delete_popup(mywin2); delete_popup(mywin2);
delete_popup(mywin1); if (mywin1)
delete_popup(mywin1);
myfree(find); myfree(find);
delete_be_in_buffer(&cur_lb); delete_be_in_buffer(&cur_lb);
return rc; return rc;
} }
void scrollback(void) void scrollback(void)
{ {
 End of changes. 9 change blocks. 
16 lines changed or deleted 49 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS