Esempio n. 1
0
bool wxSTEditorShell::SetMaxLines(int max_lines)
{
    m_max_lines = max_lines;
    if (m_max_lines < 0) return false;

    int total_lines = GetLineCount();
    total_lines     = wxMax(0, total_lines-1);

    // delete lines when more than m_max_lines, you'll eventually crash otherwise
    if (total_lines > m_max_lines)
    {
        BeginWriteable();

        int marker = MarkerGet(total_lines - m_max_lines);

        SetTargetStart(0);
        SetTargetEnd(PositionFromLine(total_lines - m_max_lines));
        ReplaceTarget(wxEmptyString);

        // wipe marker that has moved up if there shouldn't be a marker
        if ((marker & (1<<markerPrompt)) == 0)
            MarkerDelete(0, markerPrompt);

        EndWriteable();
        return true;
    }

    return false;
}
Esempio n. 2
0
void wxSTEditorShell::SetPromptText(const wxString& text)
{
    BeginWriteable();
    int length = GetLength();
    wxString promptText = GetPromptText();
    SetTargetStart(length - promptText.Length());
    SetTargetEnd(length);
    ReplaceTarget(text);
    GotoPos(GetLength());
    EndWriteable();
}
Esempio n. 3
0
void wxSTEditorShell::AppendText(const wxString &text)
{
    BeginWriteable();                   // make it writeable

    wxSTEditor::AppendText(text);       // write the text
    SetMaxLines(GetMaxLines());         // check for line count overflow
    GotoPos(GetLength());               // put cursor at end
    EmptyUndoBuffer();                  // don't let them undo what you wrote!
                                        //   but they can undo their own typing

    EndWriteable();                     // end the writeable state
}
Esempio n. 4
0
void wxSTEditorShell::SetPromptText(const wxString& text)
{
    BeginWriteable();
    int length      = GetLength();
    int prompt_line = GetPromptLine();
    int start_pos   = PositionFromLine(prompt_line);
    SetTargetStart(start_pos);
    SetTargetEnd(length);
    ReplaceTarget(text);
    GotoPos(GetLength());
    EndWriteable();
}