aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin_commandline.cpp
diff options
context:
space:
mode:
authorGravatar Julian Aron Prenner <julian@linux4you.it>2014-01-17 20:32:24 +0100
committerGravatar Julian Aron Prenner <julian@linux4you.it>2014-01-17 20:32:24 +0100
commit88eae68987863fbd34b34e12219c9a8c67c61d7b (patch)
tree61ec655a34c5be551d573cf6f63e9acb8212b1b0 /builtin_commandline.cpp
parent8b89bd7a1f447de051d4a501d691ec9d763aabbe (diff)
Fix a bug, commandline -s works now as expected. Add "*y binding in
visual mode
Diffstat (limited to 'builtin_commandline.cpp')
-rw-r--r--builtin_commandline.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin_commandline.cpp b/builtin_commandline.cpp
index 363cf3cd..ad3cf0c8 100644
--- a/builtin_commandline.cpp
+++ b/builtin_commandline.cpp
@@ -326,7 +326,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
int opt = wgetopt_long(argc,
argv,
- L"abijpctwforhI:CLS",
+ L"abijpctwforhI:CLSs",
long_options,
&opt_index);
if (opt == -1)
@@ -477,8 +477,9 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
if(reader_get_selection_pos(sel_start, sel_stop))
{
size_t len = std::min(sel_stop - sel_start + 1, wcslen(buffer));
- wchar_t *selection = new wchar_t[len];
- selection = wcsncpy(selection, current_buffer + sel_start, len);
+ wchar_t *selection = new wchar_t[len + 1];
+ selection[len] = L'\0';
+ selection = wcsncpy(selection, buffer + sel_start, len);
append_format(stdout_buffer, selection);
delete selection;