Chris goes berzerk on no sleep
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@150 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
diff --git a/winio.c b/winio.c
index d02fdbc..1270733 100644
--- a/winio.c
+++ b/winio.c
@@ -48,7 +48,7 @@
current = fileage;
placewewant = 0;
current_x = 0;
- edit_update(current);
+ edit_update(current, CENTER);
return 1;
}
@@ -57,7 +57,7 @@
current = filebot;
placewewant = 0;
current_x = 0;
- edit_update(current);
+ edit_update(current, CENTER);
return 1;
}
@@ -839,8 +839,8 @@
temp = temp->next;
lines++;
}
- if (!currentcheck) /* Then current has run off the screen... */
-/* edit_update(current) */ ;
+ if (!currentcheck) /* Then current has run off the screen... */
+ edit_update(current, CENTER);
if (lines <= editwinrows - 1)
while (lines <= editwinrows - 1) {
@@ -857,7 +857,7 @@
* Nice generic routine to update the edit buffer given a pointer to the
* file struct =)
*/
-void edit_update(filestruct * fileptr)
+void edit_update(filestruct * fileptr, int topmidbot)
{
int i = 0;
filestruct *temp;
@@ -866,10 +866,14 @@
return;
temp = fileptr;
- while (i <= editwinrows / 2 && temp->prev != NULL) {
- i++;
- temp = temp->prev;
- }
+ if (topmidbot == 2)
+ ;
+ else if (topmidbot == 0)
+ for (i = 0; i <= editwinrows - 1 && temp->prev != NULL; i++)
+ temp = temp->prev;
+ else
+ for (i = 0; i <= editwinrows / 2 && temp->prev != NULL; i++)
+ temp = temp->prev;
edittop = temp;
fix_editbot();
@@ -877,37 +881,6 @@
edit_refresh();
}
-/* Now we want to update the screen using this struct as the top of the edit buffer */
-void edit_update_top(filestruct * fileptr)
-{
- int i;
- filestruct *temp = fileptr;
-
- if (fileptr == NULL)
- return;
-
- i = 0;
- while (i <= editwinrows / 2 && temp->next != NULL) {
- i++;
- temp = temp->next;
- }
- edit_update(temp);
-}
-
-/* And also for the bottom... */
-void edit_update_bot(filestruct * fileptr)
-{
- int i;
- filestruct *temp = fileptr;
-
- i = 0;
- while (i <= editwinrows / 2 - 1 && temp->prev != NULL) {
- i++;
- temp = temp->prev;
- }
- edit_update(temp);
-}
-
/* This function updates current based on where current_y is, reset_cursor
does the opposite */
void update_cursor(void)