"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/window.c" between
most-5.0.0a.tar.gz and most-5.1.0.tar.gz

About: most is a textfile paging program (supports multiple windows and can scroll left and right).

window.c  (most-5.0.0a):window.c  (most-5.1.0)
/* /*
This file is part of MOST. This file is part of MOST.
Copyright (c) 1991, 1999, 2002, 2005, 2006, 2007 John E. Davis Copyright (c) 1991, 1999, 2002, 2005-2018, 2019 John E. Davis
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) Software Foundation; either version 2 of the License, or (at your option)
any later version. any later version.
This program is distributed in the hope that it will be useful, but WITHOUT This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details. more details.
skipping to change at line 469 skipping to change at line 469
Most_Curs_Offset = Most_C_Offset; Most_Curs_Offset = Most_C_Offset;
Most_Win->curs_offset = Most_Win->top_offset = Most_Curs_Offset; Most_Win->curs_offset = Most_Win->top_offset = Most_Curs_Offset;
Most_Win->beg_line = Most_C_Line; Most_Win->beg_line = Most_C_Line;
Most_Win->col = Most_Column; Most_Win->col = Most_Column;
Most_Win->curs_col = Most_Curs_Col = 1; Most_Win->curs_col = Most_Curs_Col = 1;
Most_Win->curs_line = Most_Curs_Row = 1; Most_Win->curs_line = Most_Curs_Row = 1;
r = Most_Win->top; r = Most_Win->top;
most_goto_rc (r, 1); most_goto_rc (r, 1);
most_display_line (); most_display_line (1);
while (n--) while (n--)
{ {
r++; r++;
most_goto_rc (r, 1); most_goto_rc (r, 1);
if (most_forward_line(1)) if (most_forward_line(1))
most_display_line(); most_display_line(0);
else else
SLsmg_erase_eol (); SLsmg_erase_eol ();
} }
Most_C_Offset = Most_Win->top_offset; Most_C_Offset = Most_Win->top_offset;
Most_C_Line = Most_Win->beg_line; Most_C_Line = Most_Win->beg_line;
} }
#define MOST_V_OPT 1 #define MOST_V_OPT 1
#define MOST_T_OPT 2 #define MOST_T_OPT 2
skipping to change at line 701 skipping to change at line 701
Most_C_Offset = Most_Win->top_offset; Most_C_Offset = Most_Win->top_offset;
/* most_set_scroll_region(1,SLtt_Screen_Rows); */ /* most_set_scroll_region(1,SLtt_Screen_Rows); */
update_status1(); update_status1();
/* most_set_scroll_region(Most_Win->top,Most_Win->bot); */ /* most_set_scroll_region(Most_Win->top,Most_Win->bot); */
/* SLsmg_refresh (); */ /* SLsmg_refresh (); */
} }
/* splits window-- no screen update, does not affect scrolling region */ /* splits window-- no screen update, does not affect scrolling region */
int most_split_window (void) int most_split_window (void)
{ {
Most_Window_Type *new, *old; Most_Window_Type *neew;
int b2,t2,b1, line; int b2,t2,b1, line;
b2 = Most_Win->bot; b2 = Most_Win->bot;
b1 = (Most_Win->bot + Most_Win->top) / 2 - 1; b1 = (Most_Win->bot + Most_Win->top) / 2 - 1;
t2 = b1 + 2; t2 = b1 + 2;
if ((b1 == Most_Win->top) || (t2 == b2)) return(0); if ((b1 == Most_Win->top) || (t2 == b2)) return(0);
/* line is top line of new window. */ /* line is top line of new window. */
line = Most_Win->beg_line + t2 - Most_Win->top; line = Most_Win->beg_line + t2 - Most_Win->top;
old = Most_Win;
Most_Win->bot = b1; Most_Win->bot = b1;
new = make_window(t2,b2); neew = make_window(t2,b2);
/* add to ring */ /* add to ring */
Most_Win->next->prev = new; Most_Win->next->prev = neew;
new->next = Most_Win->next; neew->next = Most_Win->next;
new->prev = Most_Win; neew->prev = Most_Win;
Most_Win->next = new; Most_Win->next = neew;
new->beg_line = line; neew->beg_line = line;
new->buf = Most_Buf; neew->buf = Most_Buf;
#if 0 #if 0
/* new window status line is at same position as old */ /* new window status line is at same position as old */
strcpy(new->status,Most_Win->status); strcpy(neew->status,Most_Win->status);
#endif #endif
return(1); return(1);
} }
void most_two_windows() void most_two_windows()
{ {
int line; int line;
Most_Window_Type *nnew, *old; Most_Window_Type *nnew, *old;
if (!most_split_window()) return; if (!most_split_window()) return;
skipping to change at line 877 skipping to change at line 876
if (n < 0) if (n < 0)
while (n++) Most_Win = Most_Win->prev; while (n++) Most_Win = Most_Win->prev;
else else
while (n--) Most_Win = Most_Win->next; while (n--) Most_Win = Most_Win->next;
most_set_window(Most_Win); most_set_window(Most_Win);
} }
/* kills window by moving lower window up */ /* kills window by moving lower window up */
static void delete_as_top_window (void) static void delete_as_top_window (void)
{ {
int t1,t2,b1,b2; int t = Most_Win->top;
t1 = Most_Win->top;
t2 = Most_Win->next->top;
b1 = Most_Win->bot;
b2 = Most_Win->next->bot;
Most_Win->prev->next = Most_Win->next; Most_Win->prev->next = Most_Win->next;
Most_Win->next->prev = Most_Win->prev; Most_Win->next->prev = Most_Win->prev;
most_other_window(1); most_other_window(1);
Most_Win->top = t1; Most_Win->top = t;
most_redraw_window(); most_redraw_window();
most_update_status(); most_update_status();
} }
/* free buffer for this window if no other windows are viewing it. */ /* free buffer for this window if no other windows are viewing it. */
void most_free_window_buffer (void) void most_free_window_buffer (void)
{ {
Most_Window_Type *w; Most_Window_Type *w;
Most_Buffer_Type *b; Most_Buffer_Type *b;
skipping to change at line 938 skipping to change at line 934
} }
Most_Buf = NULL; Most_Buf = NULL;
Most_Beg = Most_Eob = NULL; Most_Beg = Most_Eob = NULL;
Most_C_Line = 0; Most_C_Line = 0;
Most_Num_Lines = Most_C_Line = 0; Most_Num_Lines = Most_C_Line = 0;
} }
void most_delete_window (void) void most_delete_window (void)
{ {
int new_b, old_b; int new_b;
Most_Window_Type *w; Most_Window_Type *w;
w = Most_Win; w = Most_Win;
if (Most_Win->next == Most_Win) return; if (Most_Win->next == Most_Win) return;
most_free_window_buffer(); most_free_window_buffer();
if (Most_Win->next != Most_Top_Win) if (Most_Win->next != Most_Top_Win)
{ {
if (Most_Win == Most_Top_Win) if (Most_Win == Most_Top_Win)
{ {
skipping to change at line 961 skipping to change at line 957
} }
else else
delete_as_top_window(); delete_as_top_window();
#if 0 #if 0
SLFREE(w->status); SLFREE(w->status);
#endif #endif
SLFREE(w); SLFREE(w);
return; return;
} }
old_b = Most_Win->top - 2;
new_b = Most_Win->bot; new_b = Most_Win->bot;
most_other_window(-1); most_other_window(-1);
Most_Win->bot = new_b; Most_Win->bot = new_b;
most_redraw_window(); most_redraw_window();
#if 0 #if 0
strcpy(Most_Win->status,w->status); /* share the same line */ strcpy(Most_Win->status,w->status); /* share the same line */
#endif #endif
Most_Win->next = w->next; Most_Win->next = w->next;
skipping to change at line 1007 skipping to change at line 1002
Most_C_Line = Most_Win->beg_line; Most_C_Line = Most_Win->beg_line;
Most_Column = Most_Win->col; Most_Column = Most_Win->col;
restore_win_flags(); restore_win_flags();
n = Most_Win->bot - Most_Win->top; n = Most_Win->bot - Most_Win->top;
check_dirty_flag (); check_dirty_flag ();
t = Most_Win->top; t = Most_Win->top;
most_goto_rc(t, 1); most_goto_rc(t, 1);
most_display_line(); most_display_line(1);
while (n--) while (n--)
{ {
t++; t++;
most_goto_rc (t, 1); most_goto_rc (t, 1);
if (most_forward_line(1)) most_display_line(); if (most_forward_line(1)) most_display_line(0);
} }
Most_C_Line = Most_Win->beg_line; Most_C_Line = Most_Win->beg_line;
Most_C_Offset = Most_Win->top_offset; Most_C_Offset = Most_Win->top_offset;
update_status1(); update_status1();
} }
while(Most_Win != w); while(Most_Win != w);
most_set_window(w); most_set_window(w);
if (Minibuffer_Selected) if (Minibuffer_Selected)
 End of changes. 15 change blocks. 
23 lines changed or deleted 18 lines changed or added

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