summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-22 06:04:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-22 06:04:04 -0700
commitd0c25e3cb12f6905a68952b0eeb9c17f6edcee48 (patch)
tree347f2e5aae2d4c42f0b18c9be5021a00e090f141
parentcaca753c5fef9c52a3fda44f31ca86be0d36509e (diff)
downloadtxr-d0c25e3cb12f6905a68952b0eeb9c17f6edcee48.tar.gz
txr-d0c25e3cb12f6905a68952b0eeb9c17f6edcee48.tar.bz2
txr-d0c25e3cb12f6905a68952b0eeb9c17f6edcee48.zip
linenoise: selection endpoint toggle with Ctrl-^.
* linenoise/linenoise.c (edit): Implemented. * txr.1: Documented.
-rw-r--r--linenoise/linenoise.c9
-rw-r--r--txr.18
2 files changed, 17 insertions, 0 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c
index 782fdfde..7dd29aa5 100644
--- a/linenoise/linenoise.c
+++ b/linenoise/linenoise.c
@@ -1870,6 +1870,15 @@ static int edit(lino_t *l, const char *prompt)
l->dsel = l->dend = l->dpos;
l->need_refresh = 1;
break;
+ case CTL('^'):
+ if (l->selmode)
+ {
+ size_t tmp = l->dsel;
+ l->dsel = l->dend;
+ l->dend = l->dpos = tmp;
+ l->need_refresh = 1;
+ }
+ break;
case CTL('Y'):
yank_sel(l);
clear_sel(l);
diff --git a/txr.1 b/txr.1
index 76fda8f6..273dd533 100644
--- a/txr.1
+++ b/txr.1
@@ -33909,6 +33909,14 @@ the mode.
Tab completion, history navigation, history search and editing in an external
editor all cancel visual selection mode.
+.NP* Selection Endpoint Toggle
+
+In visual selection, the starting point of the selection remains fixed, while
+the ending point tracks the movement of the cursor. The Ctrl-^ command will
+exchange the two points. The effect is that the cursor jumps to the opposite
+end of the selection. That end is now the ending point which tracks the cursor
+movement.
+
.NP* Visual Copy
The Ctrl-Y command ("yank") copies the selected text into a clipboard buffer.