From: Michael D. Lowis Date: Fri, 17 Mar 2017 16:26:50 +0000 (-0400) Subject: reprioritized selection logic so that blocks will be selected when the brace is the... X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=5670b5b4737ee354292eed9e64adc79d22f45a08;p=projs%2Ftide.git reprioritized selection logic so that blocks will be selected when the brace is the first character on a line --- diff --git a/lib/view.c b/lib/view.c index 3c62e97..a816b22 100644 --- a/lib/view.c +++ b/lib/view.c @@ -298,17 +298,17 @@ static void selcontext(View* view, Sel* sel) { Buf* buf = &(view->buffer); size_t bol = buf_bol(buf, sel->end); Rune r = buf_get(buf, sel->end); - if (sel->end == bol || r == '\n' || r == RUNE_CRLF) { - sel->beg = bol; - sel->end = buf_eol(buf, sel->end); - } else if (risword(r)) { - buf_getword(buf, risword, sel); - } else if (r == '(' || r == ')') { + if (r == '(' || r == ')') { buf_getblock(buf, '(', ')', sel); } else if (r == '[' || r == ']') { buf_getblock(buf, '[', ']', sel); } else if (r == '{' || r == '}') { buf_getblock(buf, '{', '}', sel); + } else if (sel->end == bol || r == '\n' || r == RUNE_CRLF) { + sel->beg = bol; + sel->end = buf_eol(buf, sel->end); + } else if (risword(r)) { + buf_getword(buf, risword, sel); } else { buf_getword(buf, risbigword, sel); }