From 79b57c96d1978c58d4b9df11d41d8035bd105a56 Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Wed, 4 Jun 2014 11:32:50 +0800 Subject: [PATCH] insert-string can insert strings up to 512 characters. --- random.c | 4 ++-- tststr.cmd | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/random.c b/random.c index 55827af..ba87dca 100644 --- a/random.c +++ b/random.c @@ -1231,11 +1231,11 @@ int fmatch(int ch) int istring(int f, int n) { int status; /* status return code */ - char tstring[ NSTRING + 1] ; /* string to add */ + char tstring[ 512] ; /* string to add */ /* ask for string to insert */ status = - mlreplyt("String to insert: ", tstring, NSTRING, metac) ; + mlreplyt("String to insert: ", tstring, sizeof tstring - 1, metac) ; if (status != TRUE) return status; diff --git a/tststr.cmd b/tststr.cmd index 9f524b1..9089987 100644 --- a/tststr.cmd +++ b/tststr.cmd @@ -1,6 +1,13 @@ ; Insert long environment variables [will be truncated to NSTRING - 1 (127)] +insert-string &env PATH +newline insert-string $PATH newline +set %mypath $PATH +insert-string %mypath +newline +insert-string &cat "Length of $PATH: " &len $PATH +newline ; Insert string with escaped characters insert-string "hello, world~n" newline @@ -41,8 +48,9 @@ insert-string "#12345678901234567890" ; kill and yank beginning-of-line kill-to-end-of-line +kill-to-end-of-line +yank yank -newline ; insert kill variable (up to 127 characters), was 25 before fix insert-string $kill save-file