[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LYNX-DEV [patch] New version of current URL editing
From: |
Tomasz J. Cholewo |
Subject: |
Re: LYNX-DEV [patch] New version of current URL editing |
Date: |
Tue, 11 Feb 1997 19:36:24 -0500 |
Foteos Macrides wrote:
> "Tomasz J. Cholewo" <address@hidden> wrote:
> > The following patch (against the Feb 9 prerelease) replaces both my
> > previous patches and allows current URL editing by pressing arrow down
> > after 'g' and going to the "parent" document by typing ".." after 'g'.
>
> On both Unix and VMS, 'g' followed by a ".." entry yields
> a directory listing for the parent of the current default directory,
> and a "." entry yields a directory listing for the current default.
> On VMS, "[-]" and "[]" also yield those listings, respectively. It's
> not surprising that David didn't know that, even after using Lynx for
> all this time, but those are extremely convenient features (at least,
> to some of us 8-), which should not be defeated by your patch.
It is true that there is some interface overlap. It occurs when one
wants to switch from reading `http:' documents to `file:' browsing. But
then a sequence 'g', '.', 'g', '..' easily obtains the same result. I
absolutely don't insist on binding of a 'goto a parent URL' feature to
'g', '..'; as you remember in the first version I used the sole 'G' key
for this purpose.
I think that the possibility of general editing of the current URL is
more important and that pressing 'g' and arrow down to recall the URL is
an acceptable solution.
>> Also, did you miss in the documentation, in the reminder posted
> recently to this list, and in the cover page for the v2.7 pre-release,
> that patches should be posted as context diffs (diff -c)?
I am sorry. I thought that the main idea was "line number independence"
of the patch. A unified patch format (diff -u) guarantees just that, is
usually more compact and, in my opinion, more human readable.
Application by hand is also not difficult. One can still find `patch'
programs which are not able to read unified diffs but is anyone on this
list using them?
Anyway, I apologize again and below I repost my patch in the correct
format split into two separate modifications: one for URL editing and
one for '..' handling. They are made against Feb 10 prerelease.
Tom
========= CUT HERE for current URL editing ============
diff -crd lynx2-7/LYMessages_en.h lynx2-7-work/LYMessages_en.h
*** lynx2-7/LYMessages_en.h Sun Feb 9 04:42:42 1997
--- lynx2-7-work/LYMessages_en.h Tue Feb 11 19:15:33 1997
***************
*** 285,290 ****
--- 286,292 ----
#define GOTO_TN3270_DISALLOWED "You are not allowed to goto \"tn3270:\" URLs"
#define GOTO_WAIS_DISALLOWED "You are not allowed to goto \"wais:\" URLs"
#define URL_TO_OPEN "URL to open: "
+ #define EDIT_CURRENT_URL "Edit the current document URL: "
#define EDIT_CURRENT_GOTO "Edit the current Goto URL: "
#define EDIT_THE_PREV_GOTO "Edit the previous Goto URL: "
#define EDIT_A_PREV_GOTO "Edit a previous Goto URL: "
diff -crd lynx2-7/src/LYMainLoop.c lynx2-7-work/src/LYMainLoop.c
*** lynx2-7/src/LYMainLoop.c Sun Feb 9 16:50:02 1997
--- lynx2-7-work/src/LYMainLoop.c Tue Feb 11 19:22:09 1997
***************
*** 2215,2287 ****
sleep(InfoSecs);
break;
}
! if (recall && ch == UPARROW) {
! if (FirstURLRecall) {
! /*
! * Use last URL in the list. - FM
! */
! FirstURLRecall = FALSE;
! URLNum = 0;
! } else {
! /*
! * Go back to the previous URL in the list. - FM
! */
! URLNum++;
! }
! if (URLNum >= URLTotal)
! /*
! * Roll around to the last URL in the list. - FM
! */
! URLNum = 0;
! if ((cp = (char *)HTList_objectAt(Goto_URLs,
! URLNum)) != NULL) {
! strcpy(user_input_buffer, cp);
! if (goto_buffer && *temp &&
! !strcmp(temp, user_input_buffer)) {
! _statusline(EDIT_CURRENT_GOTO);
! } else if ((goto_buffer && URLTotal == 2) ||
! (!goto_buffer && URLTotal == 1)) {
! _statusline(EDIT_THE_PREV_GOTO);
! } else {
! _statusline(EDIT_A_PREV_GOTO);
! }
! if ((ch = LYgetstr(user_input_buffer, VISIBLE,
! sizeof(user_input_buffer),
! recall)) < 0) {
! /*
! * User cancelled the Goto via ^G.
! * Restore user_input_buffer and break. - FM
! */
! strcpy(user_input_buffer, temp);
! FREE(temp);
! _statusline(CANCELLED);
! sleep(InfoSecs);
! break;
! }
! goto check_recall;
! }
! } else if (recall && ch == DNARROW) {
! if (FirstURLRecall) {
! /*
! * Use the first URL in the list. - FM
! */
! FirstURLRecall = FALSE;
! URLNum = URLTotal - 1;
! } else {
! /*
! * Advance to the next URL in the list. - FM
! */
! URLNum--;
! }
! if (URLNum < 0)
! /*
! * Roll around to the first URL in the list. - FM
! */
! URLNum = URLTotal - 1;
! if ((cp=(char *)HTList_objectAt(Goto_URLs,
! URLNum)) != NULL) {
strcpy(user_input_buffer, cp);
! if (goto_buffer && *temp &&
!strcmp(temp, user_input_buffer)) {
_statusline(EDIT_CURRENT_GOTO);
} else if ((goto_buffer && URLTotal == 2) ||
--- 2215,2270 ----
sleep(InfoSecs);
break;
}
!
! if (recall && (ch == UPARROW || ch == DNARROW)) {
! if (ch == UPARROW) {
! if (FirstURLRecall) {
! /*
! * Use last URL in the list. - FM
! */
! FirstURLRecall = FALSE;
! URLNum = 0;
! } else {
! /*
! * Go back to the previous URL in the list. - FM
! */
! URLNum++;
! if (URLNum >= URLTotal)
! /*
! * Roll around to the last URL in the list. - FM
! */
! URLNum = 0;
! }
! } else if (ch == DNARROW) {
! if (FirstURLRecall) {
! /*
! * Use the first URL in the list. - FM
! */
! FirstURLRecall = FALSE;
! URLNum = URLTotal; /* index |URLTotal|
represents the current URL which is not stored in |Goto_URLs| - tjc */
! } else {
! /*
! * Advance to the next URL in the list. - FM
! */
! URLNum--;
! if (URLNum < 0)
! /*
! * Roll around to the current URL in the list. -
FM
! */
! URLNum = URLTotal;
! }
! }
!
! if (URLNum >= URLTotal) /* current URL - tjc */
! cp = curdoc.address;
! else
! cp = (char *)HTList_objectAt(Goto_URLs, URLNum);
!
! if (cp != NULL) {
strcpy(user_input_buffer, cp);
! if (URLNum >= URLTotal) {
! _statusline(EDIT_CURRENT_URL);
! } else if (goto_buffer && *temp &&
!strcmp(temp, user_input_buffer)) {
_statusline(EDIT_CURRENT_GOTO);
} else if ((goto_buffer && URLTotal == 2) ||
================== CUT HERE for 'g', '..' =========================
diff -crd lynx2-7/LYMessages_en.h lynx2-7-work/LYMessages_en.h
*** lynx2-7/LYMessages_en.h Sun Feb 9 04:42:42 1997
--- lynx2-7-work/LYMessages_en.h Tue Feb 11 19:15:33 1997
***************
*** 249,254 ****
--- 249,255 ----
#define ALREADY_AT_END "You are already at the end of this document."
#define ALREADY_AT_BEGIN "You are already at the beginning of this document."
#define ALREADY_AT_FIRST "You are already at the first document"
+ #define ALREADY_AT_ROOT "You are already at the root document"
#define NO_LINKS_ABOVE "There are no links above this line of the document."
#define NO_LINKS_BELOW "There are no links below this line of the document."
#define MAXLEN_REACHED_DEL_OR_MOV \
diff -crd lynx2-7/src/LYMainLoop.c lynx2-7-work/src/LYMainLoop.c
*** lynx2-7/src/LYMainLoop.c Sun Feb 9 16:50:02 1997
--- lynx2-7-work/src/LYMainLoop.c Tue Feb 11 19:22:09 1997
***************
*** 2307,2321 ****
}
}
! /*
! * If its not a URL then make it one.
! */
! StrAllocCopy(temp, user_input_buffer);
! LYFillLocalFileURL((char **)&temp, "file://localhost");
! LYEnsureAbsoluteURL((char **)&temp, "");
! sprintf(user_input_buffer, "%.*s",
! (sizeof(user_input_buffer) - 1), temp);
! FREE(temp);
if ((no_file_url || no_goto_file) &&
!strncmp(user_input_buffer,"file:",5)) {
_statusline(GOTO_FILE_DISALLOWED);
--- 2290,2332 ----
}
}
! if (!strcmp (user_input_buffer, "..")) {
! char *address = HTParse(curdoc.address, "", PARSE_ACCESS |
! PARSE_HOST | PARSE_PUNCTUATION);
! char *path = HTParse(curdoc.address, "", PARSE_PATH |
PARSE_PUNCTUATION); /* ignore anchor */
!
! if (path != NULL) {
! if (strlen(path) > 1) {
! if (path[strlen(path)-1] == '/')
! path[strlen(path)-1] = '\0'; /* remove trailing
slash */
! if ((cp = strrchr(path, '/')) != NULL)
! *(cp + 1) = '\0'; /* leave slash */
! else
! path[0] = '\0'; /* at root */
! StrAllocCat(address, path);
! FREE(path);
! } else { /* we are at the root already
*/
! _statusline(ALREADY_AT_ROOT);
! sleep(MessageSecs);
! FREE(path);
! break;
! }
! }
! sprintf(user_input_buffer, "%.*s",
! (sizeof(user_input_buffer) - 1), address);
! FREE(address);
! } else {
! /*
! * If its not a URL then make it one.
! */
! StrAllocCopy(temp, user_input_buffer);
! LYFillLocalFileURL((char **)&temp, "file://localhost");
! LYEnsureAbsoluteURL((char **)&temp, "");
! sprintf(user_input_buffer, "%.*s",
! (sizeof(user_input_buffer) - 1), temp);
! FREE(temp);
! }
!
if ((no_file_url || no_goto_file) &&
!strncmp(user_input_buffer,"file:",5)) {
_statusline(GOTO_FILE_DISALLOWED);
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;