fix problems with the marking highlight's being drawn improperly in some
cases git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1564 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
0362c58b37
commit
4dcd070cdf
|
@ -145,6 +145,9 @@ CVS code -
|
||||||
titlebar()
|
titlebar()
|
||||||
- Fix problem with the available space for a filename on the
|
- Fix problem with the available space for a filename on the
|
||||||
titlebar's being short by one. (DLR)
|
titlebar's being short by one. (DLR)
|
||||||
|
edit_add()
|
||||||
|
- Fix problems with the marking highlight's being drawn
|
||||||
|
improperly in some cases. (DLR)
|
||||||
edit_update()
|
edit_update()
|
||||||
- Tweak for efficiency and remove the fix_editbot() call. (David
|
- Tweak for efficiency and remove the fix_editbot() call. (David
|
||||||
Benbennick)
|
Benbennick)
|
||||||
|
|
26
src/winio.c
26
src/winio.c
|
@ -1277,15 +1277,33 @@ void edit_add(const filestruct *fileptr, const char *converted,
|
||||||
if (bot->lineno > fileptr->lineno || bot_x > endpos)
|
if (bot->lineno > fileptr->lineno || bot_x > endpos)
|
||||||
bot_x = endpos;
|
bot_x = endpos;
|
||||||
|
|
||||||
/* the selected bit of fileptr is on this page */
|
/* The selected bit of fileptr is on this page. */
|
||||||
if (top_x < endpos && bot_x > startpos) {
|
if (top_x < endpos && bot_x > startpos) {
|
||||||
assert(startpos <= top_x);
|
assert(startpos <= top_x);
|
||||||
x_start = strnlenpt(fileptr->data + startpos, top_x - startpos);
|
|
||||||
|
/* x_start is the expanded location of the beginning of the
|
||||||
|
* mark minus the beginning of the page. */
|
||||||
|
x_start = strnlenpt(fileptr->data, top_x) - start;
|
||||||
|
|
||||||
if (bot_x >= endpos)
|
if (bot_x >= endpos)
|
||||||
paintlen = -1; /* Paint everything. */
|
/* If the end of the mark is off the page, paintlen is
|
||||||
|
* -1, meaning that everything on the line gets
|
||||||
|
* painted. */
|
||||||
|
paintlen = -1;
|
||||||
else
|
else
|
||||||
paintlen = strnlenpt(fileptr->data + top_x, bot_x - top_x);
|
/* Otherwise, paintlen is the expanded location of the
|
||||||
|
* end of the mark minus the expanded location of the
|
||||||
|
* beginning of the mark. */
|
||||||
|
paintlen = strnlenpt(fileptr->data, bot_x) - (x_start +
|
||||||
|
start);
|
||||||
|
|
||||||
|
/* If x_start is before the beginning of the page, shift
|
||||||
|
* paintlen x_start characters to compensate, and put
|
||||||
|
* x_start at the beginning of the page. */
|
||||||
|
if (x_start < 0) {
|
||||||
|
paintlen += x_start;
|
||||||
|
x_start = 0;
|
||||||
|
}
|
||||||
|
|
||||||
assert(x_start >= 0 && x_start <= strlen(converted));
|
assert(x_start >= 0 && x_start <= strlen(converted));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue