Use stack for storing saved cursor positions
That fixes issue with latest versions of Midnight Commander - it "restores" on exit the latest postion was set, that is equal to 0.0.
This commit is contained in:
@@ -176,6 +176,8 @@ BasicTerminalBuffer::Init(int32 width, int32 height, int32 historySize)
|
|||||||
|
|
||||||
fDirtyInfo.Reset();
|
fDirtyInfo.Reset();
|
||||||
|
|
||||||
|
fSavedCursors.push(TermPos(0, 0));
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -923,14 +925,16 @@ BasicTerminalBuffer::DeleteLines(int32 numLines)
|
|||||||
void
|
void
|
||||||
BasicTerminalBuffer::SaveCursor()
|
BasicTerminalBuffer::SaveCursor()
|
||||||
{
|
{
|
||||||
fSavedCursor = fCursor;
|
fSavedCursors.push(fCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicTerminalBuffer::RestoreCursor()
|
BasicTerminalBuffer::RestoreCursor()
|
||||||
{
|
{
|
||||||
_SetCursor(fSavedCursor.x, fSavedCursor.y, true);
|
_SetCursor(fSavedCursors.top().x, fSavedCursors.top().y, true);
|
||||||
|
if (fSavedCursors.size() > 1)
|
||||||
|
fSavedCursors.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#define BASIC_TERMINAL_BUFFER_H
|
#define BASIC_TERMINAL_BUFFER_H
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stack>
|
||||||
|
|
||||||
#include "HistoryBuffer.h"
|
#include "HistoryBuffer.h"
|
||||||
#include "TermPos.h"
|
#include "TermPos.h"
|
||||||
@@ -223,7 +224,7 @@ protected:
|
|||||||
|
|
||||||
// cursor position (origin: (0, 0))
|
// cursor position (origin: (0, 0))
|
||||||
TermPos fCursor;
|
TermPos fCursor;
|
||||||
TermPos fSavedCursor;
|
std::stack<TermPos> fSavedCursors;
|
||||||
bool fSoftWrappedCursor;
|
bool fSoftWrappedCursor;
|
||||||
|
|
||||||
bool fOverwriteMode; // false for insert
|
bool fOverwriteMode; // false for insert
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ Application Terminal :
|
|||||||
TitlePlaceholderMapper.cpp
|
TitlePlaceholderMapper.cpp
|
||||||
VTKeyTbl.c
|
VTKeyTbl.c
|
||||||
VTPrsTbl.c
|
VTPrsTbl.c
|
||||||
: be $(HAIKU_LOCALE_LIBS) tracker textencoding $(TARGET_LIBSUPC++)
|
: be $(HAIKU_LOCALE_LIBS) tracker textencoding
|
||||||
|
$(TARGET_LIBSUPC++) $(TARGET_LIBSTDC++)
|
||||||
: Terminal.rdef XColors.rdef
|
: Terminal.rdef XColors.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user