From 5670b5b4737ee354292eed9e64adc79d22f45a08 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 17 Mar 2017 12:26:50 -0400 Subject: [PATCH] reprioritized selection logic so that blocks will be selected when the brace is the first character on a line --- lib/view.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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); } -- 2.51.0