Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-06-10 Thread aelmahmoudy
Ooops sorry ! Your updated patch does fix it indeed !

In the previous email, I tested the regexp search instead of the dump !

-- 
 ‎أحمد المحمودي (Ahmed El-Mahmoudy)
  Digital design engineer
 GPG KeyID: 0xEDDDA1B7 (@ subkeys.pgp.net)
 GPG Fingerprint: 8206 A196 2084 7E6D 0DF8  B176 BC19 6A94 EDDD A1B7
___
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev


Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-06-10 Thread أحمد المحمودي
Hello,

On Mon, Jun 08, 2009 at 11:12:28AM -0400, Yozo Hida wrote:
> Fixed patch are in elinks bug database, see bug #1063.
---end quoted text---


  I just tried with the latest patch in bug #1063, and I still get the 
  same problem.

-- 
 ‎أحمد المحمودي (Ahmed El-Mahmoudy)
  Digital design engineer
 GPG KeyID: 0xEDDDA1B7 (@ subkeys.pgp.net)
 GPG Fingerprint: 8206 A196 2084 7E6D 0DF8  B176 BC19 6A94 EDDD A1B7
___
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev


Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-06-10 Thread Miciah Dashiel Butler Masters
On 06/10/2009 08:18 AM, أحمد المحمودي wrote:
> Hello,
> 
>   Sorry, in yesterday's email, I didn't issue a 'bt' command in GDB, 
>   here is the backtrace:
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1225446624 (LWP 25859)]
> init_document_options (ses=0x0, doo=0xbfa7832c) at 
> /tmp/buildd/elinks-0.13~20090601/src/document/options.c:39
> 39  /tmp/buildd/elinks-0.13~20090601/src/document/options.c: No such file 
> or directory.
> in /tmp/buildd/elinks-0.13~20090601/src/document/options.c
> (gdb) bt
> #0  init_document_options (ses=0x0, doo=0xbfa7832c) at 
> /tmp/buildd/elinks-0.13~20090601/src/document/options.c:39
> #1  0x0813ef1d in dump_formatted (fd=1, download=0x0, cached=0x8cf5e58)
> at /tmp/buildd/elinks-0.13~20090601/src/viewer/dump/dump.c:117
> [...]

OK, the problem is clear now.

The patch in question contains the following:

> diff --git a/src/document/options.c b/src/document/options.c
> index 9208d64..93d9c7b 100644
> --- a/src/document/options.c
> +++ b/src/document/options.c
> @@ -32,6 +32,13 @@ init_document_options(struct session *ses, struct 
> document_options *doo)
> 
>   doo->use_document_colors = 
> get_opt_int("document.colors.use_document_colors", ses);
>   doo->margin = get_opt_int("document.browse.margin_width", ses);
> +
> + doo->document_width = 0;
> + if (get_opt_bool("document.browse.use_preferred_document_width", ses))
> + doo->document_width = 
> get_opt_int("document.browse.preferred_document_width", ses);
> + if (doo->document_width <= 0 || doo->document_width > 
> ses->tab->term->width)
> + doo->document_width = ses->tab->term->width;

ses is NULL when ELinks is run with -dump.

Before the patch, the renderer used document_options.box instead of
document_options.document_width.  Both the dump viewer and the regular
viewer set document_options.box after calling init_document_options.

Really, I think that the patch should be using document_options.box
instead of ses->tab->term->width regardless of which viewer is used
(dump or regular).

So here is one possible solution:

1. Both callers to init_document_options (render_document_frames and
dump_formatted) should first set document_options.box and then call
init_document_options;

2. init_document_options should preserve document_options.box (it
currently clears the whole structure at the beginning of the routine); and

3. the patch should be changed to use document_options.box.

Alternatively to 1 and 2, callers to init_document_options could pass
the values for the box as arguments so that init_document_options can
set document_options.box itself.

Does the above sound reasonable?

-- 
Miciah Masters  / 
___
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev


Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-06-10 Thread Yozo Hida
On 2009-06-08, Thomas Adam  wrote:
> 2009/6/8 أحمد المحمودي :
>> Hello,
>>
>>  patch #9 causes a problem with document dumping:
>>
>> elinks -dump   /tmp/m.htm
>> ELinks-ruby: [BUG] Segmentation fault
>> ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
>>
>> Aborted
>
> Use GDB; get a backtrace.  I've done some work on the Ruby scripting
> support in ELinks in the past.
>

Fixed patch are in elinks bug database, see bug #1063.

-Yozo


___
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev


Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-06-10 Thread أحمد المحمودي
Hello,

  Sorry, in yesterday's email, I didn't issue a 'bt' command in GDB, 
  here is the backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1225446624 (LWP 25859)]
init_document_options (ses=0x0, doo=0xbfa7832c) at 
/tmp/buildd/elinks-0.13~20090601/src/document/options.c:39
39  /tmp/buildd/elinks-0.13~20090601/src/document/options.c: No such file 
or directory.
in /tmp/buildd/elinks-0.13~20090601/src/document/options.c
(gdb) bt
#0  init_document_options (ses=0x0, doo=0xbfa7832c) at 
/tmp/buildd/elinks-0.13~20090601/src/document/options.c:39
#1  0x0813ef1d in dump_formatted (fd=1, download=0x0, cached=0x8cf5e58)
at /tmp/buildd/elinks-0.13~20090601/src/viewer/dump/dump.c:117
#2  0x0813fd27 in dump_loading_callback (download=0x81c0f20, p=0x0)
at /tmp/buildd/elinks-0.13~20090601/src/viewer/dump/dump.c:255
#3  0x080dc381 in notify_connection_callbacks (conn=0x8cf59d0) at 
/tmp/buildd/elinks-0.13~20090601/src/network/connection.c:467
#4  0x080de175 in done_connection (conn=0x8cf59d0) at 
/tmp/buildd/elinks-0.13~20090601/src/network/connection.c:485
#5  0x080de291 in abort_connection (conn=0x8cf59d0, state={basic = S_OK, syserr 
= 0})
at /tmp/buildd/elinks-0.13~20090601/src/network/connection.c:779
#6  0x080ff82b in file_protocol_handler (connection=0x8cf59d0) at 
/tmp/buildd/elinks-0.13~20090601/src/protocol/file/file.c:316
#7  0x080debf8 in run_connection (conn=0x8cf59d0) at 
/tmp/buildd/elinks-0.13~20090601/src/network/connection.c:763
#8  0x080df8c7 in check_queue () at 
/tmp/buildd/elinks-0.13~20090601/src/network/connection.c:833
#9  0x080d8395 in check_bottom_halves () at 
/tmp/buildd/elinks-0.13~20090601/src/main/select.c:118
#10 0x080d8474 in select_loop (init=0x80d72e0 ) at 
/tmp/buildd/elinks-0.13~20090601/src/main/select.c:223
#11 0x080d7a5a in main (argc=Cannot access memory at address 0x0
) at /tmp/buildd/elinks-0.13~20090601/src/main/main.c:358

-- 
 ‎أحمد المحمودي (Ahmed El-Mahmoudy)
  Digital design engineer
 GPG KeyID: 0xEDDDA1B7 (@ subkeys.pgp.net)
 GPG Fingerprint: 8206 A196 2084 7E6D 0DF8  B176 BC19 6A94 EDDD A1B7
___
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev


Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-06-09 Thread أحمد المحمودي
On Mon, Jun 08, 2009 at 12:39:47PM +0100, Thomas Adam wrote:
> 2009/6/8 أحمد المحمودي :
> > Hello,
> >
> >  patch #9 causes a problem with document dumping:
> >
> > elinks -dump   /tmp/m.htm
> > ELinks-ruby: [BUG] Segmentation fault
> > ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
> >
> > Aborted
> 
> Use GDB; get a backtrace.  I've done some work on the Ruby scripting
> support in ELinks in the past.
---end quoted text---

That's what I got:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb6f60b20 (LWP 20447)]
0x08096b88 in init_document_options ()

Is that sufficient ?

-- 
 ‎أحمد المحمودي (Ahmed El-Mahmoudy)
  Digital design engineer
 GPG KeyID: 0xEDDDA1B7 (@ subkeys.pgp.net)
 GPG Fingerprint: 8206 A196 2084 7E6D 0DF8  B176 BC19 6A94 EDDD A1B7
___
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev


Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-06-08 Thread Thomas Adam
2009/6/8 أحمد المحمودي :
> Hello,
>
>  patch #9 causes a problem with document dumping:
>
> elinks -dump   /tmp/m.htm
> ELinks-ruby: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
>
> Aborted

Use GDB; get a backtrace.  I've done some work on the Ruby scripting
support in ELinks in the past.

-- Thomas Adam
___
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev


Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-06-08 Thread أحمد المحمودي
Hello,

  patch #9 causes a problem with document dumping:

elinks -dump   /tmp/m.htm
ELinks-ruby: [BUG] Segmentation fault
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

Aborted

-- 
 ‎أحمد المحمودي (Ahmed El-Mahmoudy)
  Digital design engineer
 GPG KeyID: 0xEDDDA1B7 (@ subkeys.pgp.net)
 GPG Fingerprint: 8206 A196 2084 7E6D 0DF8  B176 BC19 6A94 EDDD A1B7
___
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev


Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-05-15 Thread أحمد المحمودي
Had to fix patches #5 and again #9 (the caption string of options 
shouldn't end with '.')

-- 
 ‎أحمد المحمودي (Ahmed El-Mahmoudy)
  Digital design engineer
 GPG KeyID: 0x9DCA0B27 (@ subkeys.pgp.net)
 GPG Fingerprint: 087D 3767 8CAC 65B1 8F6C  156E D325 C3C8 9DCA 0B27
Provide different color for text areas in insert mode.
The color is controlled by

  document.browse.links.active_link.insert_mode_colors.background
  document.browse.links.active_link.insert_mode_colors.text

Also avoid overloading local variable "i" in get_current_link().
By: yozoh...@gmail.com
---
 src/config/options.inc  |   12 
 src/document/document.c |2 ++
 src/document/options.c  |2 ++
 src/document/options.h  |1 +
 src/viewer/text/link.c  |   17 -
 5 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/src/config/options.inc b/src/config/options.inc
index 340ab93..7098854 100644
--- a/src/config/options.inc
+++ b/src/config/options.inc
@@ -294,6 +294,18 @@ static struct option_info config_options_info[] = {
"text", 0, "black",
N_("Default text color.")),
 
+   INIT_OPT_TREE("document.browse.links.active_link", N_("Insert mode 
colors"),
+   "insert_mode_colors", 0,
+   N_("Insert mode colors.")),
+
+   INIT_OPT_COLOR("document.browse.links.active_link.insert_mode_colors", 
N_("Background color for text field in insert mode"),
+   "background", 0, "#ff",
+   N_("Background color for text field in insert mode")),
+
+   INIT_OPT_COLOR("document.browse.links.active_link.insert_mode_colors", 
N_("Text color for text field in insert mode"),
+   "text", 0, "black",
+   N_("Text color for text field in insert mode.")),
+
INIT_OPT_BOOL("document.browse.links.active_link", N_("Enable color"),
"enable_color", 0, 0,
N_("Enable use of the active link background and text color "
diff --git a/src/document/document.c b/src/document/document.c
index 5424f6f..19ee2d0 100644
--- a/src/document/document.c
+++ b/src/document/document.c
@@ -234,6 +234,8 @@ update_cached_document_options(struct session *ses)
memset(&active_link, 0, sizeof(active_link));   /* Safer. */
active_link.color.foreground = 
get_opt_color("document.browse.links.active_link.colors.text", ses);
active_link.color.background = 
get_opt_color("document.browse.links.active_link.colors.background", ses);
+   active_link.insert_mode_color.foreground = 
get_opt_color("document.browse.links.active_link.insert_mode_colors.text", ses);
+   active_link.insert_mode_color.background = 
get_opt_color("document.browse.links.active_link.insert_mode_colors.background",
 ses);
active_link.enable_color = 
get_opt_bool("document.browse.links.active_link.enable_color", ses);
active_link.invert = 
get_opt_bool("document.browse.links.active_link.invert", ses);
active_link.underline = 
get_opt_bool("document.browse.links.active_link.underline", ses);
diff --git a/src/document/options.c b/src/document/options.c
index b681fda..9208d64 100644
--- a/src/document/options.c
+++ b/src/document/options.c
@@ -52,6 +52,8 @@ init_document_options(struct session *ses, struct 
document_options *doo)
 
doo->active_link.color.foreground = 
get_opt_color("document.browse.links.active_link.colors.text", ses);
doo->active_link.color.background = 
get_opt_color("document.browse.links.active_link.colors.background", ses);
+   doo->active_link.insert_mode_color.foreground = 
get_opt_color("document.browse.links.active_link.insert_mode_colors.text", ses);
+   doo->active_link.insert_mode_color.background = 
get_opt_color("document.browse.links.active_link.insert_mode_colors.background",
 ses);
 
if (get_opt_bool("document.colors.increase_contrast", ses))
doo->color_flags |= COLOR_INCREASE_CONTRAST;
diff --git a/src/document/options.h b/src/document/options.h
index d3bd29a..52c1956 100644
--- a/src/document/options.h
+++ b/src/document/options.h
@@ -20,6 +20,7 @@ struct active_link_options {
unsigned int bold:1;
unsigned int invert:1;
struct active_link_options_colors color;
+   struct active_link_options_colors insert_mode_color;
 };
 
 /** This mostly acts as a option cache so rendering will be faster. However it
diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c
index a9021b0..eaa15f1 100644
--- a/src/viewer/text/link.c
+++ b/src/viewer/text/link.c
@@ -165,7 +165,7 @@ get_link_cursor_offset(struct document_view *doc_view, 
struct link *link)
 /** Initialise a static template character with the colour and attributes
  * appropriate for an active link and return that character. */
 static inline struct screen_char *
-init_link_drawing(struct document_view *doc_view, struct link *link, int 
invert)
+init_link_drawing(struct document_view *doc_view, struct link *link, int 
invert, int 

Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-05-13 Thread أحمد المحمودي
On Wed, May 13, 2009 at 03:52:33PM +0300, أحمد المحمودي wrote:
>   I am trying your patches, I get these messages from elinks, I think 
>   the reason is patch #9:
> 
> DEBUG MESSAGE at /tmp/buildd/elinks-0.13~20090512/src/config/options.c:306: 
> get_opt_*("document.browse.use_preferred_document_width") @ 
> /tmp/buildd/elinks-0.13~20090512/src/document/options.c:37: call with wrapper 
> for Boolean for option of type Integer
---end quoted text---

  Please find fixed patch #9 attached with this email.

-- 
 ‎أحمد المحمودي (Ahmed El-Mahmoudy)
  Digital design engineer
 GPG KeyID: 0x9DCA0B27 (@ subkeys.pgp.net)
 GPG Fingerprint: 087D 3767 8CAC 65B1 8F6C  156E D325 C3C8 9DCA 0B27
Add preferred_document_width option.
Option document.browse.preferred_document_width controls the
width of the document, so that documents are rendered with narrower
width than screen width.  Makes it easier to read paragraphs.

Patch originally from Sharon Wood , see bug #1063.

Instead of using max_document_width as the hard limit to the document
width, it uses a soft limit, where if the document does not fit (due to
tables, etc.), then larger width is used.  This reduces the need for
horizontal scrolling for wide documents.

Also added toggle-document-width action to toggle between preferred
width and full screen width.  Initial toggle status is determined by
document.browse.use_preferred_document_width option.
By: yozoh...@gmail.com
---
 src/config/actions-main.inc|1 +
 src/config/options.inc |   10 ++
 src/document/html/parser.c |2 +-
 src/document/html/parser/forms.c   |8 
 src/document/html/parser/general.c |2 +-
 src/document/html/renderer.c   |4 ++--
 src/document/options.c |7 +++
 src/document/options.h |1 +
 src/document/plain/renderer.c  |2 +-
 src/document/renderer.c|3 +--
 src/viewer/action.c|5 +
 11 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/src/config/actions-main.inc b/src/config/actions-main.inc
index 21ff838..25543f1 100644
--- a/src/config/actions-main.inc
+++ b/src/config/actions-main.inc
@@ -117,6 +117,7 @@ ACTION_(MAIN, "toggle-css", TOGGLE_CSS, N__("Toggle 
rendering of page using CSS"
 ACTION_(MAIN, "toggle-display-images", TOGGLE_DISPLAY_IMAGES, N__("Toggle 
displaying of links to images"), 0),
 ACTION_(MAIN, "toggle-display-tables", TOGGLE_DISPLAY_TABLES, N__("Toggle 
rendering of tables"), 0),
 ACTION_(MAIN, "toggle-document-colors", TOGGLE_DOCUMENT_COLORS, N__("Toggle 
usage of document specific colors"), 0),
+ACTION_(MAIN, "toggle-document-width", TOGGLE_DOCUMENT_WIDTH, N__("Toggle use 
of document width"), 0),
 ACTION_(MAIN, "toggle-html-plain", TOGGLE_HTML_PLAIN, N__("Toggle rendering 
page as HTML / plain text"), 0),
 ACTION_(MAIN, "toggle-mouse", TOGGLE_MOUSE, N__("Toggle mouse handling"), 0),
 ACTION_(MAIN, "toggle-numbered-links", TOGGLE_NUMBERED_LINKS, N__("Toggle 
displaying of links numbers"), 0),
diff --git a/src/config/options.inc b/src/config/options.inc
index 7098854..468d0ca 100644
--- a/src/config/options.inc
+++ b/src/config/options.inc
@@ -464,6 +464,16 @@ static struct option_info config_options_info[] = {
"margin_width", 0, 0, 100, 3,
N_("Horizontal text margin.")),
 
+   INIT_OPT_INT("document.browse", N_("Preferred document width"),
+   "preferred_document_width", 0, 0, , 80,
+   N_("Try to fit the document within this width.  If set to zero,"
+   "use screen width.")),
+
+   INIT_OPT_BOOL("document.browse", N_("Whether to use preferred document 
width."),
+   "use_preferred_document_width", 0, 1,
+   N_("Whether to use preferred document width.  If set to zero,\n"
+   "use screen width.  If set to one, use 
preferred_document_width.")),
+
INIT_OPT_BOOL("document.browse", N_("Document meta refresh"),
"refresh", 0, 1,
N_("Automatically follow document-specified refresh "
diff --git a/src/document/html/parser.c b/src/document/html/parser.c
index f3305db..c3cd635 100644
--- a/src/document/html/parser.c
+++ b/src/document/html/parser.c
@@ -930,7 +930,7 @@ init_html_parser(struct uri *uri, struct document_options 
*options,
par_format.leftmargin = options->margin;
par_format.rightmargin = options->margin;
 
-   par_format.width = options->box.width;
+   par_format.width = options->document_width;
par_format.list_level = par_format.list_number = 0;
par_format.dd_margin = options->margin;
par_format.flags = P_NONE;
diff --git a/src/document/html/parser/forms.c b/src/document/html/parser/forms.c
index 95bdf61..9a642b8 100644
--- a/src/document/html/parser/forms.c
+++ b/src/document/html/parser/forms.c
@@ -323,8 +323,8 @@ html_input(struct html_context *html_context, unsigned char 
*a,
if (fc->size == -1)

Re: [elinks-dev] [PATCH 09/10] Add preferred_document_width option.

2009-05-13 Thread أحمد المحمودي
Hello,

  I am trying your patches, I get these messages from elinks, I think 
  the reason is patch #9:

DEBUG MESSAGE at /tmp/buildd/elinks-0.13~20090512/src/config/options.c:306: 
get_opt_*("document.browse.use_preferred_document_width") @ 
/tmp/buildd/elinks-0.13~20090512/src/document/options.c:37: call with wrapper 
for Boolean for option of type Integer

On Wed, May 13, 2009 at 12:01:56AM -0400, yozoh...@gmail.com wrote:
> Option document.browse.preferred_document_width controls the
> width of the document, so that documents are rendered with narrower
> width than screen width.  Makes it easier to read paragraphs.
> 
> Patch originally from Sharon Wood , see bug #1063.
> 
> Instead of using max_document_width as the hard limit to the document
> width, it uses a soft limit, where if the document does not fit (due to
> tables, etc.), then larger width is used.  This reduces the need for
> horizontal scrolling for wide documents.
> 
> Also added toggle-document-width action to toggle between preferred
> width and full screen width.  Initial toggle status is determined by
> document.browse.use_preferred_document_width option.
---end quoted text---

-- 
 ‎أحمد المحمودي (Ahmed El-Mahmoudy)
  Digital design engineer
 GPG KeyID: 0x9DCA0B27 (@ subkeys.pgp.net)
 GPG Fingerprint: 087D 3767 8CAC 65B1 8F6C  156E D325 C3C8 9DCA 0B27
___
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev