/*--------------------------------------------------------------------------*/
BOOL HistoryManager::deleteNthLine(int N)
{
    BOOL bOK = FALSE;

    if ((N >= 0) && (N <= getNumberOfLines()))
    {
        int i = 0;

        list < CommandLine >::iterator it_commands;
        for (it_commands = CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
        {
            if (i == N)
            {
                if (it_commands != CommandsList.end())
                {
                    std::string str;
                    str.erase();
                    CommandsList.erase(it_commands);
                    // After a remove , we update search
                    my_search.setHistory(CommandsList);
                    my_search.setToken(str);

                    CommandHistoryDeleteLine(N);
                    return TRUE;
                }
            }
            i++;
        }
    }
    return bOK;
}
Esempio n. 2
0
/*--------------------------------------------------------------------------*/
BOOL HistoryManager::deleteNthLine(int _iLine)
{
    if (_iLine >= 0 && _iLine <= getNumberOfLines())
    {
        int i = 0;
        std::list<std::string>::iterator it;
        for (it = m_Commands.begin() ; it != m_Commands.end(); it++)
        {
            if (i == _iLine)
            {
                m_Commands.erase(it);
                // After a remove , we update search
                m_HS.setHistory(m_Commands);
                m_HS.setToken("");

                CommandHistoryDeleteLine(_iLine);
                return TRUE;
            }
            i++;
        }
    }
    return FALSE;
}