#5 pure java with jline

open
nobody
None
5
2013-02-20
2010-04-05
No

Here is a version of HenPlus that does not require the readline library. It uses JLine instead, a pure java implementation that provides most of the features. Adapting HenPlus to JLine was not such a difficult work. I am new to HenPlus, and don't know how the application behaves with readline, but this version works great.

The only missing feature is the key bindings, because JLine does not support the dynamic addition of bindings. Bindings are supported though, and only minor changes are necessary to support it, implying that 100% of the features can be available rather easily.

I am now using this pure java HenPlus, and since I find HenPlus awesome, I decided to post my version.

Oh, and I am using Maven to build and resolve dependencies. Just use mvn install to build the project.

Discussion

  • bundle of pure java HenPlus powered by JLine and Maven

     
    Attachments
  • deepcored
    deepcored
    2010-09-09

    Great job!

    I had an UTF-8 issue with henplus/libjreadline-java in Linux some time ago. It didn't read multi-line UTF-8 strings correctly so I was thinking about doing the same thing, but I managed to fix this issue with the following patch later on:

    [code]
    diff -Naur ./src/native/org_gnu_readline_Readline.c ../../libreadline-java-0.8.0/src/native/org_gnu_readline_Readline.c
    --- ./src/native/org_gnu_readline_Readline.c 2003-01-07 20:14:35.000000000 +1000
    +++ ../../libreadline-java-0.8.0/src/native/org_gnu_readline_Readline.c 2010-07-28 16:20:37.433083185 +1000
    @@ -576,6 +576,8 @@
    return NULL;
    }

    + strcpy(buffer, utf8); return buffer;
    +
    for (i=0,pin=utf8,pout=buffer; i<bufLength && *pin; i++,pin++,pout++) {
    current = *pin;
    if (current >= 0xE0) { /* we support only two-byte utf8 */
    @@ -613,6 +615,8 @@
    return NULL;
    }

    + strcpy(buffer, ucs); return buffer;
    +
    for (i=0,pin=ucs,pout=buffer; i<bufLength && *pin; i++,pin++,pout++) {
    current = *pin;
    if (current < 0x80) /* one-byte utf8 */
    [/code]

    Yeah, that's a brutal hack, but it works. This should be a Linux-only issue.

    Cheers,
    Evgeny.