bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Near Proof of concept of an )edit somefunction_name


From: Christian Robert
Subject: Re: [Bug-apl] Near Proof of concept of an )edit somefunction_name
Date: Wed, 23 Mar 2016 23:21:40 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

David,

 Do you still have access to the aplwrap GitHub login ?

 This evening I had tracked down why it sometime (aplwrap) abort/coredump on me.

 this is a one line change into file src/txtbuf.c
 since I made that change I can no longer make it abort on me.

int
handle_copy_down ()
{
  GtkTextIter start_iter, end_iter;
  if (gtk_text_buffer_get_selection_bounds (buffer, &start_iter, &end_iter)) {
    //  Case 1: selection is not empty
    //
    //  If selection does not span newline
    //    copy selection to end of buffer
    //    If selection does not end with a space
    //      append a space to end of buffer
    //    *Do not* scroll to end!
    gchar *text = gtk_text_buffer_get_text (buffer,
                                            &start_iter,
                                            &end_iter,
                                            FALSE);
    if (text == NULL || strchr (text, '\n')) return 0;

    gtk_text_buffer_get_end_iter (buffer, &end_iter);
    gtk_text_buffer_place_cursor (buffer, &end_iter);
    gtk_text_buffer_insert_at_cursor (buffer, text, -1);
    if (text[strlen(text)-1] != ' ')
      gtk_text_buffer_insert_at_cursor (buffer, " ", -1);

    g_free (text);
    return 1;
  }
  else {
    //  Case 2: selection is empty
    //
    //  If cursor is in previous input
    //    copy previous input to end of buffer
    //    scroll to end of buffer
    GtkTextIter insert_iter;
    GtkTextMark *mark = gtk_text_buffer_get_insert (buffer);
    gtk_text_buffer_get_iter_at_mark (buffer, &insert_iter, mark);
    if (gtk_text_iter_has_tag (&insert_iter, get_tag(TAG_INP))) {
      gint sz;
      gchar *text = get_input_text (&sz);
      gchar *ztext = g_try_malloc (sz+1-6);
      if (ztext) {
        memcpy(ztext, text+6, sz-6);
//      ztext[sz] = '\0';                      // <-- *before*
        ztext[sz-6] = '\0';                    // <-- *after*
        handle_history_replacement (ztext);
        g_free (ztext);
      }
      return 1;
    }
    else if (gtk_text_iter_has_tag (&insert_iter, get_tag(TAG_LCK)))
      return 1;
    return 0;
  }
}


It may be also a good idea to make it work without Warning with gtk-3.0 
(warnings stop the compilation, had to remove -Werror in Makefiles)
and it also complain about:

WARNING: 'aclocal-1.13' is missing on your system.
WARNING: 'automake-1.13' is missing on your system.

solved by manually run aclocal and automake after ./configure ...


Xtian.


On 2016-03-21 22:43, David B. Lamkins wrote:
On Tue, Mar 22, 2016 at 09:50:02AM +0800, Elias Mårtenson wrote:
    There was another project that
    aimed to provide something similar, using a dedicated application
    called aplwrap. What happened to that?

Chris Moller wrote aplwrap. I contributed some improvements and was the last 
person to work on the project. (Chris was kind enough to share his GitHub login 
with me when he got busy with other commitments; I haven't heard from Chris 
since then.)

Chris Moller also wrote aplplot, which can be used standalone or from aplwrap.

To the best of my knowledge, aplwrap *should* still be viable. I personally 
stopped using aplwrap when my own apl-pkg project reached the point where I was 
comfortable working within that environment.

In apl-pkg I took the approach of shelling out to an external editor. No 
particular reason, save that I wasn't particularly interested in writing an 
editor in APL, which would have gootten pretty complicated had I attempted to 
emulate some kind of full-screen interface.

FWIW, apl-pkg is much more than a wrapper around an external editor. Similar to 
gnu-apl-mode, apl-pkg provides a number of tools for programming-in-the-large.

Before aplwrap and apl-pkg I very much liked gnu-apl-mode. A couple years back 
-- after having used Emacs for four decades -- I wanted to *finally* learn vi, 
so I ditched Emacs and switched everything over to vim (and more recently, vis).

Referenced Projects:
https://github.com/ChrisMoller/aplwrap
https://github.com/tiedyeddevil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]