"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/buffer.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).

buffer.c  (most-5.0.0a):buffer.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 215 skipping to change at line 215
if (Most_Show_Wrap_Marker) if (Most_Show_Wrap_Marker)
ncols--; ncols--;
b = most_forward_columns (b, e, ncols); b = most_forward_columns (b, e, ncols);
/* Do not wrap the line if the last character falls on the last column /* Do not wrap the line if the last character falls on the last column
* of the display. * of the display.
*/ */
if (Most_Show_Wrap_Marker) if (Most_Show_Wrap_Marker)
{ {
if (Most_UTF8_Mode == 0) if ((Most_UTF8_Mode == 0) || ((*b & 0x80) == 0))
b1 = b + 1; b1 = b + 1;
else else
b1 = SLutf8_skip_char (b, Most_Eob); b1 = SLutf8_skip_char (b, Most_Eob);
if ((b1 <= e) if ((b1 <= e)
&& (b1 < Most_Eob) && (b1 < Most_Eob))
&& (*b1 == '\n')) {
b = b1; if (*b1 == '\n')
b = b1;
else if ((*b1 == 033) && (Most_V_Opt == 0))
{
unsigned char ch = 033;
b1++;
while ((ch == 033) && (b1 < e) && (b1 < Most_Eob)
&& (0 == most_parse_color_escape (&b1, e, NULL)))
{
b = b1;
ch = *b1++;
}
}
}
} }
return b; return b;
} }
MOST_INT most_forward_line (MOST_INT save) MOST_INT most_forward_line (MOST_INT save)
{ {
MOST_INT m, n; MOST_INT m, n;
unsigned char *p; unsigned char *p;
unsigned char *pmax; unsigned char *pmax;
skipping to change at line 445 skipping to change at line 458
{ {
Most_C_Line = 1; Most_C_Line = 1;
Most_C_Offset = 0; Most_C_Offset = 0;
dir = 1; dir = 1;
} }
else /* from curr back */ else /* from curr back */
{ {
dir = -1; dir = -1;
} }
} }
else if (dif_c > 0) else /* (dif_c > 0) */
{ {
if ((dif_c + dif_b) < 0) /* go from curr */ if ((dif_c + dif_b) < 0) /* go from curr */
{ {
dir = 1; dir = 1;
} }
else else
{ {
Most_C_Line = Most_Num_Lines; Most_C_Line = Most_Num_Lines;
Most_C_Offset = Most_Eob - Most_Beg; Most_C_Offset = Most_Eob - Most_Beg;
dir = -1; dir = -1;
skipping to change at line 498 skipping to change at line 511
ret = Most_C_Line; ret = Most_C_Line;
Most_C_Offset = save_pos; Most_C_Offset = save_pos;
Most_C_Line = save_line; Most_C_Line = save_line;
return(ret); return(ret);
} }
/* given a buffer position, find the line and column */ /* given a buffer position, find the line and column */
void most_find_row_column(unsigned char *pos, MOST_INT *r, MOST_INT *c) void most_find_row_column(unsigned char *pos, MOST_INT *r, MOST_INT *c)
{ {
unsigned char *beg;
unsigned int save_offset; unsigned int save_offset;
MOST_INT save_line; MOST_INT save_line;
if (pos <= Most_Beg) if (pos <= Most_Beg)
{ {
*r = 1; *r = 1;
*c = 1; *c = 1;
return; return;
} }
skipping to change at line 522 skipping to change at line 534
if (Most_B_Opt) if (Most_B_Opt)
{ {
*c = (int) (pos - Most_Beg) - (*r - 1) * 16 + 1; *c = (int) (pos - Most_Beg) - (*r - 1) * 16 + 1;
return; return;
} }
Most_C_Line = *r; Most_C_Line = *r;
Most_C_Offset = pos - Most_Beg; Most_C_Offset = pos - Most_Beg;
/* Now we have found the line it is on so.... */ /* Now we have found the line it is on so.... */
beg = most_beg_of_line(); (void) most_beg_of_line();
*c = 1; *c = 1 + most_apparant_distance (pos);
if (Most_UTF8_Mode)
{
/* FIXME: This should take into account the printable representation
* of the characters.
*/
while ((beg = SLutf8_skip_chars (beg, pos, 1, NULL, 1)) < pos)
*c += 1;
}
else
while (beg++ < pos) *c = *c + 1;
Most_C_Line = save_line; Most_C_Line = save_line;
Most_C_Offset = save_offset; Most_C_Offset = save_offset;
} }
Most_Buffer_Type *most_switch_to_buffer(Most_Buffer_Type *nnew) Most_Buffer_Type *most_switch_to_buffer(Most_Buffer_Type *nnew)
{ {
Most_Buffer_Type *old; Most_Buffer_Type *old;
old = Most_Buf; old = Most_Buf;
Most_Buf = nnew; Most_Buf = nnew;
 End of changes. 6 change blocks. 
19 lines changed or deleted 21 lines changed or added

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