Re: some problems with do_*_ca_mode()

2005-11-24 Thread Bart Oldeman

On Thu, 24 Nov 2005, Andrey V. Malyshev wrote:


JN #ifdef HAVE_SLANG
JN   SLtt_write_string (ti_cap);
JN #else
JN   putp (ti_cap);
JN #endif
JN and similarly for the te_cap.

I argee, of course. Modified patch is attached.


You could also just fprintf the string to stdout. As far as I can see the 
main aim of your patch is to get the information out of terminfo.


also I think that the test

   if ((!xterm_flag)||(!ti_cap))
  return;

can simply be

   if (!ti_cap)
 return;


JN The question is whether not to call SLtt_initialize () and friends in
JN case of slang instead as slang takes care of setting proper ti/te
JN sequences itself.

Hmm. For now we combine this approaches: we call SLtt_initialize (), we  let
slang to take care of init itselt and prepare the SLtt_tgetstr() to work.
And then we use it to obtain ti/te sequences using proper slang mechanisms.

And the same in ncurses case, BTW.

The main points are:

from main():

#ifdef HAVE_SLANG
(1)slang_init () - [ SLtt_get_terminfo() - SLtt_initialize() -
Term_Init_Str = SLtt_tgetstr (ti) ]
#else
(2)init_curses () - [ initscr() - setupterm() ]
#endif
   init_xterm_support ();

Using [] brackets I've marked slang internal code at (1) and ncurses
internal code at (2).
The Term_Init_Str is internal slang variable, and it is unavailable for us
in common case. This is correct for current mcslang and libslang-1.4.9 both.

So, what prevents us from calling the same SLtt_tgetstr (ti) routine from
init_xterm_support() under #ifdef HAVE_SLANG?


it's just double work... look here:
main() - init_curses() - [ SLsmg_init_smg() - tt_init_video() (set to 
SLtt_init_video()) - tt_write_string (Term_Init_Str); ]


Bart

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: some problems with do_*_ca_mode()

2005-11-24 Thread Andrey V. Malyshev
Hello, Bart!
You wrote to Andrey V. Malyshev [EMAIL PROTECTED] on Thu, 24 Nov 2005
22:10:05 +1300 (NZDT):

JN #ifdef HAVE_SLANG
JN   SLtt_write_string (ti_cap);
JN #else
JN   putp (ti_cap);
JN #endif
JN and similarly for the te_cap.
??
?? I argee, of course. Modified patch is attached.
BO You could also just fprintf the string to stdout.

Yes. But I prefer to use specialized routines :)
If manual tells: All  terminfo strings [including the output of tparm]
should be printed with tputs or putp then maybe it is mandatory in some
cases, maybe somewhere fprintf can work wrong? I dont know.

BO As far as I can see the main aim of your patch is to get the
BO information out of terminfo.
BO also I think that the test
BO if ((!xterm_flag)||(!ti_cap))
BOreturn;
BO can simply be
BO if (!ti_cap)
BO   return;

I think, here we must decide basically: whether we want to print ti/te
_only_ if we have xterm_flag0 (i.e. xterm-like terminal) or in any case
(when these capabilities exist in terminal description)? According to my
termcap (from FreeBSD 5.4) there are a good many non-xterm terminals
supporting ti/te.

JN The question is whether not to call SLtt_initialize () and friends in
JN case of slang instead as slang takes care of setting proper ti/te
JN sequences itself.
??
?? Hmm. For now we combine this approaches: we call SLtt_initialize (),
?? we  let slang to take care of init itselt and prepare the
?? SLtt_tgetstr() to work. And then we use it to obtain ti/te sequences
?? using proper slang mechanisms. And the same in ncurses case, BTW. The
?? main points are: from main(): #ifdef HAVE_SLANG (1)slang_init ()
?? - [ SLtt_get_terminfo() - SLtt_initialize() - Term_Init_Str =
?? SLtt_tgetstr (ti) ] #else (2)init_curses () - [ initscr() -
?? setupterm() ] #endif   init_xterm_support (); Using [] brackets
?? I've marked slang internal code at (1) and ncurses internal code at
?? (2). The Term_Init_Str is internal slang variable, and it is
?? unavailable for us in common case. This is correct for current mcslang
?? and libslang-1.4.9 both. So, what prevents us from calling the same
?? SLtt_tgetstr (ti) routine from init_xterm_support() under #ifdef
?? HAVE_SLANG?

BO it's just double work... look here:
BO main() - init_curses() - [ SLsmg_init_smg() - tt_init_video() (set
BO to SLtt_init_video()) - tt_write_string (Term_Init_Str); ]

You are right *. It is an overlook on my part :)
As far as I understand, using this we will necessarily need to add
SLsmg_reset_smg() call on exit, in slang_shutdown().

Lets answer the previous question (for ncurses case) and I'll rewrite the
patch once more.

(*) By the way: in the slvideo.c file is defined another  SLtt_init_video()
function. It what cases this file is used instead of sldisply.c? I could not
understand off-hand. Looks like MSDOS-version :)

-- 
With best regards, Andrey V. Malyshev.
E-mail: [EMAIL PROTECTED] 

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: some problems with do_*_ca_mode()

2005-11-24 Thread Leonard den Ottolander
Hello Andrey,

On Thu, 2005-11-24 at 18:56 +0700, Andrey V. Malyshev wrote:
 (*) By the way: in the slvideo.c file is defined another  SLtt_init_video()
 function. It what cases this file is used instead of sldisply.c? I could not
 understand off-hand. Looks like MSDOS-version :)

The slang directory you are referring to contains the internal version
of slang that is used when mc is configured --with-screen=mcslang. It
has been recently updated to version 2.0.5.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: some problems with do_*_ca_mode()

2005-11-24 Thread Andrey V. Malyshev
Hello, Leonard!
You wrote to MC development mc-devel@gnome.org on Thu, 24 Nov 2005 
13:46:23 +0100:

 LdO On Thu, 2005-11-24 at 18:56 +0700, Andrey V. Malyshev wrote:
 ?? (*) By the way: in the slvideo.c file is defined another
 ?? SLtt_init_video() function. It what cases this file is used instead of
 ?? sldisply.c? I could not understand off-hand. Looks like MSDOS-version
 ?? :)
 LdO The slang directory you are referring to contains the internal version
 LdO of slang that is used when mc is configured --with-screen=mcslang. It
 LdO has been recently updated to version 2.0.5.

Both libslang 1.4.9 and 2.0.5 versions contains slvideo.c file.
But what is it - that is the question (c) :)

-- 
With best regards, Andrey V. Malyshev.
E-mail: [EMAIL PROTECTED] 

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: some problems with do_*_ca_mode()

2005-11-24 Thread Jindrich Novy
Hello Andrey,

On Thu, 2005-11-24 at 13:46 +0100, Leonard den Ottolander wrote:
 Hello Andrey,
 
 On Thu, 2005-11-24 at 18:56 +0700, Andrey V. Malyshev wrote:
  (*) By the way: in the slvideo.c file is defined another  SLtt_init_video()
  function. It what cases this file is used instead of sldisply.c? I could not
  understand off-hand. Looks like MSDOS-version :)
 
 The slang directory you are referring to contains the internal version
 of slang that is used when mc is configured --with-screen=mcslang. It
 has been recently updated to version 2.0.5.

Just to clarify it, the newer slang contains more implementations of
SLtt_init_video() in slvideo.c for different build environments such as
DJGPP, EMX, etc. The one we are interested in is the single one in
sldisply.c so you can safely ignore slvideo.c ;)

Jindrich
-- 
Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: some problems with do_*_ca_mode()

2005-11-24 Thread Bart Oldeman

On Thu, 24 Nov 2005, Andrey V. Malyshev wrote:


BO it's just double work... look here:
BO main() - init_curses() - [ SLsmg_init_smg() - tt_init_video() (set
BO to SLtt_init_video()) - tt_write_string (Term_Init_Str); ]

You are right *. It is an overlook on my part :)
As far as I understand, using this we will necessarily need to add
SLsmg_reset_smg() call on exit, in slang_shutdown().


endwin() does that already as far as I can see.


Lets answer the previous question (for ncurses case) and I'll rewrite the
patch once more.


There is more going on. ncurses also automatically sends 
the relevant string automatically, in _nc_mvcur_init() (called via 
newterm() from initscr(), in the ncurses source code).


I wonder what the purpose is of do_enter_ca_mode now. Maybe it is just a 
left-over, necessary for other (non-ncurses) curses libraries, or xterms 
with broken terminfo's.



(*) By the way: in the slvideo.c file is defined another  SLtt_init_video()
function. It what cases this file is used instead of sldisply.c? I could not
understand off-hand. Looks like MSDOS-version :)


Yes, there are variations for various other operating systems/environments 
there.


Bart
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Fwd: some problems with do_*_ca_mode()

2005-11-23 Thread Jindrich Novy
Hi Andrey, Leonard,

On Fri, 2005-11-18 at 14:26 +0100, Leonard den Ottolander wrote:
 Hi Andrey,
 
 On Fri, 2005-11-18 at 11:03 +0700, Andrey V. Malyshev wrote:
  I can not test it under the real xterm console (with X), I have not one. I
  think it is nessessary before commiting, can everyone do it?
 
 Maybe somebody will beat me to it. Otherwise I'll do. Even though your
 explanation sounds senisible I'd like to hear some other peoples opinion
 though.

I agree with Andrey here, that we should use ti and te sequences
acquired from termcap database instead of hardcoded ones. The problem is
that Andrey uses direct putp() calls. The putp() belongs to ncurses and
it doesn't seem to work when slang support is enabled.

I propose this way to write termcap sequences to the terminal what
should work even with slang:

#ifdef HAVE_SLANG
  SLtt_write_string (ti_cap);
#else
  putp (ti_cap);
#endif

and similarly for the te_cap. The question is whether not to call
SLtt_initialize () and friends in case of slang instead as slang takes
care of setting proper ti/te sequences itself.

Jindrich
-- 
Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: some problems with do_*_ca_mode()

2005-11-23 Thread Andrey V. Malyshev
Hello, Jindrich!
You wrote to Leonard den Ottolander [EMAIL PROTECTED] on Wed, 23 
Nov 2005 20:23:37 +0100:

 JN I agree with Andrey here, that we should use ti and te sequences
 JN acquired from termcap database instead of hardcoded ones. The problem
 JN is that Andrey uses direct putp() calls. The putp() belongs to ncurses
 JN and it doesn't seem to work when slang support is enabled.
 JN I propose this way to write termcap sequences to the terminal what
 JN should work even with slang:

 JN #ifdef HAVE_SLANG
 JN   SLtt_write_string (ti_cap);
 JN #else
 JN   putp (ti_cap);
 JN #endif
 JN and similarly for the te_cap.

I argee, of course. Modified patch is attached.

 JN The question is whether not to call SLtt_initialize () and friends in
 JN case of slang instead as slang takes care of setting proper ti/te
 JN sequences itself.

Hmm. For now we combine this approaches: we call SLtt_initialize (), we  let 
slang to take care of init itselt and prepare the SLtt_tgetstr() to work. 
And then we use it to obtain ti/te sequences using proper slang mechanisms.

And the same in ncurses case, BTW.

The main points are:

from main():

#ifdef HAVE_SLANG
(1)slang_init () - [ SLtt_get_terminfo() - SLtt_initialize() - 
Term_Init_Str = SLtt_tgetstr (ti) ]
#else
(2)init_curses () - [ initscr() - setupterm() ]
#endif
init_xterm_support ();

Using [] brackets I've marked slang internal code at (1) and ncurses 
internal code at (2).
The Term_Init_Str is internal slang variable, and it is unavailable for us 
in common case. This is correct for current mcslang and libslang-1.4.9 both.

So, what prevents us from calling the same SLtt_tgetstr (ti) routine from 
init_xterm_support() under #ifdef HAVE_SLANG?

-- 
With best regards, Andrey V. Malyshev.
E-mail: [EMAIL PROTECTED] 


patch-xterm-ca-mode.gz
Description: Binary data
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Fwd: some problems with do_*_ca_mode()

2005-11-18 Thread Leonard den Ottolander
Hi Andrey,

On Fri, 2005-11-18 at 11:03 +0700, Andrey V. Malyshev wrote:
 I can not test it under the real xterm console (with X), I have not one. I
 think it is nessessary before commiting, can everyone do it?

Maybe somebody will beat me to it. Otherwise I'll do. Even though your
explanation sounds senisible I'd like to hear some other peoples opinion
though.

 My English limps :) But I'll try.

I'll fix it up :) . Thanks.

 Is it possible to obtain basic cvs-version of mc? If yes - how?

Sure. See http://savannah.gnu.org/cvs/?group=mc .

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


some problems with do_*_ca_mode()

2005-11-17 Thread Andrey V. Malyshev
Hello!

I've found some problems in mc-4.6.1 connected to do_enter_ca_mode() and
do_exit_ca_mode() functions.
Also I've written patch solving them (as it seems to me, at least:-)

1). do_enter_ca_mode() and do_exit_ca_mode() functions use hardcoded values
for Termcap capabilities ti and te (smcup and rmcup in Terminfo
terms). But, for example, FreeBSD/termcap xterm definition looks like
-- xterm| xterm-color|X11 terminal emulator:\
-- :ti@:te@:tc=xterm-xfree86:
i.e. this capabilities are declared as absent. Other xterm-like terminals
have other values, differs from hardcoded.
* I offer to detect this values during startup using SLang/curses *getstr
call.

2). do_enter_ca_mode() do nothing when called during startup, because
xterm_flag is always zero at that moment.
* I offer to add do_enter_ca_mode() call to init_xterm_support() function.

3). do_exit_ca_mode() is not called on shutdown if ncurses library used,
even if do_enter_ca_mode() was called previously.
* I offer to add do_exit_ca_mode() to shutdown block.

4). Both do_enter_ca_mode() and do_exit_ca_mode() uses fprintf(stdout,...),
but man curs_terminfo recommends putp() using.
* I offer to replace fprintf() call with putp().

And the last:
I've changed xmouse_seq determinining in the init_xterm_support()
function. Termcap/Terminfo structures are already initialized at that
moment, there is no need to call SLtt_tigetent(). More, it is better to call
SLtt_tgetstr() because it works in both Slang/Termcap and Slang/Terminfo
cases, in opposite to SLtt_tigetstr(), wich works in Slang/Terminfo case
only.

The patch for all things is attached.

Thanks for attention.
If there are any mistakes or misunderstandings here, point me to them,
please :-)

-- 
With best regards, Andrey V. Malyshev.
E-mail: [EMAIL PROTECTED] 


patch-xterm-ca-mode.dat
Description: Binary data
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: some problems with do_*_ca_mode()

2005-11-17 Thread Leonard den Ottolander
Hi Andrey,

On Thu, 2005-11-17 at 20:36 +0700, Andrey V. Malyshev wrote:
 I've found some problems in mc-4.6.1 connected to do_enter_ca_mode() and
 do_exit_ca_mode() functions.

What problems are you seeing?

 * I offer to detect this values during startup using SLang/curses *getstr
 call.

 * I offer to add do_enter_ca_mode() call to init_xterm_support() function.

 * I offer to add do_exit_ca_mode() to shutdown block.

 * I offer to replace fprintf() call with putp().

 I've changed xmouse_seq determinining in the init_xterm_support()
 function.

These proposals sound very sensible (afaict ;) ). Great explanation. If
noone has objections I think we should commit this patch. Could you
please provide a ChangeLog entry?

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Fwd: some problems with do_*_ca_mode()

2005-11-17 Thread Andrey V. Malyshev

This is copy for mailing-list, sorry.

==
* Forwarded by Andrey V. Malyshev [EMAIL PROTECTED]
* From: Andrey V. Malyshev [EMAIL PROTECTED]
* Date: Fri, 18 Nov 2005 11:01:46 +0700
* To: Leonard den Ottolander [EMAIL PROTECTED]
* Subj: Re: some problems with do_*_ca_mode()
==

Hello, Leonard!
You wrote to MC development mc-devel@gnome.org on Thu, 17 Nov 2005
22:11:50 +0100:

?? I've found some problems in mc-4.6.1 connected to do_enter_ca_mode()
?? and do_exit_ca_mode() functions.
LdO What problems are you seeing?

The source problem was unwrapped output.
I work with FreeBSD(4.11, 5.4) using SecureCRT ssh-client. When I use
xterm terminal in SCRT session options, everything works fine with mc
except one: starting mc disables line wrapping. For example, if  I write
under mc:
$ echo o(many times, 200)
it is echoing as one string without any wrapping. The same for ps axww and
so on.
Sending proper ca_mode codes fix it, as far as I see.

LdO If noone has objections I think we should commit this patch.

I can not test it under the real xterm console (with X), I have not one. I
think it is nessessary before commiting, can everyone do it?

LdO Could you please provide a ChangeLog entry?

My English limps :) But I'll try.

src/main.c
* The way of detecting xmouse_seq terminal capability changed.
* Detecting of enter_ca_mode and exit_ca_mode terminal capabilities
added.
* Calling of do_enter_ca_mode() at startup and do_exit_ca_mode() at shutdown
fixed.
src/main.h
* Detecting of enter_ca_mode and exit_ca_mode terminal capabilities
added.
src/win.c
* Using detected enter_ca_mode and exit_ca_mode terminal capabilities
instead of hardcoded.
* Calling putp() instead of fprintf() in do_enter_ca_mode() and
do_exit_ca_mode().

P.S.
Is it possible to obtain basic cvs-version of mc? If yes - how?

==
With best regards, Andrey V. Malyshev.
E-mail: [EMAIL PROTECTED] 

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel