- Added call to real_name_from tilde, oops.
read_file()
- Added check for fileptr == NULL.
+- nano.c:
+ do_justify()
+ - Wrote unjustify code. Borrows cutbuffer and stores the unjustified text there,
+ then grabs the next keystroke and, if the unjustify key, gets rid of the
+ justified text and calls do_uncut_text. Added macro NANO_UNJUSTIFY_KEY.
- es.po:
- Traditional Spanish strings updates.
{
#ifndef NANO_SMALL
int slen = 0; /* length of combined lines on one line. */
- int initial_y;
- filestruct *initial = NULL;
+ int initial_y, kbinput;
+ filestruct *initial = NULL, *tmpjust = NULL, *cutbak, *tmptop, *tmpbot;
if (empty_line(current->data)) {
/* Justify starting at first non-empty line. */
initial_y = current_y;
set_modified();
+ cutbak = cutbuffer; /* Got to like cutbak ;) */
+ cutbuffer = NULL;
+
+ tmptop = current;
+ tmpjust = copy_node(current);
+ add_to_cutbuffer(tmpjust);
/* Put the whole paragraph into one big line. */
while (current->next && !isspace((int) current->next->data[0])
&& current->next->data[0]) {
int len = strlen(current->data);
int len2 = strlen(current->next->data);
+ tmpjust = NULL;
+ fprintf(stderr, "I see no X here\n");
+ tmpjust = copy_node(current->next);
+ add_to_cutbuffer(tmpjust);
+
/* length of both strings plus space between strings and ending \0. */
current->data = nrealloc(current->data, len + len2 + 2);
current->data[len++] = ' ';
} while ((strlenpt(current->data) > (fill))
&& !no_spaces(current->data));
}
+ tmpbot = current;
if (current->next)
current = current->next;
}
edit_refresh();
- statusbar(_("Justify Complete"));
+ statusbar(_("Can now UnJustify!"));
+ reset_cursor();
+
+ /* Now get a keystroke and see if it's unjustify, if not unget the keytreoke
+ and return */
+ if ((kbinput = wgetch(edit)) != NANO_UNJUSTIFY_KEY)
+ ungetch(kbinput);
+ else {
+ /* Else restore the justify we just did (ungrateful user!) */
+ if (tmptop->prev != NULL)
+ tmptop->prev->next = tmpbot->next;
+ tmpbot->next->prev = tmptop->prev;
+ current = tmpbot->next;
+ tmpbot->next = NULL;
+ do_uncut_text();
+ free_filestruct(tmptop);
+ blank_statusbar_refresh();
+ }
+ free_filestruct(cutbuffer);
+ cutbuffer = cutbak;
+
return 1;
#else
nano_small_msg();
#define NANO_REFRESH_KEY NANO_CONTROL_L
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
#define NANO_JUSTIFY_FKEY KEY_F(4)
+#define NANO_UNJUSTIFY_KEY NANO_CONTROL_U
#define NANO_UP_KEY NANO_CONTROL_P
#define NANO_DOWN_KEY NANO_CONTROL_N
#define NANO_FORWARD_KEY NANO_CONTROL_F
{"Cannot move edit win", 154},
{"Cannot resize bottom win", 155},
{"Cannot move bottom win", 156},
- {"Justify Complete", 157},
+ {"Can now UnJustify!", 157},
{"%s enable/disable", 158},
{"enabled", 159},
{"disabled", 160},
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-11-25 21:08-0500\n"
+"POT-Creation-Date: 2000-11-26 19:23-0500\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"
msgid "Cannot move bottom win"
msgstr ""
-#: nano.c:1804
-msgid "Justify Complete"
+#: nano.c:1816
+msgid "Can now UnJustify!"
msgstr ""
-#: nano.c:1872
+#: nano.c:1904
#, c-format
msgid "%s enable/disable"
msgstr ""
-#: nano.c:1884
+#: nano.c:1916
msgid "enabled"
msgstr ""
-#: nano.c:1885
+#: nano.c:1917
msgid "disabled"
msgstr ""
-#: nano.c:2115
+#: nano.c:2147
msgid "Main: set up windows\n"
msgstr ""
-#: nano.c:2128
+#: nano.c:2160
msgid "Main: bottom win\n"
msgstr ""
-#: nano.c:2134
+#: nano.c:2166
msgid "Main: open file\n"
msgstr ""
-#: nano.c:2171
+#: nano.c:2203
#, c-format
msgid "I got Alt-O-%c! (%d)\n"
msgstr ""
-#: nano.c:2193
+#: nano.c:2225
#, c-format
msgid "I got Alt-[-1-%c! (%d)\n"
msgstr ""
-#: nano.c:2226
+#: nano.c:2258
#, c-format
msgid "I got Alt-[-2-%c! (%d)\n"
msgstr ""
-#: nano.c:2274
+#: nano.c:2306
#, c-format
msgid "I got Alt-[-%c! (%d)\n"
msgstr ""
-#: nano.c:2300
+#: nano.c:2332
#, c-format
msgid "I got Alt-%c! (%d)\n"
msgstr ""
void blank_edit(void);
void search_init_globals(void);
void replace_abort(void);
+void add_to_cutbuffer(filestruct * inptr);
#ifdef NANO_EXTRA
void do_credits(void);
#endif