simplify edit_update() so as not to require the fileptr parameter

anymore, since it's set to current in all calls


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1915 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-08-26 18:07:58 +00:00
parent d1322107a5
commit 20b83508f4
5 changed files with 17 additions and 12 deletions

View File

@ -29,6 +29,9 @@ CVS code -
- If there are more than MAIN_VISIBLE shortcuts available, only
register clicks on the first MAIN_VISIBLE shortcuts, since
bottombars() only shows that many shortcuts. (DLR)
edit_update()
- Simplify so as not to require the fileptr parameter anymore,
since it's set to current in all calls. (DLR)
do_yesno()
- Don't bother assigning the value of get_mouseinput() to
anything. Since allow_shortcuts is FALSE, its return value

View File

@ -35,7 +35,7 @@ void do_first_line(void)
placewewant = 0;
current_x = 0;
if (edittop != fileage || need_vertical_update(old_pww))
edit_update(current, TOP);
edit_update(TOP);
}
void do_last_line(void)
@ -46,7 +46,7 @@ void do_last_line(void)
current_x = 0;
if (edittop->lineno + (editwinrows / 2) != filebot->lineno ||
need_vertical_update(old_pww))
edit_update(current, CENTER);
edit_update(CENTER);
}
void do_home(void)

View File

@ -565,7 +565,7 @@ int need_vertical_update(size_t old_pww);
void edit_scroll(updown direction, int nlines);
void edit_redraw(const filestruct *old_current, size_t old_pww);
void edit_refresh(void);
void edit_update(filestruct *fileptr, topmidnone location);
void edit_update(topmidnone location);
int statusq(int allowtabs, const shortcut *s, const char *def,
#ifndef NANO_SMALL
historyheadtype *history_list,

View File

@ -877,7 +877,7 @@ void do_gotoline(int line, bool save_pos)
/* If save_pos is TRUE, don't change the cursor position when
* updating the edit window. */
edit_update(current, save_pos ? NONE : CENTER);
edit_update(save_pos ? NONE : CENTER);
placewewant = 0;
display_main_list();

View File

@ -2897,7 +2897,7 @@ void edit_refresh(void)
* current->lineno = edittop->lineno + editwinrows / 2. Thus
* when it then calls edit_refresh(), there is no danger of
* getting an infinite loop. */
edit_update(current, CENTER);
edit_update(CENTER);
else {
int nlines = 0;
const filestruct *foo = edittop;
@ -2922,20 +2922,22 @@ void edit_refresh(void)
}
}
/* Nice generic routine to update the edit buffer, given a pointer to the
* file struct =) */
void edit_update(filestruct *fileptr, topmidnone location)
/* A nice generic routine to update the edit buffer. */
void edit_update(topmidnone location)
{
if (fileptr == NULL)
filestruct *foo = current;
/* We shouldn't need this check. Yuck. */
if (current == NULL)
return;
if (location != TOP) {
int goal = (location == NONE) ? current_y : editwinrows / 2;
for (; goal > 0 && fileptr->prev != NULL; goal--)
fileptr = fileptr->prev;
for (; goal > 0 && foo->prev != NULL; goal--)
foo = foo->prev;
}
edittop = fileptr;
edittop = foo;
edit_refresh();
}