]> git.mdlowis.com Git - projs/tide.git/commitdiff
merge changes
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 9 Apr 2018 12:53:03 +0000 (08:53 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 9 Apr 2018 12:53:03 +0000 (08:53 -0400)
1  2 
inc/edit.h
lib/buf.c

diff --cc inc/edit.h
Simple merge
diff --cc lib/buf.c
index 222d238b226c1beb24ccfe4e9cca63ce6bab5c94,45e65626295b0731f0ce7959bdc46617f6c8c7dd..84713ae615dd8bc209ee23a9c7b743d433bbc52e
+++ b/lib/buf.c
@@@ -272,8 -279,10 +280,10 @@@ void buf_selctx(Buf* buf, bool (*isword
          selblock(buf, '[', ']');
      else if (r == '{' || r == '}')
          selblock(buf, '{', '}');
+     else if (r == '<' || r == '>')
+         selblock(buf, '<', '>');
      else if (buf->selection.end == bol || r == '\n')
 -        buf_selline(buf);
 +        selline(buf);
      else if (risword(r))
          buf_selword(buf, isword);
      else
@@@ -417,16 -426,16 +427,24 @@@ bool buf_insel(Buf* buf, size_t off) 
      return (off >= sel.beg && off < sel.end);
  }
  
+ char* buf_fetch(Buf* buf, bool (*isword)(Rune), size_t off) {
+     if (!buf_insel(buf, off)) {
+         buf->selection = (Sel){ .beg = off, .end = off };
+         buf_selword(buf, isword);
+     }
+     return buf_gets(buf);
+ }
  /******************************************************************************/
  
 +static void selline(Buf* buf) {
 +    Sel sel = getsel(buf);
 +    sel.beg = buf_bol(buf, sel.end);
 +    sel.end = buf_eol(buf, sel.end);
 +    sel.end = buf_byrune(buf, sel.end, RIGHT);
 +    buf->selection = sel;
 +}
 +
  static void selblock(Buf* buf, Rune first, Rune last) {
      Sel sel = getsel(buf);
      int balance = 0, dir;