[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev lynx2.8.3dev.5
From: |
Eduardo Chappa L. |
Subject: |
Re: lynx-dev lynx2.8.3dev.5 |
Date: |
Fri, 30 Jul 1999 13:40:24 -0700 (PDT) |
*** T.E.Dickey (address@hidden) wrote Today:
:) * add -short_url option and associated logic to elide middle of long urls
:) (adapted from patch by Eduardo Chappa L <address@hidden>) -TD
Thanks Tom for including the patch with your modifications in this dev
version. However a bug got into the code, which makes at least
strlength("-more") + srtlength("___") characters not appear at the end of
the link (so you can not see the .jpg or .html or .cgi), and also addresses
of the kind javascript:(something_long_here); not to be displayed as
intended. I also decided to change the cut position to cut_position - 3
(insert the ___ string to the left of the cut_position, instead of the
right). I think the following patch fixes all these problems.
*** LYMainLoop.orig.c Fri Jul 30 13:19:07 1999
--- LYMainLoop.c Fri Jul 30 13:23:40 1999
***************
*** 6907,6912 ****
--- 6907,6913 ----
int k;
int cut_position;
int link_position;
+ int count;
StrAllocCopy(buf, curlink_name);
***************
*** 6913,6920 ****
--- 6914,6925 ----
/* Scan to find the final leaf of the url, put it in 'k'.
* Ignore trailing '/'.
*/
+
for (j = length; (j > 0) && buf[j] != '/'; --j)
;
+ /* Now we deal with links that are not URLs or that end with
+ a '/' character */
+
if (j >= (length - 3)) {
for (k = j - 1; (k > 0) && buf[k] != '/'; --k)
;
***************
*** 6925,6943 ****
/* We assume that one can recognize the link from at least
* MIN_STATUS characters.
*/
! cut_position = MAX_STATUS - prefix - (length - k);
if (cut_position < MIN_STATUS){
cut_position = MIN_STATUS;
! link_position = length - MIN_STATUS + 3;
} else {
link_position = k;
}
! for (j = 0; j < 3; j++)
! buf[cut_position++] = '_';
! if (cut_position < link_position)
! while ((buf[cut_position++] = buf[link_position++]) != 0)
! ;
_user_message(format, buf);
FREE(buf);
} else { /* show (possibly truncated) url */
_user_message(format, curlink_name);
--- 6930,6952 ----
/* We assume that one can recognize the link from at least
* MIN_STATUS characters.
*/
! cut_position = MAX_STATUS - (length - k);
if (cut_position < MIN_STATUS){
cut_position = MIN_STATUS;
! link_position = length - MIN_STATUS;
} else {
link_position = k;
}
! cut_position -= prefix;
! for (j = 1; j <= 3; j++)
! buf[cut_position - j] = '_';
! for (count = cut_position;
! (count < MAX_STATUS) && (link_position + count - cut_position
<= len
! ++count)
! buf[count] = buf[link_position + count - cut_position];
!
_user_message(format, buf);
+ CTRACE(tfp,"lastline = %s",buf);
FREE(buf);
} else { /* show (possibly truncated) url */
_user_message(format, curlink_name);
***************
*** 6944,6946 ****
--- 6953,6956 ----
}
}
}
+
Eduardo
http://www.math.washington.edu/~chappa/personal.html