- New flag -o, --operatingdir, similar to Pico's -o mode. New
function check_operating_dir(), changes to load_file (arg),
open_file_dup_search (arg), new function do_gotopos for -F
- (Ravid Lawrence Ramsey).
+ (David Lawrence Ramsey).
- Code to read/write dos formatted files. Massive amounts of
new code in read_line and write_file. New cmdline flag
(-D --dos) to automatically write the file in DOS format,
main()
- Added vars oldcurrent and oldcurrent_x to check whether cursor
pos has changed and if so update the pos with -c.
+ - Many tweaks and changes from numerics to char equivs
+ (David Lawrence Ramsey).
do_mouse()
- Send 27 when the menu item clicked is an alt key seq... The
lines aren't lined up since the menu width changed though,
- Add David Lawrence Ramsey to credits.
bottombars()
- Spread out the menu items, feedback definitely needed on this.
+ nanogetstr()
+ - More key fixes (David Lawrence Ramsey)
- po/nl.po:
- New Dutch translation, by Guus Sliepen <guus@nl.linux.org>.
- po/es.po:
struct stat fileinfo;
/* first, get the current directory, and tack a slash onto the end of
- it */
+ it, unless it turns out to be "/", in which case leave it alone */
#ifdef PATH_MAX
d_here = getcwd(NULL, PATH_MAX + 1);
if (d_here) {
align(&d_here);
- d_here = nrealloc(d_here, strlen(d_here) + 2);
- strcat(d_here, "/");
+ if (strcmp(d_here, "/")) {
+ d_here = nrealloc(d_here, strlen(d_here) + 2);
+ strcat(d_here, "/");
+ }
/* stat origpath; if stat() fails, assume that origpath refers to
a new file that hasn't been saved to disk yet (i. e. set
align(&d_there);
if (d_there) {
- d_there = nrealloc(d_there, strlen(d_there) + 2);
- strcat(d_there, "/");
+
+ /* add a slash to d_there, unless it's "/", in which
+ case we don't need it */
+ if (strcmp(d_there, "/")) {
+ d_there = nrealloc(d_there, strlen(d_there) + 2);
+ strcat(d_there, "/");
+ }
}
else
return NULL;
operating_dir = NULL;
return 0;
}
+
+ /* if the full operating directory is "/", that's the same as
+ having no operating directory, so discard it and get out */
+ if (!strcmp(full_operating_dir, "/")) {
+ free(full_operating_dir);
+ operating_dir = NULL;
+ return 0;
+ }
}
fullpath = get_full_path(currpath);
/* External spell checking */
int do_alt_speller(char *file_name)
{
- int alt_spell_status;
+ int alt_spell_status, y_cur = current_y;
pid_t pid_spell;
char *ptr;
long lineno_cur = current->lineno;
/* go back to the old line while keeping the same position, mark the
file as modified, and make sure that the titlebar is refreshed */
+ current_y = y_cur;
do_gotoline(lineno_cur, 1);
set_modified();
clearok(topwin, FALSE);
#ifdef DEBUG
fprintf(stderr, "AHA! %c (%d)\n", kbinput, kbinput);
#endif
+
if (kbinput == 27) { /* Grab Alt-key stuff first */
switch (kbinput = wgetch(edit)) {
/* Alt-O, suddenly very important ;) */
- case 79:
+ case 'O':
kbinput = wgetch(edit);
if ((kbinput <= 'D' && kbinput >= 'A') ||
(kbinput <= 'd' && kbinput >= 'a'))
modify_control_seq = 1;
keyhandled = 1;
break;
- case 91:
+ case '[':
switch (kbinput = wgetch(edit)) {
case '1': /* Alt-[-1-[0-5,7-9] = F1-F8 in X at least */
kbinput = wgetch(edit);
} else if (kbinput >= '7' && kbinput <= '9') {
kbinput = KEY_F(kbinput - 49);
wgetch(edit);
- } else if (kbinput == 126)
+ } else if (kbinput == '~')
kbinput = KEY_HOME;
#ifdef DEBUG
kbinput = KEY_F(12);
wgetch(edit);
break;
- case 126: /* Hack, make insert key do something
- useful, like insert file */
-#ifdef ENABLE_MULTIBUFFER
- do_insertfile(ISSET(MULTIBUFFER));
-#else
- do_insertfile(0);
-#endif
-
- keyhandled = 1;
- break;
+ case '~':
+ goto do_insertkey;
#ifdef DEBUG
default:
fprintf(stderr, _("I got Alt-[-2-%c! (%d)\n"),
keyhandled = 1;
}
+
+ /* Hack, make insert key do something useful, like insert file */
+ if (kbinput == KEY_IC) {
+ do_insertkey:
+
+#ifdef ENABLE_MULTIBUFFER
+ do_insertfile(ISSET(MULTIBUFFER));
+#else
+ do_insertfile(0);
+#endif
+
+ keyhandled = 1;
+ }
+
/* Last gasp, stuff that's not in the main lists */
if (!keyhandled)
switch (kbinput) {
do_next_word();
break;
- case 331: /* Stuff that we don't want to do squat */
- case -1:
+ case -1: /* Stuff that we don't want to do squat */
case 410: /* Must ignore this, it gets sent when we resize */
#ifdef PDCURSES
case 541: /* ???? */
nanoget_repaint(buf, inputbuf, x);
break;
case KEY_BACKSPACE:
- case KEY_DC:
case 127:
case NANO_CONTROL_H:
if (strlen(inputbuf) > 0) {
case KEY_DOWN:
break;
+ case KEY_DC:
+ goto do_deletekey;
+
case 27:
switch (kbinput = wgetch(edit)) {
- case 79:
+ case 'O':
switch (kbinput = wgetch(edit)) {
- case 70:
+ case 'F':
x = x_left + strlen(inputbuf);
nanoget_repaint(buf, inputbuf, x);
break;
- case 72:
+ case 'H':
x = x_left;
nanoget_repaint(buf, inputbuf, x);
break;
}
break;
- case 91:
+ case '[':
switch (kbinput = wgetch(edit)) {
case 'C':
if (x < xend)
x--;
wmove(bottomwin, 0, x);
break;
- case 49:
+ case '1':
+ case '7':
x = x_left;
nanoget_repaint(buf, inputbuf, x);
- goto skip_126;
- case 51:
+ goto skip_tilde;
+ case '3':
+ do_deletekey:
if (strlen(inputbuf) > 0
&& (x - x_left) != strlen(inputbuf)) {
memmove(inputbuf + (x - x_left),
inputbuf[strlen(inputbuf) - 1] = 0;
}
nanoget_repaint(buf, inputbuf, x);
- goto skip_126;
- case 52:
+ goto skip_tilde;
+ case '4':
+ case '8':
x = x_left + strlen(inputbuf);
nanoget_repaint(buf, inputbuf, x);
- goto skip_126;
- skip_126:
+ goto skip_tilde;
+ skip_tilde:
nodelay(edit, TRUE);
kbinput = wgetch(edit);
- if (kbinput == 126 || kbinput == ERR)
+ if (kbinput == '~' || kbinput == ERR)
kbinput = -1;
nodelay(edit, FALSE);
break;