[Gambas-user] Error in Left$ and Mid$ functions to the gb.ncurses component

tobi tobiasboege01 at ...1601...
Fri May 25 23:15:33 CEST 2012


On Sun, 20 May 2012, tobi wrote:
> On Sun, 20 May 2012, Benoît Minisini wrote:
> > Le 20/05/2012 16:26, William Cabrera a écrit :
> > > Hi, I have been testing the component ncurses and so far everything well,
> > > but the functions mentioned in the title simply do not work. Below is a
> > > sample code:
> > >
> > > #!/usr/bin/env gbs3
> > >
> > > USE "gb.ncurses"
> > >
> > > dim hwin As Window
> > > dim cadena, cad as string
> > > cadena = "Hola Mundo"
> > > cad = left(cadena)
> > > hwin = New Window(0, 0, 20, 30)
> > > hwin.Background = Color.Blue
> > > hwin.show()
> > > hwin.Full()
> > > hwin.print(right$(cadena), 0, 0)
> > > hwin.print(right$(cadena, 3), 0, 1)
> > > hwin.print(right$(cadena, -3), 0, 2)
> > > hwin.print(left$(cadena), 0, 3)
> > > hwin.print(left$(cadena, 3), 0, 4)
> > > hwin.print(left$(cadena, -3), 0, 5)
> > > hwin.print(mid$(cadena, 2, 2), 0, 6)
> > > hwin.WaitKey()
> > >
> > > And this is the output
> > >
> > > o
> > > ndo
> > > a Mundo
> > > Hola Mundo
> > > Hola Mundo
> > > Hola Mundo
> > > ola Mundo
> > >
> > > [System]
> > > OperatingSystem=Linux
> > > Kernel=3.2.0-1-686-pae
> > > Architecture=i686
> > > Memory=2065228 kB
> > > DistributionVendor=Asturix
> > > DistributionRelease="Asturix 4"
> > > Desktop=Gnome
> > >
> > > [Gambas 3]
> > > Version=3.1.90
> > > Path=/usr/local/bin/gbx3
> > >
> > > [Libraries]
> > > Qt4=libQtCore.so.4.8.1
> > > GTK+=libgtk-x11-2.0.so.0.2400.10
> > >
> > > P.D. Sorry for my english, this is not my native language
> > >
> > > ------
> > > William Cabrera
> > > http://willicab.gnu.org.ve
> > 
> > This is a bug in the gb.ncurses component whose methods do not read 
> > their string arguments correctly. Tobi are you here?
> > 
> > -- 
> > Benoît Minisini
> > 
> > ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and 
> > threat landscape has changed and how IT managers can respond. Discussions 
> > will include endpoint security, mobile security and the latest in malware 
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> I'm here and working! Sorry, haven't read the subject entirely when I first saw the incoming mail...
> 
> So you expect this output in the window, right?:
> 
> o
> ndo
> a Mundo
> H
> Hol
> Hola Mu
> ol
> 
> So my question bounces to Benoît: It's said in the docs that the three string functions used above
> are optimised so that they don't duplicate strings. Does that mean or is it a general fact that I
> cannot rely on the STRING() macro to extract a NUL-terminated string from a given GB_STRING
> argument? At least there doesn't seem to be a NUL byte which causes the component to print
> everything that follows until the end of the original string...
> Brief explanation and after lunch, it's done.
> 
> Regards,
> Tobi

There was an accumulation of changes due to an unfinished feature but I finally commited the fix for
that issue - component is still broken. Printing should work as expected now. But don't try to use
events in the meantime until.

However, thank you for pointing that out.

Regards,
Tobi




More information about the User mailing list