At LONG last committed David's patch
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@912 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
3795e5fc76
commit
2084acc37d
10
ChangeLog
10
ChangeLog
|
@ -4,7 +4,10 @@ CVS Code -
|
||||||
colortoint() and parse_color() in rcfile.c, new code in
|
colortoint() and parse_color() in rcfile.c, new code in
|
||||||
edit_add() in winio.c to actually do the highlighting. It's
|
edit_add() in winio.c to actually do the highlighting. It's
|
||||||
not even close to pretty yet :P
|
not even close to pretty yet :P
|
||||||
|
- Many int/long alignments (David Lawrence Ramsey).
|
||||||
- files.c:
|
- files.c:
|
||||||
|
- Fixes for tab completion and screen refresh (David Lawrence
|
||||||
|
Ramsey).
|
||||||
add_open_file()
|
add_open_file()
|
||||||
- Get rid of unsetting MARK_ISSET because otherwise writing
|
- Get rid of unsetting MARK_ISSET because otherwise writing
|
||||||
marked text will automatically unset the marker with
|
marked text will automatically unset the marker with
|
||||||
|
@ -22,6 +25,11 @@ CVS Code -
|
||||||
we have _POSIX_VDISABLE or not (more Hurd fixes)
|
we have _POSIX_VDISABLE or not (more Hurd fixes)
|
||||||
help_init()
|
help_init()
|
||||||
- Typo fixes and additions to the new help texts.
|
- Typo fixes and additions to the new help texts.
|
||||||
|
do_curpos()
|
||||||
|
- Now takes arg for constant updating to always show the cursor
|
||||||
|
position (David Lawrence Ramsey).
|
||||||
|
do_wrap()
|
||||||
|
- Many fixes (David Lawrence Ramsey).
|
||||||
- po/de.po:
|
- po/de.po:
|
||||||
- German translation updates (Karl Eichwalder).
|
- German translation updates (Karl Eichwalder).
|
||||||
- po/ru.po:
|
- po/ru.po:
|
||||||
|
@ -82,7 +90,7 @@ nano-1.1.3 - 10/26/2001
|
||||||
- Fix incorrect number of rc options (David Lawrence Ramsey).
|
- Fix incorrect number of rc options (David Lawrence Ramsey).
|
||||||
- po/sv.po:
|
- po/sv.po:
|
||||||
- Updated Swedish translation (Christian Rose).
|
- Updated Swedish translation (Christian Rose).
|
||||||
- po/sv.po:
|
- po/da.po:
|
||||||
- Updated Danish translation (Keld Simonsen).
|
- Updated Danish translation (Keld Simonsen).
|
||||||
- po/es.po:
|
- po/es.po:
|
||||||
- Style updates to Spanish translation (Santiago Vila).
|
- Style updates to Spanish translation (Santiago Vila).
|
||||||
|
|
37
files.c
37
files.c
|
@ -380,7 +380,7 @@ int do_insertfile(int loading_file)
|
||||||
that could create them are taken care of elsewhere) */
|
that could create them are taken care of elsewhere) */
|
||||||
add_open_file(1, 0);
|
add_open_file(1, 0);
|
||||||
|
|
||||||
free_filestruct(current);
|
free_filestruct(fileage);
|
||||||
new_file();
|
new_file();
|
||||||
UNSET(MODIFIED);
|
UNSET(MODIFIED);
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,7 @@ int add_open_file(int update, int dup_fix)
|
||||||
{
|
{
|
||||||
filestruct *tmp;
|
filestruct *tmp;
|
||||||
|
|
||||||
if (!current || !filename)
|
if (!fileage || !current || !filename)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* first, if duplicate checking is allowed, do it */
|
/* first, if duplicate checking is allowed, do it */
|
||||||
|
@ -477,8 +477,8 @@ int add_open_file(int update, int dup_fix)
|
||||||
open_files = make_new_node(NULL);
|
open_files = make_new_node(NULL);
|
||||||
|
|
||||||
/* if open_files->file is NULL at the nrealloc() below, we get a
|
/* if open_files->file is NULL at the nrealloc() below, we get a
|
||||||
segfault */
|
segfault
|
||||||
open_files->file = open_files;
|
open_files->file = open_files; */
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!update) {
|
else if (!update) {
|
||||||
|
@ -523,11 +523,9 @@ int add_open_file(int update, int dup_fix)
|
||||||
/* save current line number */
|
/* save current line number */
|
||||||
open_files->lineno = current->lineno;
|
open_files->lineno = current->lineno;
|
||||||
|
|
||||||
/* save current filestruct */
|
/* save current filestruct and restore full file position afterward */
|
||||||
open_files->file = nmalloc(sizeof(filestruct));
|
open_files->file = nmalloc(sizeof(filestruct));
|
||||||
while (current->prev)
|
open_files->file = copy_filestruct(fileage);
|
||||||
current = current->prev;
|
|
||||||
open_files->file = copy_filestruct(current);
|
|
||||||
do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
|
do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
|
||||||
|
|
||||||
/* save current modification status */
|
/* save current modification status */
|
||||||
|
@ -584,6 +582,11 @@ int load_open_file(void)
|
||||||
coordinate, place we want */
|
coordinate, place we want */
|
||||||
do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
|
do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
|
||||||
|
|
||||||
|
/* restore the bottom of the file */
|
||||||
|
filebot = current;
|
||||||
|
while (filebot->next)
|
||||||
|
filebot = filebot->next;
|
||||||
|
|
||||||
/* set up modification status and update the titlebar */
|
/* set up modification status and update the titlebar */
|
||||||
if (open_files->file_modified)
|
if (open_files->file_modified)
|
||||||
SET(MODIFIED);
|
SET(MODIFIED);
|
||||||
|
@ -592,9 +595,11 @@ int load_open_file(void)
|
||||||
clearok(topwin, FALSE);
|
clearok(topwin, FALSE);
|
||||||
titlebar(NULL);
|
titlebar(NULL);
|
||||||
|
|
||||||
/* if we're constantly displaying the cursor position, update it */
|
/* if we're constantly displaying the cursor position, update it (and do so
|
||||||
|
unconditionally, in the rare case that the character count is the same
|
||||||
|
but the line count isn't) */
|
||||||
if (ISSET(CONSTUPDATE))
|
if (ISSET(CONSTUPDATE))
|
||||||
do_cursorpos();
|
do_cursorpos(0);
|
||||||
|
|
||||||
/* now we're done */
|
/* now we're done */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1707,7 +1712,7 @@ char **cwd_tab_completion(char *buf, int *num_matches)
|
||||||
/* This function now has an arg which refers to how much the
|
/* This function now has an arg which refers to how much the
|
||||||
* statusbar (place) should be advanced, i.e. the new cursor pos.
|
* statusbar (place) should be advanced, i.e. the new cursor pos.
|
||||||
*/
|
*/
|
||||||
char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
|
char *input_tab(char *buf, int place, int *lastWasTab, int *newplace, int *list)
|
||||||
{
|
{
|
||||||
/* Do TAB completion */
|
/* Do TAB completion */
|
||||||
static int num_matches = 0, match_matches = 0;
|
static int num_matches = 0, match_matches = 0;
|
||||||
|
@ -1716,6 +1721,8 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
|
||||||
int longestname = 0, is_dir = 0;
|
int longestname = 0, is_dir = 0;
|
||||||
char *foo;
|
char *foo;
|
||||||
|
|
||||||
|
*list = 0;
|
||||||
|
|
||||||
if (*lastWasTab == FALSE) {
|
if (*lastWasTab == FALSE) {
|
||||||
char *tmp, *copyto, *matchBuf;
|
char *tmp, *copyto, *matchBuf;
|
||||||
|
|
||||||
|
@ -1846,7 +1853,7 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
|
||||||
/* Ok -- the last char was a TAB. Since they
|
/* Ok -- the last char was a TAB. Since they
|
||||||
* just hit TAB again, print a list of all the
|
* just hit TAB again, print a list of all the
|
||||||
* available choices... */
|
* available choices... */
|
||||||
if (matches && num_matches > 0) {
|
if (matches && num_matches > 1) {
|
||||||
|
|
||||||
/* Blank the edit window, and print the matches out there */
|
/* Blank the edit window, and print the matches out there */
|
||||||
blank_edit();
|
blank_edit();
|
||||||
|
@ -1895,12 +1902,16 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
|
||||||
}
|
}
|
||||||
free(foo);
|
free(foo);
|
||||||
wrefresh(edit);
|
wrefresh(edit);
|
||||||
|
*list = 1;
|
||||||
} else
|
} else
|
||||||
beep();
|
beep();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
edit_refresh();
|
/* Only refresh the edit window if we don't have a list of filename
|
||||||
|
matches on it */
|
||||||
|
if (*list == 0)
|
||||||
|
edit_refresh();
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
2
global.c
2
global.c
|
@ -363,7 +363,7 @@ void shortcut_init(int unjustify)
|
||||||
|
|
||||||
sc_init_one(&main_list[10], NANO_CURSORPOS_KEY, _("Cur Pos"),
|
sc_init_one(&main_list[10], NANO_CURSORPOS_KEY, _("Cur Pos"),
|
||||||
nano_cursorpos_msg,
|
nano_cursorpos_msg,
|
||||||
0, NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos);
|
0, NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos_void);
|
||||||
|
|
||||||
sc_init_one(&main_list[11], NANO_SPELL_KEY, _("To Spell"),
|
sc_init_one(&main_list[11], NANO_SPELL_KEY, _("To Spell"),
|
||||||
nano_spell_msg, 0, NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
|
nano_spell_msg, 0, NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
|
||||||
|
|
77
nano.c
77
nano.c
|
@ -996,10 +996,18 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||||
down = 1;
|
down = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Subtract length of original line, plus one for the newline, from
|
||||||
|
totsize. */
|
||||||
|
totsize -= (strlen(inptr->data) + 1);
|
||||||
|
|
||||||
temp->data = charalloc(strlen(&inptr->data[current_word_start]) + 1);
|
temp->data = charalloc(strlen(&inptr->data[current_word_start]) + 1);
|
||||||
strcpy(temp->data, &inptr->data[current_word_start]);
|
strcpy(temp->data, &inptr->data[current_word_start]);
|
||||||
inptr->data = nrealloc(inptr->data, last_word_end + 2);
|
inptr->data = nrealloc(inptr->data, last_word_end + 2);
|
||||||
inptr->data[last_word_end + 1] = 0;
|
inptr->data[last_word_end + 1] = 0;
|
||||||
|
|
||||||
|
/* Now add lengths of new lines, plus two for the newlines, to totsize. */
|
||||||
|
totsize += (strlen(inptr->data) + strlen(temp->data) + 2);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
/* Category 1b: one word on the line and word not taking up whole line
|
/* Category 1b: one word on the line and word not taking up whole line
|
||||||
(i.e. there are spaces at the beginning of the line) */
|
(i.e. there are spaces at the beginning of the line) */
|
||||||
|
@ -1011,9 +1019,6 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||||
if (current_x >= current_word_start) {
|
if (current_x >= current_word_start) {
|
||||||
right = current_x - current_word_start;
|
right = current_x - current_word_start;
|
||||||
|
|
||||||
/* Decrease totsize by the number of spaces we removed, less
|
|
||||||
one for the new line we're replacing the spaces with. */
|
|
||||||
totsize -= (current_word_start - 1);
|
|
||||||
current_x = 0;
|
current_x = 0;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
if (ISSET(AUTOINDENT)) {
|
if (ISSET(AUTOINDENT)) {
|
||||||
|
@ -1028,8 +1033,15 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||||
down = 1;
|
down = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Subtract length of original line, plus one for the newline, from
|
||||||
|
totsize. */
|
||||||
|
totsize -= (strlen(inptr->data) + 1);
|
||||||
|
|
||||||
null_at(&inptr->data, current_x);
|
null_at(&inptr->data, current_x);
|
||||||
|
|
||||||
|
/* Now add lengths of new lines, plus two for the newlines, to totsize. */
|
||||||
|
totsize += (strlen(inptr->data) + strlen(temp->data) + 2);
|
||||||
|
|
||||||
if (ISSET(MARK_ISSET) && (mark_beginbuf == inptr)) {
|
if (ISSET(MARK_ISSET) && (mark_beginbuf == inptr)) {
|
||||||
mark_beginbuf = temp;
|
mark_beginbuf = temp;
|
||||||
mark_beginx = 0;
|
mark_beginx = 0;
|
||||||
|
@ -1047,22 +1059,25 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||||
if (!isspace((int) input_char)) {
|
if (!isspace((int) input_char)) {
|
||||||
i = current_word_start - 1;
|
i = current_word_start - 1;
|
||||||
|
|
||||||
/* Decrement totsize each time we remove a space. */
|
|
||||||
while (isspace((int) inptr->data[i])) {
|
while (isspace((int) inptr->data[i])) {
|
||||||
i--;
|
i--;
|
||||||
totsize--;
|
|
||||||
assert(i >= 0);
|
assert(i >= 0);
|
||||||
}
|
}
|
||||||
/* And increment it to account for the blank line we're
|
|
||||||
replacing the spaces with. */
|
|
||||||
totsize++;
|
|
||||||
} else if (current_x <= last_word_end)
|
} else if (current_x <= last_word_end)
|
||||||
i = last_word_end - 1;
|
i = last_word_end - 1;
|
||||||
else
|
else
|
||||||
i = current_x;
|
i = current_x;
|
||||||
|
|
||||||
|
/* Subtract length of original line, plus one for the newline, from
|
||||||
|
totsize. */
|
||||||
|
totsize -= (strlen(inptr->data) + 1);
|
||||||
|
|
||||||
inptr->data = nrealloc(inptr->data, i + 2);
|
inptr->data = nrealloc(inptr->data, i + 2);
|
||||||
inptr->data[i + 1] = 0;
|
inptr->data[i + 1] = 0;
|
||||||
|
|
||||||
|
/* Now add lengths of new lines, plus two for the newlines, to totsize. */
|
||||||
|
totsize += (strlen(inptr->data) + strlen(temp->data) + 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1089,12 +1104,14 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||||
i = current_word_start - 1;
|
i = current_word_start - 1;
|
||||||
current_x = current_word_start;
|
current_x = current_word_start;
|
||||||
|
|
||||||
|
/* Subtract length of original line, plus one for the newline, from
|
||||||
|
totsize. */
|
||||||
|
totsize -= (strlen(inptr->data) + 1);
|
||||||
|
|
||||||
null_at(&inptr->data, current_word_start);
|
null_at(&inptr->data, current_word_start);
|
||||||
|
|
||||||
/* Increment totsize to account for the new line that
|
/* Now add lengths of new lines, plus two for the newlines, to totsize. */
|
||||||
will be added below, so that it won't end up being
|
totsize += (strlen(inptr->data) + strlen(temp->data) + 2);
|
||||||
short by one. */
|
|
||||||
totsize++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1110,17 +1127,20 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||||
current_x = current_word_start;
|
current_x = current_word_start;
|
||||||
i = current_word_start - 1;
|
i = current_word_start - 1;
|
||||||
|
|
||||||
/* Decrement totsize each time we remove a space. */
|
|
||||||
while (isspace((int) inptr->data[i])) {
|
while (isspace((int) inptr->data[i])) {
|
||||||
i--;
|
i--;
|
||||||
totsize--;
|
|
||||||
assert(i >= 0);
|
assert(i >= 0);
|
||||||
inptr->data = nrealloc(inptr->data, i + 2);
|
|
||||||
inptr->data[i + 1] = 0;
|
|
||||||
}
|
}
|
||||||
/* And increment it to account for the blank line we're
|
|
||||||
replacing the spaces with. */
|
/* Subtract length of original line, plus one for the newline, from
|
||||||
totsize++;
|
totsize. */
|
||||||
|
totsize -= (strlen(inptr->data) + 1);
|
||||||
|
|
||||||
|
inptr->data = nrealloc(inptr->data, i + 2);
|
||||||
|
inptr->data[i + 1] = 0;
|
||||||
|
|
||||||
|
/* Now add lengths of new lines, plus two for the newlines, to totsize. */
|
||||||
|
totsize += (strlen(inptr->data) + strlen(temp->data) + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1359,6 +1379,12 @@ int do_delete(void)
|
||||||
{
|
{
|
||||||
filestruct *foo;
|
filestruct *foo;
|
||||||
|
|
||||||
|
/* blbf -> blank line before filebot (see below) */
|
||||||
|
int blbf = 0;
|
||||||
|
|
||||||
|
if (current->next == filebot && !strcmp(current->data, ""))
|
||||||
|
blbf = 1;
|
||||||
|
|
||||||
if (current_x != strlen(current->data)) {
|
if (current_x != strlen(current->data)) {
|
||||||
/* Let's get dangerous */
|
/* Let's get dangerous */
|
||||||
memmove(¤t->data[current_x], ¤t->data[current_x + 1],
|
memmove(¤t->data[current_x], ¤t->data[current_x + 1],
|
||||||
|
@ -1366,9 +1392,11 @@ int do_delete(void)
|
||||||
|
|
||||||
align(¤t->data);
|
align(¤t->data);
|
||||||
|
|
||||||
/* Now that we have a magic lnie again, we can check for both being
|
/* Now that we have a magic line again, we can check for both being
|
||||||
on the line before filebot as well as at filebot */
|
on the line before filebot as well as at filebot; it's a special
|
||||||
} else if (current->next != NULL && current->next != filebot) {
|
case if we're on the line before filebot and it's blank, since we
|
||||||
|
should be able to delete it */
|
||||||
|
} else if (current->next != NULL && (current->next != filebot || blbf)) {
|
||||||
current->data = nrealloc(current->data,
|
current->data = nrealloc(current->data,
|
||||||
strlen(current->data) +
|
strlen(current->data) +
|
||||||
strlen(current->next->data) + 1);
|
strlen(current->next->data) + 1);
|
||||||
|
@ -2611,7 +2639,6 @@ int main(int argc, char *argv[])
|
||||||
int keyhandled; /* Have we handled the keystroke yet? */
|
int keyhandled; /* Have we handled the keystroke yet? */
|
||||||
int i, modify_control_seq;
|
int i, modify_control_seq;
|
||||||
char *argv0;
|
char *argv0;
|
||||||
long constcheck; /* Check to constantly update */
|
|
||||||
|
|
||||||
#ifdef _POSIX_VDISABLE
|
#ifdef _POSIX_VDISABLE
|
||||||
struct termios term;
|
struct termios term;
|
||||||
|
@ -2916,7 +2943,6 @@ int main(int argc, char *argv[])
|
||||||
reset_cursor();
|
reset_cursor();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
constcheck = current->lineno + current_x + current_y + totsize;
|
|
||||||
|
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
currshortcut = main_list;
|
currshortcut = main_list;
|
||||||
|
@ -3227,8 +3253,7 @@ int main(int argc, char *argv[])
|
||||||
if (ISSET(DISABLE_CURPOS))
|
if (ISSET(DISABLE_CURPOS))
|
||||||
UNSET(DISABLE_CURPOS);
|
UNSET(DISABLE_CURPOS);
|
||||||
else if (ISSET(CONSTUPDATE))
|
else if (ISSET(CONSTUPDATE))
|
||||||
if (constcheck != current->lineno + current_x + current_y + totsize)
|
do_cursorpos(1);
|
||||||
do_cursorpos();
|
|
||||||
|
|
||||||
reset_cursor();
|
reset_cursor();
|
||||||
wrefresh(edit);
|
wrefresh(edit);
|
||||||
|
|
8
proto.h
8
proto.h
|
@ -113,13 +113,13 @@ int check_operating_dir(char *currpath, int allow_tabcomp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int do_writeout(char *path, int exiting, int append);
|
int do_writeout(char *path, int exiting, int append);
|
||||||
int do_gotoline(long line, int save_pos);
|
int do_gotoline(int line, int save_pos);
|
||||||
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||||
int wholewords, int *i);
|
int wholewords, int *i);
|
||||||
int do_find_bracket(void);
|
int do_find_bracket(void);
|
||||||
|
|
||||||
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
|
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
|
||||||
void do_gotopos(long line, int pos_x, int pos_y, int pos_placewewant);
|
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Now in move.c */
|
/* Now in move.c */
|
||||||
|
@ -129,7 +129,7 @@ int do_left(void);
|
||||||
int do_right(void);
|
int do_right(void);
|
||||||
int check_wildcard_match(const char *text, const char *pattern);
|
int check_wildcard_match(const char *text, const char *pattern);
|
||||||
|
|
||||||
char *input_tab(char *buf, int place, int *lastWasTab, int *newplace);
|
char *input_tab(char *buf, int place, int *lastWasTab, int *newplace, int *list);
|
||||||
char *real_dir_from_tilde(char *buf);
|
char *real_dir_from_tilde(char *buf);
|
||||||
|
|
||||||
void shortcut_init(int unjustify);
|
void shortcut_init(int unjustify);
|
||||||
|
@ -201,7 +201,7 @@ int load_open_file(void), close_open_file(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int do_page_up(void), do_page_down(void);
|
int do_page_up(void), do_page_down(void);
|
||||||
int do_cursorpos(void), do_spell(void);
|
int do_cursorpos(int constant), do_cursorpos_void(void), do_spell(void);
|
||||||
int do_up(void), do_down (void), do_right(void), do_left (void);
|
int do_up(void), do_down (void), do_right(void), do_left (void);
|
||||||
int do_home(void), do_end(void), total_refresh(void), do_mark(void);
|
int do_home(void), do_end(void), total_refresh(void), do_mark(void);
|
||||||
int do_delete(void), do_backspace(void), do_tab(void), do_justify(void);
|
int do_delete(void), do_backspace(void), do_tab(void), do_justify(void);
|
||||||
|
|
24
search.c
24
search.c
|
@ -289,7 +289,7 @@ filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beg
|
||||||
|
|
||||||
/* We found an instance */
|
/* We found an instance */
|
||||||
current_x_find = found - fileptr->data;
|
current_x_find = found - fileptr->data;
|
||||||
#if 0
|
#if 1
|
||||||
/* Ensure we haven't wrapped around again! */
|
/* Ensure we haven't wrapped around again! */
|
||||||
if ((search_last_line) && (current_x_find >= beginx)) {
|
if ((search_last_line) && (current_x_find >= beginx)) {
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
|
@ -308,7 +308,7 @@ filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beg
|
||||||
search_last_line = 1;
|
search_last_line = 1;
|
||||||
|
|
||||||
/* Make sure we haven't passed the begining of the string */
|
/* Make sure we haven't passed the begining of the string */
|
||||||
#if 0 /* Is this required here ? */
|
#if 1 /* Is this required here ? */
|
||||||
if (!(&fileptr->data[current_x_find] - fileptr->data))
|
if (!(&fileptr->data[current_x_find] - fileptr->data))
|
||||||
current_x_find++;
|
current_x_find++;
|
||||||
#endif
|
#endif
|
||||||
|
@ -352,7 +352,7 @@ filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beg
|
||||||
|
|
||||||
/* We found an instance */
|
/* We found an instance */
|
||||||
current_x_find = found - fileptr->data;
|
current_x_find = found - fileptr->data;
|
||||||
#if 0
|
#if 1
|
||||||
/* Ensure we haven't wrapped around again! */
|
/* Ensure we haven't wrapped around again! */
|
||||||
if ((search_last_line) && (current_x_find < beginx)) {
|
if ((search_last_line) && (current_x_find < beginx)) {
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
|
@ -651,8 +651,10 @@ int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
|
totsize -= strlen(current->data);
|
||||||
free(current->data);
|
free(current->data);
|
||||||
current->data = copy;
|
current->data = copy;
|
||||||
|
totsize += strlen(current->data);
|
||||||
|
|
||||||
/* Stop bug where we replace a substring of the replacement text */
|
/* Stop bug where we replace a substring of the replacement text */
|
||||||
current_x += strlen(last_replace) - 1;
|
current_x += strlen(last_replace) - 1;
|
||||||
|
@ -768,13 +770,13 @@ void goto_abort(void)
|
||||||
display_main_list();
|
display_main_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_gotoline(long line, int save_pos)
|
int do_gotoline(int line, int save_pos)
|
||||||
{
|
{
|
||||||
long i = 1;
|
int i = 1;
|
||||||
|
|
||||||
if (line <= 0) { /* Ask for it */
|
if (line <= 0) { /* Ask for it */
|
||||||
|
|
||||||
long j = 0;
|
int j = 0;
|
||||||
|
|
||||||
j = statusq(0, goto_list, GOTO_LIST_LEN, "", _("Enter line number"));
|
j = statusq(0, goto_list, GOTO_LIST_LEN, "", _("Enter line number"));
|
||||||
if (j != 0) {
|
if (j != 0) {
|
||||||
|
@ -815,13 +817,21 @@ int do_gotoline_void(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined ENABLE_MULTIBUFFER || !defined DISABLE_SPELLER)
|
#if (defined ENABLE_MULTIBUFFER || !defined DISABLE_SPELLER)
|
||||||
void do_gotopos(long line, int pos_x, int pos_y, int pos_placewewant)
|
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* since do_gotoline() resets the x-coordinate but not the
|
/* since do_gotoline() resets the x-coordinate but not the
|
||||||
y-coordinate, set the coordinates up this way */
|
y-coordinate, set the coordinates up this way */
|
||||||
current_y = pos_y;
|
current_y = pos_y;
|
||||||
do_gotoline(line, 1);
|
do_gotoline(line, 1);
|
||||||
|
|
||||||
|
/* recalculate the x-coordinate and place we want, just in case their
|
||||||
|
values are insane; if they aren't, they won't be changed by this */
|
||||||
|
current_x = pos_x;
|
||||||
|
pos_placewewant = xplustabs();
|
||||||
|
pos_x = actual_x(current, pos_placewewant);
|
||||||
|
|
||||||
|
/* set the rest of the coordinates up */
|
||||||
current_x = pos_x;
|
current_x = pos_x;
|
||||||
placewewant = pos_placewewant;
|
placewewant = pos_placewewant;
|
||||||
update_line(current, pos_x);
|
update_line(current, pos_x);
|
||||||
|
|
52
winio.c
52
winio.c
|
@ -260,7 +260,7 @@ void nanoget_repaint(char *buf, char *inputbuf, int x)
|
||||||
|
|
||||||
/* Get the input from the kb; this should only be called from statusq */
|
/* Get the input from the kb; this should only be called from statusq */
|
||||||
int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||||
int start_x)
|
int start_x, int list)
|
||||||
{
|
{
|
||||||
int kbinput = 0, j = 0, x = 0, xend;
|
int kbinput = 0, j = 0, x = 0, xend;
|
||||||
int x_left = 0, inputlen, tabbed = 0;
|
int x_left = 0, inputlen, tabbed = 0;
|
||||||
|
@ -389,7 +389,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||||
if (allowtabs) {
|
if (allowtabs) {
|
||||||
shift = 0;
|
shift = 0;
|
||||||
inputbuf = input_tab(inputbuf, (x - x_left),
|
inputbuf = input_tab(inputbuf, (x - x_left),
|
||||||
&tabbed, &shift);
|
&tabbed, &shift, &list);
|
||||||
x += shift;
|
x += shift;
|
||||||
if (x - x_left > strlen(inputbuf))
|
if (x - x_left > strlen(inputbuf))
|
||||||
x = strlen(inputbuf) + x_left;
|
x = strlen(inputbuf) + x_left;
|
||||||
|
@ -1048,7 +1048,7 @@ void update_line(filestruct * fileptr, int index)
|
||||||
virt_cur_x--;
|
virt_cur_x--;
|
||||||
if (i < mark_beginx)
|
if (i < mark_beginx)
|
||||||
virt_mark_beginx--;
|
virt_mark_beginx--;
|
||||||
} else if (realdata[i] >= 1 && realdata[i] <= 26) {
|
} else if (realdata[i] < 32) {
|
||||||
/* Treat control characters as ^letter */
|
/* Treat control characters as ^letter */
|
||||||
fileptr->data[pos++] = '^';
|
fileptr->data[pos++] = '^';
|
||||||
fileptr->data[pos++] = realdata[i] + 64;
|
fileptr->data[pos++] = realdata[i] + 64;
|
||||||
|
@ -1213,6 +1213,10 @@ int statusq(int tabs, shortcut s[], int slen, char *def, char *msg, ...)
|
||||||
char foo[133];
|
char foo[133];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
#ifndef DISABLE_TABCOMP
|
||||||
|
int list;
|
||||||
|
#endif
|
||||||
|
|
||||||
bottombars(s, slen);
|
bottombars(s, slen);
|
||||||
|
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
|
@ -1227,7 +1231,13 @@ int statusq(int tabs, shortcut s[], int slen, char *def, char *msg, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ret = nanogetstr(tabs, foo, def, s, slen, (strlen(foo) + 3));
|
#ifndef DISABLE_TABCOMP
|
||||||
|
ret = nanogetstr(tabs, foo, def, s, slen, (strlen(foo) + 3), list);
|
||||||
|
#else
|
||||||
|
/* if we've disabled tab completion, the value of list won't be
|
||||||
|
used at all, so it's safe to use 0 (NULL) as a placeholder */
|
||||||
|
ret = nanogetstr(tabs, foo, def, s, slen, (strlen(foo) + 3), 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
color_off(bottomwin, COLOR_STATUSBAR);
|
color_off(bottomwin, COLOR_STATUSBAR);
|
||||||
|
@ -1245,6 +1255,13 @@ int statusq(int tabs, shortcut s[], int slen, char *def, char *msg, ...)
|
||||||
do_last_line();
|
do_last_line();
|
||||||
break;
|
break;
|
||||||
case NANO_CANCEL_KEY:
|
case NANO_CANCEL_KEY:
|
||||||
|
#ifndef DISABLE_TABCOMP
|
||||||
|
/* if we've done tab completion, there might be a list of
|
||||||
|
filename matches on the edit window at this point; make sure
|
||||||
|
they're cleared off */
|
||||||
|
if (list)
|
||||||
|
edit_refresh();
|
||||||
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
default:
|
default:
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
|
@ -1480,11 +1497,12 @@ void previous_line(void)
|
||||||
current_y--;
|
current_y--;
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_cursorpos(void)
|
int do_cursorpos(int constant)
|
||||||
{
|
{
|
||||||
filestruct *fileptr;
|
filestruct *fileptr;
|
||||||
float linepct = 0.0, bytepct = 0.0;
|
float linepct = 0.0, bytepct = 0.0;
|
||||||
long i = 0;
|
long i = 0;
|
||||||
|
static long old_i = -1, old_totsize = -1;
|
||||||
|
|
||||||
if (current == NULL || fileage == NULL)
|
if (current == NULL || fileage == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1498,6 +1516,12 @@ int do_cursorpos(void)
|
||||||
|
|
||||||
i += current_x;
|
i += current_x;
|
||||||
|
|
||||||
|
if (old_i == -1)
|
||||||
|
old_i = i;
|
||||||
|
|
||||||
|
if (old_totsize == -1)
|
||||||
|
old_totsize = totsize;
|
||||||
|
|
||||||
if (totlines > 0)
|
if (totlines > 0)
|
||||||
linepct = 100 * current->lineno / totlines;
|
linepct = 100 * current->lineno / totlines;
|
||||||
|
|
||||||
|
@ -1509,12 +1533,26 @@ int do_cursorpos(void)
|
||||||
linepct, bytepct);
|
linepct, bytepct);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
statusbar(_("line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"),
|
/* if constant is zero, display the position on the statusbar
|
||||||
current->lineno, totlines, linepct, i, totsize, bytepct);
|
unconditionally; otherwise, only display the position when the
|
||||||
|
character values have changed */
|
||||||
|
if (!constant || (old_i != i || old_totsize != totsize)) {
|
||||||
|
statusbar(_("line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"),
|
||||||
|
current->lineno, totlines, linepct, i, totsize, bytepct);
|
||||||
|
}
|
||||||
|
|
||||||
|
old_i = i;
|
||||||
|
old_totsize = totsize;
|
||||||
|
|
||||||
reset_cursor();
|
reset_cursor();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int do_cursorpos_void(void)
|
||||||
|
{
|
||||||
|
return do_cursorpos(0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Our broken, non-shortcut list compliant help function.
|
/* Our broken, non-shortcut list compliant help function.
|
||||||
But, hey, it's better than nothing, and it's dynamic! */
|
But, hey, it's better than nothing, and it's dynamic! */
|
||||||
int do_help(void)
|
int do_help(void)
|
||||||
|
|
Loading…
Reference in New Issue