]> git.mdlowis.com Git - projs/tide.git/commitdiff
tweaked logic for setting implicit marks. local cursor movements no longer set the...
authorMichael D. Lowis <mike@mdlowis.com>
Wed, 31 May 2017 01:36:42 +0000 (21:36 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Wed, 31 May 2017 01:36:42 +0000 (21:36 -0400)
TODO.md
docs/tide.1
docs/tide.1.md
docs/xfilepick.1
docs/xtagpick.1
lib/view.c

diff --git a/TODO.md b/TODO.md
index 3edd2ff25b1ef3237729b3a0b29de080007d7511..0cd149b9bbf2a3f6d7de8fd860995c3109efaf67 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -6,6 +6,7 @@ Up Next:
     var infoId = 'readerinfo'+reader.id;
 * Add a way to CD using a builtin (buffers will track original dir)
 * shortcut to jump to previous edit
+* xrandr dpi setting does not affect tide like it should
 
 The Future:
 
index 2f739ffbd30b9258c870b3b1382a12273f7a3335..52abdcc74841e9243b468182bea80cbc00939142 100644 (file)
@@ -286,7 +286,7 @@ Lookup the selected symbol or symbol under the cursor in a ctags(1) generated in
 .
 .TP
 \fBCtrl+Shift+g\fR
-Jump to the previous cursor location\.
+Jump to the last implicitly marked location\. In general, actions that move the cursor potentially greate distances will set an implicit mark before performing the move\. These actions include, jumping to a ctag definition, jumping to a line, or clicking with the mouse\.
 .
 .TP
 \fBCtrl+n\fR
index 9d178e5fd8cb70a67bacb36383dd74d0ca113c55..6e33033262b948b9d44e02af34add377b599849c 100644 (file)
@@ -323,7 +323,10 @@ search operation to be applied in the opposite direction of the previous.
     the target file and the cursor set to the line containing the definition.
 
 * `Ctrl+Shift+g`:
-    Jump to the previous cursor location.
+    Jump to the last implicitly marked location. In general, actions that move
+    the cursor potentially greate distances will set an implicit mark before
+    performing the move. These actions include, jumping to a ctag definition,
+    jumping to a line, or clicking with the mouse.
 
 * `Ctrl+n`:
     Open a new instance of `tide` with no filename.
index b7f22f51f22fc7c395692247b6d30f5ab731daf6..39cf645e2148cdd533d0085aa69b77fda27187ff 100644 (file)
@@ -1,7 +1,7 @@
 .\" generated with Ronn/v0.7.3
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
-.TH "XFILEPICK" "1" "March 2017" "" ""
+.TH "XFILEPICK" "1" "May 2017" "" ""
 .
 .SH "NAME"
 \fBxfilepick\fR \- fuzzy find a file from the current directory tree
index 4aa214cd899de8a81882dacb8a900797da6bbb95..5377e2de59b6333322795b912a07f24216438c86 100644 (file)
@@ -1,7 +1,7 @@
 .\" generated with Ronn/v0.7.3
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
-.TH "XTAGPICK" "1" "March 2017" "" ""
+.TH "XTAGPICK" "1" "May 2017" "" ""
 .
 .SH "NAME"
 \fBxtagpick\fR \- Parses a ctags file and sends results to xpick
index e682c12b473d847adfa6475e6b925bc811e678fc..727aacedf95b740de82e70e54540ea51703ec171 100644 (file)
@@ -298,11 +298,8 @@ void view_byline(View* view, int move, bool extsel) {
 
 void view_setcursor(View* view, size_t row, size_t col) {
     size_t off = getoffset(view, row, col);
-    if (off != SIZE_MAX) {
-        view->selection.beg = view->selection.end = off;
-        view->selection.col = buf_getcol(&(view->buffer), view->selection.end);
-        view->sync_needed = true;
-    }
+    if (off != SIZE_MAX)
+        view_jumpto(view, false, off);
 }
 
 void view_selext(View* view, size_t row, size_t col) {
@@ -395,6 +392,15 @@ bool view_findstr(View* view, int dir, char* str) {
     return found;
 }
 
+static void move_to(View* view, bool extsel, size_t off) {
+    Buf* buf = &(view->buffer);
+    view->selection.end = (off > buf_end(buf) ? buf_end(buf) : off);
+    if (!extsel)
+        view->selection.beg = view->selection.end;
+    view->selection.col = buf_getcol(&(view->buffer), view->selection.end);
+    view->sync_needed = true;
+}
+
 void view_insert(View* view, bool indent, Rune rune) {
     /* ignore non-printable control characters */
     if (!isspace(rune) && rune < 0x20)
@@ -406,7 +412,7 @@ void view_insert(View* view, bool indent, Rune rune) {
         view->selection = sel;
     }
     unsigned newpos = buf_insert(&(view->buffer), indent, view->selection.end, rune);
-    view_jumpto(view, false, newpos);
+    move_to(view, false, newpos);
 }
 
 void view_delete(View* view, int dir, bool byword) {
@@ -415,17 +421,12 @@ void view_delete(View* view, int dir, bool byword) {
         (byword ? view_byword : view_byrune)(view, dir, true);
     selswap(sel);
     unsigned newpos = buf_delete(&(view->buffer), sel->beg, sel->end);
-    view_jumpto(view, false, newpos);
+    move_to(view, false, newpos);
 }
 
 void view_jumpto(View* view, bool extsel, size_t off) {
-    Buf* buf = &(view->buffer);
     view->prev_csr = view->selection.end;
-    view->selection.end = (off > buf_end(buf) ? buf_end(buf) : off);
-    if (!extsel)
-        view->selection.beg = view->selection.end;
-    view->selection.col = buf_getcol(&(view->buffer), view->selection.end);
-    view->sync_needed = true;
+    move_to(view, extsel, off);
 }
 
 void view_jumpback(View* view) {
@@ -441,11 +442,11 @@ void view_bol(View* view, bool extsel) {
     for (; ' ' == buf_get(buf, boi) || '\t' == buf_get(buf, boi); boi++);
     unsigned pos = view->selection.end;
     pos = (pos == bol || pos > boi ? boi : bol);
-    view_jumpto(view, extsel, pos);
+    move_to(view, extsel, pos);
 }
 
 void view_eol(View* view, bool extsel) {
-    view_jumpto(view, extsel, buf_eol(&(view->buffer), view->selection.end));
+    move_to(view, extsel, buf_eol(&(view->buffer), view->selection.end));
 }
 
 void view_bof(View* view, bool extsel) {
@@ -572,11 +573,13 @@ void view_csrsummon(View* view) {
     size_t col = SIZE_MAX, row = SIZE_MAX;
     find_cursor(view, &col, &row);
     size_t off = view->rows[view->nrows/2]->off;
-    if (row != SIZE_MAX && col != SIZE_MAX)
-        if (col >= view->rows[view->nrows/2]->rlen)
+    if (row != SIZE_MAX && col != SIZE_MAX) {
+        if (col >= view->rows[view->nrows/2]->rlen) {
             off = view->rows[view->nrows/2]->off + view->rows[view->nrows/2]->rlen - 1;
-        else
+        } else {
             off += col;
+        }
+    }
     view_jumpto(view, false, off);
     view->sync_needed = false;
 }