Index | Thread | Search

From:
Johannes Thyssen Tishman <jtt@openbsd.org>
Subject:
ksh: yank on 'change' in vi-mode
To:
tech@openbsd.org
Date:
Sat, 28 Mar 2026 17:25:27 +0000

Download raw body.

Thread
Currently, only 'delete' operations in ksh's vi mode yank the deleted
range to the yank buffer. The diff below modifies 'change' operations to
do the same. This is consistent vi(1)'s behavior.

All ksh regression tests are passing.

diff /usr/src
path + /usr/src
commit - cc88cbeddb7d5a75202cbffeb7b3d5e6cd8cbbc0
blob - d296e018c606ebfd1e47887ea563364758d45bc1
file + bin/ksh/vi.c
--- bin/ksh/vi.c
+++ bin/ksh/vi.c
@@ -819,7 +819,7 @@ vi_cmd(int argcnt, const char *cmd)
 						c2++;
 				}
 			}
-			if (*cmd != 'c' && c1 != c2)
+			if (c1 != c2)
 				yank_range(c1, c2);
 			if (*cmd != 'y') {
 				del_range(c1, c2);
@@ -858,6 +858,7 @@ vi_cmd(int argcnt, const char *cmd)
 
 		case 'C':
 			modified = 1; hnum = hlast;
+			yank_range(es->cursor, es->linelen);
 			del_range(es->cursor, es->linelen);
 			insert = INSERT;
 			break;