CVS code
+- Changed edit_update call to take arguments TOP, CENTER or BOTTOM.
+ Affects many many functions. Removed functions edit_update_top and
+ edit_update_bot.
- nano.c:
splice_node()
- New function, abstracts linking in nodes. Fixes bug #36.
edit_refresh()
- Added check for current line "running" off the screen.
Hopefully this will not cause any recursive lockups.
+ (Who am I kidding, of course it will!)
+ edit_update()
+ - Rewritten, hopefully this will remove a lot of the
+ scrolling the cursor back and forth needlessly.
- move.c:
page_down()
- - do an edit_update() at last case.
+ - do an edit_update() at last case. Made function more like
+ Pico's version, only move down to two lines before editbot.
+ page_up()
+ - Made function more like Pico's version, only move down to two
+ lines after edittop.
nano-0.9.14 - 07/27/2000
- nano.h:
}
}
if (top->lineno < edittop->lineno)
- edit_update(top);
+ edit_update(top, CENTER);
}
#endif
if (cuttingtoend)
edit_refresh();
else
- edit_update(current);
+ edit_update(current, CENTER);
return 1;
#else
totsize--; /* get the newline */
totlines--;
fileptr->prev = NULL;
- edit_update(fileage);
+ edit_update(fileage, CENTER);
current = fileptr;
} else {
add_to_cutbuffer(fileptr);
current = newend;
if (i <= newend->lineno)
- edit_update(current);
+ edit_update(current, CENTER);
}
/* If marked cut == 2, that means that we're doing a cut to end
i = editbot->lineno;
renumber(newbuf);
if (i < newend->lineno)
- edit_update(fileptr);
+ edit_update(fileptr, CENTER);
dump_buffer_reverse(fileptr);
/* If we've gone off the bottom, recenter, otherwise just redraw */
if (current->lineno > editbot->lineno)
- edit_update(current);
+ edit_update(current, CENTER);
else
edit_refresh();
void page_down_center(void)
{
if (editbot != filebot) {
- edit_update(editbot->next);
+ edit_update(editbot->next, CENTER);
center_cursor();
} else {
while (current != filebot)
current = current->next;
- edit_update(current);
+ edit_update(current, CENTER);
}
update_cursor();
}
if (current == filebot)
return 0;
- if (editbot != filebot) {
+ if (editbot != filebot || edittop == fileage) {
current_y = 0;
- current = editbot;
- edit_update_top(current);
- } else
+ current = editbot;
+
+ if (current->prev != NULL)
+ current = current->prev;
+ if (current->prev != NULL)
+ current = current->prev;
+ edit_update(current, TOP);
+ } else {
while (current != filebot) {
current = current->next;
current_y++;
-
- edit_update(current);
}
+ edit_update(edittop, TOP);
+ }
update_cursor();
UNSET(KEEP_CUTBUFFER);
void page_up_center(void)
{
if (edittop != fileage) {
- edit_update(edittop);
+ edit_update(edittop, CENTER);
center_cursor();
} else
current_y = 0;
int page_up(void)
{
+ filestruct *fileptr = edittop;
wrap_reset();
current_x = 0;
placewewant = 0;
return 0;
current_y = 0;
- edit_update_bot(edittop);
+ if (fileptr->next != NULL)
+ fileptr = fileptr->next;
+ if (fileptr->next != NULL)
+ fileptr = fileptr->next;
+
+ current = edittop;
+ edit_update(fileptr, BOTTOM);
update_cursor();
UNSET(KEEP_CUTBUFFER);
* where we think the cursor is.
*/
if (current_y == editwinrows - 1) {
- edit_update(current);
+ edit_update(current, CENTER);
reset_cursor();
} else {
current_y++;
current_x = i;
placewewant = xplustabs();
if (current->lineno >= editbot->lineno)
- edit_update(current);
+ edit_update(current, CENTER);
}
/* totsize++; */
renumber(inptr);
- edit_update_top(edittop);
+ edit_update(edittop, TOP);
/* Move the cursor to the new line if appropriate. */
do_right();
}
- edit_update_top(edittop);
+ edit_update(edittop, TOP);
reset_cursor();
edit_refresh();
}
free_filestruct(fileage);
global_init();
open_file(temp, 0, 1);
- edit_update(fileage);
+ edit_update(fileage, CENTER);
set_modified();
exit_spell(temp, foo);
statusbar(_("Finished checking spelling"));
fix_editbot();
if (current_y > editwinrows - 1) {
- edit_update(editbot);
+ edit_update(editbot, CENTER);
}
erase();
if ((current_y < 0) || (current_y >= editwinrows - 1)
|| (initial_y <= 0)) {
- edit_update(current);
+ edit_update(current, CENTER);
center_cursor();
} else {
fix_editbot();
if (startline > 0)
do_gotoline(startline);
else
- edit_update(fileage);
+ edit_update(fileage, CENTER);
#ifdef HAVE_TABSIZE
if (usrtabsize > 0)
#define VIEW 1
#define NOVIEW 0
+#define TOP 2
+#define CENTER 1
+#define BOTTOM 0
#endif
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-07-28 10:15-0400\n"
+"POT-Creation-Date: 2000-07-29 00:38-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgstr ""
#: global.c:282 global.c:301 global.c:311 global.c:327 global.c:331
-#: global.c:337 winio.c:1002
+#: global.c:337 winio.c:975
msgid "Cancel"
msgstr ""
msgid "Modified"
msgstr ""
-#: winio.c:918
+#: winio.c:891
#, c-format
msgid "Moved to (%d, %d) in edit buffer\n"
msgstr ""
-#: winio.c:929
+#: winio.c:902
#, c-format
msgid "current->data = \"%s\"\n"
msgstr ""
-#: winio.c:972
+#: winio.c:945
#, c-format
msgid "I got \"%s\"\n"
msgstr ""
-#: winio.c:997
+#: winio.c:970
msgid "Yes"
msgstr ""
-#: winio.c:999
+#: winio.c:972
msgid "All"
msgstr ""
-#: winio.c:1001
+#: winio.c:974
msgid "No"
msgstr ""
-#: winio.c:1137
+#: winio.c:1110
#, c-format
msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
msgstr ""
-#: winio.c:1141
+#: winio.c:1114
msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
msgstr ""
-#: winio.c:1265
+#: winio.c:1238
msgid "Dumping file buffer to stderr...\n"
msgstr ""
-#: winio.c:1267
+#: winio.c:1240
msgid "Dumping cutbuffer to stderr...\n"
msgstr ""
-#: winio.c:1269
+#: winio.c:1242
msgid "Dumping a buffer to stderr...\n"
msgstr ""
void dump_buffer(filestruct * inptr);
void align(char **strp);
void edit_refresh(void);
-void edit_update(filestruct * fileptr);
-void edit_update_top(filestruct * fileptr);
-void edit_update_bot(filestruct * fileptr);
+void edit_update(filestruct * fileptr, int topmidbot);
void update_cursor(void);
void delete_node(filestruct * fileptr);
void set_modified(void);
current_x++;
if (past_editbot)
- edit_update(current);
+ edit_update(current, CENTER);
reset_cursor();
} else { /* We're at EOF, go back to the top, once */
for (tmp = fileptr->data; tmp != found; tmp++)
current_x++;
- edit_update(current);
+ edit_update(current, CENTER);
reset_cursor();
if (!quiet)
current = begin;
current_x = beginx;
renumber_all();
- edit_update(current);
+ edit_update(current, CENTER);
print_replaced(numreplaced);
replace_abort();
return 1;
if (!strcmp(answer, "$")) {
current = filebot;
current_x = 0;
- edit_update(current);
+ edit_update(current, CENTER);
goto_abort();
return 1;
}
filebot->lineno);
current = filebot;
current_x = 0;
- edit_update(current);
+ edit_update(current, CENTER);
} else {
for (fileptr = fileage; fileptr != NULL && i < line; i++)
fileptr = fileptr->next;
current = fileptr;
current_x = 0;
- edit_update(current);
+ edit_update(current, CENTER);
}
goto_abort();
current = fileage;
placewewant = 0;
current_x = 0;
- edit_update(current);
+ edit_update(current, CENTER);
return 1;
}
current = filebot;
placewewant = 0;
current_x = 0;
- edit_update(current);
+ edit_update(current, CENTER);
return 1;
}
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) {
* 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;
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();
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)