"Fossies" - the Fresh Open Source Software Archive  

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

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

window.c  (most-5.1.0):window.c  (most-5.2.0)
/* /*
This file is part of MOST. This file is part of MOST.
Copyright (c) 1991, 1999, 2002, 2005-2018, 2019 John E. Davis Copyright (c) 1991, 1999, 2002, 2005-2021, 2022 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 51 skipping to change at line 51
#include "display.h" #include "display.h"
#include "most.h" #include "most.h"
#include "sysdep.h" #include "sysdep.h"
#include "file.h" #include "file.h"
#include "line.h" #include "line.h"
char *Most_Global_Msg = "Press `Q' to quit, `H' for help, and SPACE to scroll."; char *Most_Global_Msg = "Press `Q' to quit, `H' for help, and SPACE to scroll.";
Most_Window_Type *Most_Win; Most_Window_Type *Most_Win;
Most_Window_Type *Most_Top_Win; Most_Window_Type *Most_Top_Win;
int Most_Top_Line; /* row number of top window */ MOST_INT Most_Top_Line; /* row number of top window */
int Most_Curs_Row; MOST_INT Most_Curs_Row;
int Most_Curs_Col; MOST_INT Most_Curs_Col;
int Most_Column = 1; MOST_INT Most_Column = 1;
int Most_Restore_Width_To = 0; int Most_Restore_Width_To = 0;
char Most_Mini_Buf[256]; char Most_Mini_Buf[256];
unsigned long Most_Curs_Offset; unsigned long Most_Curs_Offset;
static int Beep_Mini = 0; static int Beep_Mini = 0;
static int Minibuffer_Selected; static int Minibuffer_Selected;
void most_message(char *what, int how) void most_message(char *what, int how)
{ {
strcpy (Most_Mini_Buf,what); strcpy (Most_Mini_Buf,what);
skipping to change at line 307 skipping to change at line 307
} }
void most_check_minibuffer () void most_check_minibuffer ()
{ {
if (*Most_Mini_Buf) most_put_message (); if (*Most_Mini_Buf) most_put_message ();
else else
if (Last_Message != Most_Global_Msg) if (Last_Message != Most_Global_Msg)
put_message_1 (Most_Global_Msg); put_message_1 (Most_Global_Msg);
} }
static int get_scroll(int *line) static int get_scroll(MOST_INT *line)
{ {
/* line is the line we want at the top of the window if possible */ /* line is the line we want at the top of the window if possible */
int dtop, dbot,n,top,bot,wsize; MOST_INT dtop, dbot, n, top, bot, wsize;
top = Most_Win->beg_line; top = Most_Win->beg_line;
wsize = Most_Win->bot - Most_Win->top; /* actually 1 less than window size */ wsize = Most_Win->bot - Most_Win->top; /* actually 1 less than window size */
bot = top + wsize; bot = top + wsize;
if ((*line == 1) && (top == 1)) if ((*line == 1) && (top == 1))
{ {
Most_Curs_Col = Most_Curs_Row = 1; Most_Curs_Col = Most_Curs_Row = 1;
if (Most_C_Offset != 0) if (Most_C_Offset != 0)
{ {
skipping to change at line 383 skipping to change at line 383
{ {
if (Most_Win->dirty_flag == 0) return; if (Most_Win->dirty_flag == 0) return;
Most_Win->dirty_flag = 0; Most_Win->dirty_flag = 0;
/* /*
Most_Num_Lines = most_count_lines (Most_Beg, Most_Eob); Most_Num_Lines = most_count_lines (Most_Beg, Most_Eob);
*/ */
Most_Win->n_lines = Most_Num_Lines; Most_Win->n_lines = Most_Num_Lines;
} }
void most_update_window (int line) void most_update_window (MOST_INT line)
{ {
int save_line, save_col; MOST_INT save_line, save_col;
unsigned long save_offset; unsigned long save_offset;
most_read_to_line (line); most_read_to_line (line);
check_dirty_flag (); check_dirty_flag ();
if (Most_Column != Most_Win->col) if (Most_Column != Most_Win->col)
{ {
if (Most_Column < 1) Most_Column = 1; if (Most_Column < 1) Most_Column = 1;
if (Most_Column != Most_Win->col) if (Most_Column != Most_Win->col)
{ {
skipping to change at line 418 skipping to change at line 418
(void) get_scroll (&line); (void) get_scroll (&line);
most_goto_line (line); most_goto_line (line);
most_redraw_window (); most_redraw_window ();
most_update_status (); most_update_status ();
} }
/* updates current window as well as scroll lock ones */ /* updates current window as well as scroll lock ones */
/* Although current window is update in an absolute fashion, scroll locked /* Although current window is update in an absolute fashion, scroll locked
ones are updated in a relative fashion */ ones are updated in a relative fashion */
void most_update_windows (int line) void most_update_windows (MOST_INT line)
{ {
int dline,flg;
Most_Window_Type *w; Most_Window_Type *w;
MOST_INT dline;
int flg;
if (line == -1) if (line == -1)
{ {
check_dirty_flag (); check_dirty_flag ();
line = Most_Num_Lines; line = Most_Num_Lines;
} }
dline = line - Most_C_Line; dline = line - Most_C_Line;
most_update_window(line); most_update_window(line);
if (!Most_Win->lock) return; if (!Most_Win->lock) return;
skipping to change at line 611 skipping to change at line 612
unsigned int len; unsigned int len;
unsigned int num_chars; unsigned int num_chars;
unsigned int field_width, info_len; unsigned int field_width, info_len;
unsigned char *eob; unsigned char *eob;
int r; int r;
MOST_INT x; MOST_INT x;
eob = Most_Eob; eob = Most_Eob;
#if MOST_HAS_MMAP #if MOST_HAS_MMAP
if (Most_Buf->is_mmaped) if (Most_Buf->is_mmaped)
eob = Most_Beg + Most_Buf->mmap_size; eob = Most_Beg + Most_Buf->mmap_file_size;
#endif #endif
if (eob == Most_Beg) x = 100; if (eob == Most_Beg) x = 100;
else else
{ {
x = Most_C_Offset * 100; x = Most_C_Offset * 100;
x = x / (eob - Most_Beg); x = x / (eob - Most_Beg);
} }
if (Most_C_Line + (Most_Win->bot - Most_Win->top + 1) >= Most_Num_Lines) if (Most_C_Line + (Most_Win->bot - Most_Win->top + 1) >= Most_Num_Lines)
x = 100; x = 100;
/* for files with end of file above the bottom row (due to window manipulatio ns) */ /* for files with end of file above the bottom row (due to window manipulatio ns) */
if (x > 100) x = 100; if (x > 100) x = 100;
sprintf (info, "(" MOST_INT_D_FMT ",%d) " MOST_INT_D_FMT "%%", sprintf (info, "(" MOST_INT_D_FMT "," MOST_INT_D_FMT ")" MOST_INT_D_FMT "%%",
Most_C_Line, Most_Column, x); Most_C_Line, Most_Column, x);
r = Most_Win->bot + 1; r = Most_Win->bot + 1;
most_goto_rc (r,1); most_goto_rc (r,1);
most_tt_reverse_video (); most_tt_reverse_video ();
buf[0] = '-'; buf[0] = '-';
if (Most_Win->lock) buf[1] = '*'; else buf[1] = '-'; if (Most_Win->lock) buf[1] = '*'; else buf[1] = '-';
strcpy (buf + 2, " MOST: "); strcpy (buf + 2, " MOST: ");
skipping to change at line 876 skipping to change at line 877
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 t = Most_Win->top; MOST_INT t = Most_Win->top;
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 = t; Most_Win->top = t;
most_redraw_window(); most_redraw_window();
most_update_status(); most_update_status();
} }
skipping to change at line 980 skipping to change at line 981
SLFREE (w->status); SLFREE (w->status);
#endif #endif
SLFREE(w); SLFREE(w);
most_update_status(); most_update_status();
} }
void most_redraw_display (void) void most_redraw_display (void)
{ {
Most_Window_Type *w; Most_Window_Type *w;
int n,t; MOST_INT n, t;
SLsmg_cls (); SLsmg_cls ();
Last_Message = NULL; Last_Message = NULL;
most_save_win_flags(Most_Win); most_save_win_flags(Most_Win);
w = Most_Win; w = Most_Win;
do do
{ {
Most_Win = Most_Win->next; Most_Win = Most_Win->next;
most_switch_to_buffer(Most_Win->buf); most_switch_to_buffer(Most_Win->buf);
 End of changes. 13 change blocks. 
15 lines changed or deleted 16 lines changed or added

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