From 0b028c7146fe4d650a34faaaac033b2e88aa7f06 Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Mon, 25 Nov 2013 08:36:46 +0000 Subject: [PATCH] Unbreak console=readline. R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/85343002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18037 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/d8-readline.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/d8-readline.cc b/src/d8-readline.cc index 0226f31c0b..15b1361727 100644 --- a/src/d8-readline.cc +++ b/src/d8-readline.cc @@ -109,12 +109,9 @@ Handle ReadLineEditor::Prompt(const char* prompt) { Unlocker unlock(Isolate::GetCurrent()); result = readline(prompt); } - if (result != NULL) { - AddHistory(result); - } else { - return Handle(); - } - return String::New(result); + if (result == NULL) return Handle(); + AddHistory(result); + return String::NewFromUtf8(isolate_, result); } @@ -153,8 +150,13 @@ char* ReadLineEditor::CompletionGenerator(const char* text, int state) { HandleScope scope(isolate); Handle completions; if (state == 0) { - Local full_text = String::New(rl_line_buffer, rl_point); - completions = Shell::GetCompletions(isolate, String::New(text), full_text); + Local full_text = String::NewFromUtf8(isolate, + rl_line_buffer, + String::kNormalString, + rl_point); + completions = Shell::GetCompletions(isolate, + String::NewFromUtf8(isolate, text), + full_text); current_completions.Reset(isolate, completions); current_index = 0; } else {