diff options
author | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-06-10 18:16:36 -0700 |
---|---|---|
committer | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-06-10 18:16:36 -0700 |
commit | 096e3bc1ee41a9619a9f8faad02da1b5ecf61ea0 (patch) | |
tree | 71571bd0338fa41aaa798c3d8ba5408de8db19be /src | |
parent | 6480c9906a3b67f43742a6b54dd8b2c6af989f84 (diff) | |
download | aptitude-096e3bc1ee41a9619a9f8faad02da1b5ecf61ea0.tar.gz |
Add support in the transient message for making a message permanent and advancing to the next line.
i.e., for explicitly outputting a newline. The main advantage of this is
that it lets me give the progress display a mode that emulates the old apt
progress display (specifically, the behavior that completed steps remain
visible).
Diffstat (limited to 'src')
-rw-r--r-- | src/cmdline/mocks/transient_message.h | 1 | ||||
-rw-r--r-- | src/cmdline/transient_message.cc | 13 | ||||
-rw-r--r-- | src/cmdline/transient_message.h | 5 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/cmdline/mocks/transient_message.h b/src/cmdline/mocks/transient_message.h index a62c24b7..efc18539 100644 --- a/src/cmdline/mocks/transient_message.h +++ b/src/cmdline/mocks/transient_message.h @@ -37,6 +37,7 @@ namespace aptitude { public: MOCK_METHOD1(set_text, void(const std::wstring &)); + MOCK_METHOD0(preserve_and_advance, void()); }; } } diff --git a/src/cmdline/transient_message.cc b/src/cmdline/transient_message.cc index 0bac3211..34949233 100644 --- a/src/cmdline/transient_message.cc +++ b/src/cmdline/transient_message.cc @@ -55,6 +55,10 @@ namespace aptitude void set_text(const std::wstring &msg) { } + + void preserve_and_advance() + { + } }; class transient_message_impl : public transient_message @@ -85,6 +89,7 @@ namespace aptitude } void set_text(const std::wstring &line); + void preserve_and_advance(); }; @@ -145,6 +150,14 @@ namespace aptitude last_line_len = display_width; last_line = line; } + + void transient_message_impl::preserve_and_advance() + { + // As in set_text(), assume that the current message is + // already displayed. + term->write_text(L"\n"); + term->flush(); + } } shared_ptr<transient_message> diff --git a/src/cmdline/transient_message.h b/src/cmdline/transient_message.h index 123333d0..2055d965 100644 --- a/src/cmdline/transient_message.h +++ b/src/cmdline/transient_message.h @@ -41,6 +41,11 @@ namespace aptitude * Updates the currently displayed text immediately. */ virtual void set_text(const std::wstring &text) = 0; + + /** \brief Save the current message and advance to the next + * line. + */ + virtual void preserve_and_advance() = 0; }; class terminal; |