From 047cf9be9c029d560deba431a1889279349f870a Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 22 Aug 2017 15:59:20 +0200 Subject: [PATCH] moving: improve retention of the target column somewhat It's not yet good enough: when proper_x() pushes the index forward, maybe it should also increase leftedge? Or go_forward_chunks()? --- src/move.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/move.c b/src/move.c index d19e9b2c..c758ec89 100644 --- a/src/move.c +++ b/src/move.c @@ -52,8 +52,10 @@ void get_edge_and_target(size_t *leftedge, size_t *target_column) { #ifndef NANO_TINY if (ISSET(SOFTWRAP)) { + size_t shim = editwincols * (1 + (tabsize / editwincols)); + *leftedge = leftedge_for(xplustabs(), openfile->current); - *target_column = openfile->placewewant - *leftedge; + *target_column = (openfile->placewewant + shim - *leftedge) % editwincols; } else #endif {