From 104ecf6a99b756bb60b35d8ddd3130e9c86641b2 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 19 May 2017 09:06:44 -0400 Subject: [PATCH] Fixed cursor column tracking for keyboard shortcuts and context selection --- TODO.md | 1 + TODO.sync-conflict-20170503-192815.md | 33 --------------------------- lib/view.c | 3 +++ 3 files changed, 4 insertions(+), 33 deletions(-) delete mode 100644 TODO.sync-conflict-20170503-192815.md diff --git a/TODO.md b/TODO.md index a098bd2..492a17f 100644 --- a/TODO.md +++ b/TODO.md @@ -2,6 +2,7 @@ Up Next: +* refactor selection handling to buf.c to prepare fo rmultiple selections. * refactor x11.c and win.c * Make Fn keys execute nth command in the tags buffers * Run commands in the background and don't block the main thread. diff --git a/TODO.sync-conflict-20170503-192815.md b/TODO.sync-conflict-20170503-192815.md deleted file mode 100644 index b5753e1..0000000 --- a/TODO.sync-conflict-20170503-192815.md +++ /dev/null @@ -1,33 +0,0 @@ -# Issue List - -Up Next: - -* refactor x11.c and win.c -* Make Fn keys execute nth command in the tags buffers -* Run commands in the background and don't block the main thread. -* check for file changes on save -* check for file changes when window regains focus -* 100% coverage with unit and unit-integration tests -* right click to fetch file or line -* Status line should omit characters from beginning of path to make file path fit - -Straight-up Bugs: - -* double free error on picking a tag with nothing in the buffer -* fix crash on saving read-only file -* fix crash on save to file that can't be created -* tab inserts dont coalesce like one would expect - -The Future: - -* shortcut to repeat previous operation -* add command line flags to toggle options (Tabs, Indent, etc..) -* add command env vars to set options (Tabs, Indent, etc..) -* implement command diffing logic to optimize the undo/redo log - -# Auxillary Programs - -* Visual diff tool -* Win-like terminal emulator -* File browser -* Acme-like window manager diff --git a/lib/view.c b/lib/view.c index 996c965..4e06d56 100644 --- a/lib/view.c +++ b/lib/view.c @@ -290,6 +290,7 @@ void view_selext(View* view, size_t row, size_t col) { size_t off = getoffset(view, row, col); if (off != SIZE_MAX) { view->selection.end = off; + view->selection.col = buf_getcol(&(view->buffer), view->selection.end); view_scrollto(view, view->selection.end); } } @@ -341,6 +342,7 @@ void view_select(View* view, size_t row, size_t col) { Sel sel = view->selection; selcontext(view, &sel); sel.end = buf_byrune(&(view->buffer), sel.end, RIGHT); + sel.col = buf_getcol(&(view->buffer), sel.end); view->selection = sel; } @@ -522,6 +524,7 @@ void view_selctx(View* view) { selcontext(view, &(view->selection)); view->selection.end = buf_byrune( &(view->buffer), view->selection.end, RIGHT); + view->selection.col = buf_getcol(&(view->buffer), view->selection.end); } } -- 2.52.0