[nemiver/console: 7/11] Factorization
- From: Fabien Parent <fparent src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/console: 7/11] Factorization
- Date: Fri, 2 Mar 2012 16:58:32 +0000 (UTC)
commit 169a8f7e0bf6e68980fbf6223ebecc3ff7a8c1f2
Author: Fabien Parent <parent f gmail com>
Date: Fri Mar 2 17:20:36 2012 +0100
Factorization
src/common/nmv-console.cc | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/src/common/nmv-console.cc b/src/common/nmv-console.cc
index a67054f..319d78e 100644
--- a/src/common/nmv-console.cc
+++ b/src/common/nmv-console.cc
@@ -174,6 +174,19 @@ struct Console::Priv {
}
void
+ display_message (const std::string &a_msg)
+ {
+ rl_save_prompt ();
+ rl_message ("%s%s\n%s\n%s",
+ rl_display_prompt,
+ std::string (rl_line_buffer, rl_end).c_str (),
+ a_msg.c_str (),
+ rl_display_prompt);
+ rl_clear_message ();
+ rl_restore_prompt ();
+ }
+
+ void
do_command_completion (const std::string &a_line)
{
std::vector<Console::Command*> matches;
@@ -205,14 +218,7 @@ struct Console::Priv {
msg += matches[i]->name () + "\t";
}
- rl_save_prompt ();
- rl_message ("%s%s\n%s\n%s",
- rl_display_prompt,
- std::string (rl_line_buffer, rl_end).c_str (),
- msg.c_str (),
- rl_display_prompt);
- rl_clear_message ();
- rl_restore_prompt ();
+ display_message (msg);
do_completion (completion);
}
}
@@ -276,14 +282,8 @@ struct Console::Priv {
completion = completion.substr (0, j);
msg += matches[i] + "\t";
}
- rl_save_prompt ();
- rl_message ("%s%s\n%s\n%s",
- rl_display_prompt,
- std::string (rl_line_buffer, rl_end).c_str (),
- msg.c_str (),
- rl_display_prompt);
- rl_clear_message ();
- rl_restore_prompt ();
+
+ display_message (msg);
do_completion (completion);
} else {
rl_complete (0, '\t');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]