scrollpad: do not reset starting position automatically in Clear()
this allows for scrolling mpd server info screen, since the content is changing slightly every second and starting position was reset each time it'd been happening, scrolling was impossible. this also 'fixes' the issue in other screens like lyrics, artist info and help that was reset if main window has been resized, which sometimes could be very annoying.
This commit is contained in:
@@ -120,13 +120,15 @@ void Scrollpad::RemoveFormatting()
|
||||
|
||||
void Scrollpad::Refresh()
|
||||
{
|
||||
int MaxBeginning = itsRealHeight-itsHeight;
|
||||
if (itsBeginning > MaxBeginning)
|
||||
itsBeginning = MaxBeginning;
|
||||
prefresh(itsWindow, itsBeginning, 0, itsStartY, itsStartX, itsStartY+itsHeight-1, itsStartX+itsWidth-1);
|
||||
}
|
||||
|
||||
void Scrollpad::Resize(size_t new_width, size_t new_height)
|
||||
{
|
||||
AdjustDimensions(new_width, new_height);
|
||||
itsBeginning = 0;
|
||||
itsRealHeight = itsHeight;
|
||||
Flush();
|
||||
}
|
||||
@@ -178,7 +180,6 @@ void Scrollpad::Scroll(Where where)
|
||||
|
||||
void Scrollpad::Clear(bool clear_screen)
|
||||
{
|
||||
itsBeginning = 0;
|
||||
itsRealHeight = itsHeight;
|
||||
itsBuffer.Clear();
|
||||
wclear(itsWindow);
|
||||
@@ -192,6 +193,11 @@ void Scrollpad::Clear(bool clear_screen)
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void Scrollpad::Reset()
|
||||
{
|
||||
itsBeginning = 0;
|
||||
}
|
||||
|
||||
#ifdef _UTF8
|
||||
Scrollpad &Scrollpad::operator<<(const std::string &s)
|
||||
{
|
||||
|
||||
@@ -107,6 +107,10 @@ namespace NCurses
|
||||
///
|
||||
virtual void Clear(bool clear_screen = 1);
|
||||
|
||||
/// Sets starting position to the beginning
|
||||
///
|
||||
void Reset();
|
||||
|
||||
/// Template function that redirects all data passed
|
||||
/// to the scrollpad window to its internal buffer
|
||||
/// @param obj any object that has ostream &operator<<() defined
|
||||
|
||||
Reference in New Issue
Block a user