After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 563057 - GNU Readline Bindings
GNU Readline Bindings
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings
0.5.x
Other All
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
: 592944 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-12-03 00:50 UTC by Frederik Zipp
Modified: 2009-11-20 07:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Beginning of GNU Readline Bindings (716 bytes, patch)
2008-12-03 00:51 UTC, Frederik Zipp
reviewed Details | Review
my take on readline.vapi (2.41 KB, text/x-vala)
2009-05-08 23:23 UTC, Michael 'Mickey' Lauer
  Details

Description Frederik Zipp 2008-12-03 00:50:31 UTC
There should be an easy and safe way for Vala explorers to read string user input from console. I have attached the beginning of a readline.vapi file which contains only two functions so far but can get extended as needed.

Example usage:

---------
static void main () {
    while (true) {
        var name = ReadLine.read_line ("Please enter your name: ");
        if (name != null && name != "") {
            stdout.printf ("Hello, %s!\n", name);
            ReadLine.add_history (name);
        }
    }
}
---------
$ valac --pkg readline -X -lreadline readlinesample.vala
$ ./readlinesample
Comment 1 Frederik Zipp 2008-12-03 00:51:09 UTC
Created attachment 123848 [details] [review]
Beginning of GNU Readline Bindings
Comment 2 Jürg Billeter 2008-12-15 23:32:24 UTC
Do we need to split bindings for libreadline and libhistory?
Comment 3 Frederik Zipp 2008-12-16 12:36:28 UTC
(In reply to comment #2)
> Do we need to split bindings for libreadline and libhistory?

No, I think they belong together. On my distribution they are packaged together, and I have never seen anyone using libhistory without libreadline.
Comment 4 Michael 'Mickey' Lauer 2009-05-08 23:23:03 UTC
Created attachment 134291 [details]
my take on readline.vapi

I'm using this in fso-term, a serial terminal program written in Vala.
Comment 5 Evan Nemerson 2009-11-20 07:26:00 UTC
*** Bug 592944 has been marked as a duplicate of this bug. ***
Comment 6 Evan Nemerson 2009-11-20 07:26:22 UTC
commit 84234c9a2ab6c9f9a4eb35bd6ce0a6e0b614f18d
Author: Jukka-Pekka Iivonen <jp0409@jippii.fi>
Date:   Thu Nov 19 23:21:11 2009 -0800

    Add readline bindings.
    
    Fixes bug 563057.