<div dir="ltr"><div>Hi Bill,</div><div> </div><div>> It looks like the text actually has the bytes "Enter" at the    newlines, rather than, say, a '\n'?</div><div> </div><div>In fact, it is '\r' (carriage return) rather than '\n' (new line). In renders correctly with Pango, though, and would paste gracefully to other clients such as weston-terminal.</div>
<div> </div><div>The only problem would be if we made weston-terminal save its text buffer directly to a file, in which case most text editors would display an uninterpreted special character. Note that we do not do that yet, though.</div>
<div> </div><div>Regards,</div><div>Manuel</div><div> </div><div> </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-21 21:49 GMT+02:00 Bill Spitzak <span dir="ltr"><<a href="mailto:spitzak@gmail.com" target="_blank">spitzak@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    It looks like the text actually has the bytes "Enter" at the
    newlines, rather than, say, a '\n'?<div><div class="h5"><br>
    <br>
    <div>On 04/18/2014 03:52 AM, Manuel Bachmann
      wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div>This fixes :<br>
          <a href="https://bugs.freedesktop.org/show_bug.cgi?id=77496" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=77496</a><br>
          <br>
        </div>
        Regards,<br>
        Manuel<br>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2014-04-18 12:50 GMT+02:00 Manuel
          Bachmann <span dir="ltr"><<a href="mailto:manuel.bachmann@open.eurogiciel.org" target="_blank">manuel.bachmann@open.eurogiciel.org</a>></span>:<br>
          <blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
            The editor will now insert new lines and tabulations when<br>
            pressing the corresponding keys on the virtual keyboard.<br>
            <br>
            The Up and Down arrows can be used to navigate through<br>
            lines.<br>
            <br>
            Signed-off-by: Manuel Bachmann <<a href="mailto:manuel.bachmann@open.eurogiciel.org" target="_blank">manuel.bachmann@open.eurogiciel.org</a>><br>
            ---<br>
             clients/editor.c |   97
            ++++++++++++++++++++++++++++++++++++++++++++++++------<br>
             1 file changed, 87 insertions(+), 10 deletions(-)<br>
            <br>
            diff --git a/clients/editor.c b/clients/editor.c<br>
            index 76e2346..4c5c427 100644<br>
            --- a/clients/editor.c<br>
            +++ b/clients/editor.c<br>
            @@ -110,6 +110,47 @@ utf8_next_char(const char *p)<br>
                    return NULL;<br>
             }<br>
            <br>
            +static void<br>
            +move_up(const char *p, uint32_t *cursor)<br>
            +{<br>
            +       const char *posr, *posr_i;<br>
            +       char text[16];<br>
            +<br>
            +       xkb_keysym_to_utf8(XKB_KEY_Return, text,
            sizeof(text));<br>
            +<br>
            +       posr = strstr(p, text);<br>
            +       while (posr) {<br>
            +               if (*cursor > (unsigned)(posr-p)) {<br>
            +                       posr_i = strstr(posr+1, text);<br>
            +                       if (!posr_i || !(*cursor >
            (unsigned)(posr_i-p))) {<br>
            +                               *cursor = posr-p;<br>
            +                               break;<br>
            +                       }<br>
            +                       posr = posr_i;<br>
            +               } else {<br>
            +                       break;<br>
            +               }<br>
            +       }<br>
            +}<br>
            +<br>
            +static void<br>
            +move_down(const char *p, uint32_t *cursor)<br>
            +{<br>
            +       const char *posr;<br>
            +       char text[16];<br>
            +<br>
            +       xkb_keysym_to_utf8(XKB_KEY_Return, text,
            sizeof(text));<br>
            +<br>
            +       posr = strstr(p, text);<br>
            +       while (posr) {<br>
            +               if (*cursor <= (unsigned)(posr-p)) {<br>
            +                       *cursor = posr-p + 1;<br>
            +                       break;<br>
            +               }<br>
            +               posr = strstr(posr+1, text);<br>
            +       }<br>
            +}<br>
            +<br>
             static void text_entry_redraw_handler(struct widget
            *widget, void *data);<br>
             static void text_entry_button_handler(struct widget
            *widget,<br>
                                                  struct input *input,
            uint32_t time,<br>
            @@ -374,6 +415,23 @@ text_input_keysym(void *data,<br>
                            return;<br>
                    }<br>
            <br>
            +       if (key == XKB_KEY_Up ||<br>
            +           key == XKB_KEY_Down) {<br>
            +               if (state != WL_KEYBOARD_KEY_STATE_RELEASED)<br>
            +                       return;<br>
            +<br>
            +               if (key == XKB_KEY_Up)<br>
            +                       move_up(entry->text,
            &entry->cursor);<br>
            +               else<br>
            +                       move_down(entry->text,
            &entry->cursor);<br>
            +<br>
            +               if (!(modifiers &
            entry->keysym.shift_mask))<br>
            +                       entry->anchor = entry->cursor;<br>
            +               widget_schedule_redraw(entry->widget);<br>
            +<br>
            +               return;<br>
            +       }<br>
            +<br>
                    if (key == XKB_KEY_BackSpace) {<br>
                            const char *start, *end;<br>
            <br>
            @@ -395,17 +453,20 @@ text_input_keysym(void *data,<br>
                            return;<br>
                    }<br>
            <br>
            -       switch (key) {<br>
            -               case XKB_KEY_Tab:<br>
            -                       key_label = "Tab";<br>
            -                       break;<br>
            -               case XKB_KEY_KP_Enter:<br>
            -               case XKB_KEY_Return:<br>
            -                       key_label = "Enter";<br>
            -                       break;<br>
            -       }<br>
            +       if (key == XKB_KEY_Tab ||<br>
            +           key == XKB_KEY_KP_Enter ||<br>
            +           key == XKB_KEY_Return) {<br>
            +               char text[16];<br>
            +<br>
            +               if (state != WL_KEYBOARD_KEY_STATE_RELEASED)<br>
            +                       return;<br>
            +<br>
            +               xkb_keysym_to_utf8(key, text, sizeof(text));<br>
            <br>
            -       fprintf(stderr, "%s key was %s.\n", key_label,
            state_label);<br>
            +               text_entry_insert_at_cursor(entry, text, 0,
            0);<br>
            +<br>
            +               return;<br>
            +       }<br>
             }<br>
            <br>
             static void<br>
            @@ -1208,6 +1269,22 @@ key_handler(struct window *window,<br>
                                           
            widget_schedule_redraw(entry->widget);<br>
                                    }<br>
                                    break;<br>
            +               case XKB_KEY_Up:<br>
            +                       text_entry_commit_and_reset(entry);<br>
            +<br>
            +                       move_up(entry->text,
            &entry->cursor);<br>
            +                       if (!(input_get_modifiers(input)
            & MOD_SHIFT_MASK))<br>
            +                               entry->anchor =
            entry->cursor;<br>
            +                      
            widget_schedule_redraw(entry->widget);<br>
            +                       break;<br>
            +               case XKB_KEY_Down:<br>
            +                       text_entry_commit_and_reset(entry);<br>
            +<br>
            +                       move_down(entry->text,
            &entry->cursor);<br>
            +                       if (!(input_get_modifiers(input)
            & MOD_SHIFT_MASK))<br>
            +                               entry->anchor =
            entry->cursor;<br>
            +                      
            widget_schedule_redraw(entry->widget);<br>
            +                       break;<br>
                            case XKB_KEY_Escape:<br>
                                    break;<br>
                            default:<br>
            <span><font color="#888888">--<br>
                1.7.10.4<br>
                <br>
              </font></span></blockquote>
        </div>
        <br>
        <br clear="all">
        <br>
        -- <br>
        <div dir="ltr"><font>Regards,<br>
            <br>
            <i><b>Manuel BACHMANN</b><br>
              Tizen Project<br>
              VANNES-FR</i><br>
          </font></div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
wayland-devel mailing list
<a href="mailto:wayland-devel@lists.freedesktop.org" target="_blank">wayland-devel@lists.freedesktop.org</a>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><font>Regards,<br>
<br>
<i><b>Manuel BACHMANN</b><br>
Tizen Project<br>
VANNES-FR</i><br>
</font></div>
</div>