Commit cbab273a authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

in edit_draw(), simplify the setting of paintlen

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3833 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 19 additions and 24 deletions
+19 -24
...@@ -178,6 +178,8 @@ CVS code - ...@@ -178,6 +178,8 @@ CVS code -
display_string() display_string()
- Properly handle buf[start_index]'s being a null terminator. - Properly handle buf[start_index]'s being a null terminator.
(DLR) (DLR)
edit_draw()
- Simplify the setting of paintlen. (DLR)
titlebar() titlebar()
- Don't display overly long filenames with ellipses if the - Don't display overly long filenames with ellipses if the
number of columns is extremely small. (DLR) number of columns is extremely small. (DLR)
......
...@@ -2504,19 +2504,16 @@ void edit_draw(const filestruct *fileptr, const char *converted, int ...@@ -2504,19 +2504,16 @@ void edit_draw(const filestruct *fileptr, const char *converted, int
endmatch.rm_eo <= startpos)) endmatch.rm_eo <= startpos))
goto step_two; goto step_two;
/* Now paint the start of fileptr. */ /* Now paint the start of fileptr. If the start of
if (end_line != fileptr) * fileptr is on a different line from the end,
/* If the start of fileptr is on a different * paintlen is -1, meaning that everything on the
* line from the end, paintlen is -1, meaning * line gets painted. Otherwise, paintlen is the
* that everything on the line gets painted. */ * expanded location of the end of the match minus
paintlen = -1; * the expanded location of the beginning of the
else * page. */
/* Otherwise, paintlen is the expanded location paintlen = (end_line != fileptr) ? -1 :
* of the end of the match minus the expanded actual_x(converted, strnlenpt(fileptr->data,
* location of the beginning of the page. */ endmatch.rm_eo) - start);
paintlen = actual_x(converted,
strnlenpt(fileptr->data,
endmatch.rm_eo) - start);
mvwaddnstr(edit, line, 0, converted, paintlen); mvwaddnstr(edit, line, 0, converted, paintlen);
...@@ -2635,17 +2632,13 @@ void edit_draw(const filestruct *fileptr, const char *converted, int ...@@ -2635,17 +2632,13 @@ void edit_draw(const filestruct *fileptr, const char *converted, int
* mark minus the beginning of the page. */ * mark minus the beginning of the page. */
x_start = strnlenpt(fileptr->data, top_x) - start; x_start = strnlenpt(fileptr->data, top_x) - start;
if (bot_x >= endpos) /* If the end of the mark is off the page, paintlen is -1,
/* If the end of the mark is off the page, paintlen is * meaning that everything on the line gets painted.
* -1, meaning that everything on the line gets * Otherwise, paintlen is the expanded location of the end
* painted. */ * of the mark minus the expanded location of the beginning
paintlen = -1; * of the mark. */
else paintlen = (bot_x >= endpos) ? -1 : strnlenpt(fileptr->data,
/* Otherwise, paintlen is the expanded location of the bot_x) - (x_start + start);
* 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 /* If x_start is before the beginning of the page, shift
* paintlen x_start characters to compensate, and put * paintlen x_start characters to compensate, and put
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment