summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
...
* updated widgetshut2009-12-299-47/+31
* a somewhat working versionhut2009-12-293-33/+39
* be less strict with resizeshut2009-12-291-7/+11
* Optimized moving/resizing of windows, fixed absolute position bughut2009-12-293-9/+25
* disregard the last commit. this is the quick fixhut2009-12-292-2/+1
* quick&dirty fix for correct rel/abs coordinateshut2009-12-293-5/+6
* updated testhut2009-12-291-2/+2
* fixed "(y, x) in widget"hut2009-12-281-3/+6
* fixed slow loading of small directorieshut2009-12-281-3/+3
* sub-windows are working well nowhut2009-12-283-27/+27
* another fixhut2009-12-281-2/+6
* fixeshut2009-12-283-7/+8
* switching to using sub-windows instead of absolute positionshut2009-12-286-20/+46
* fixed waitpid_no_intrhut2009-12-282-4/+10
* use os.chdir to stay on the pwdhut2009-12-281-0/+2
* clean upshut2009-12-287-14/+1
* fixed pager, it was thinking lists are streamshut2009-12-281-1/+1
* display the contents of the file in the pagerhut2009-12-287-12/+177
* changed keybindingshut2009-12-281-8/+11
* fixed mouse-event with negative coordinateshut2009-12-271-0/+8
* test case for keyapi.Wrapperhut2009-12-271-0/+24
* improved key binding implementationhut2009-12-276-179/+220
* Merge branch 'cycle' into pythonhut2009-12-275-25/+85
|\
| * implemented customized cycling through the directoryhut2009-12-274-5/+43
| * changed search implementationhut2009-12-274-22/+44
* | use a pager widget for file previewshut2009-12-272-7/+88
|/
* fixes and cleanupshut2009-12-275-6/+6
* allow to filter contents of a directoryhut2009-12-274-2/+20
* action.spawn/runcmd for terminals and du | lesshut2009-12-274-12/+22
* improved tab completion capabilitieshut2009-12-273-22/+122
* generalized tab completion code of cd commandhut2009-12-271-23/+26
* added rename commandhut2009-12-273-0/+24
* moved the command parser into a seperate filehut2009-12-262-34/+61
* use constants instead of strings to represend console modeshut2009-12-264-27/+76
* changed how tagged files are displayedhut2009-12-262-3/+13
* implemented tagginghut2009-12-268-8/+124
* shorten comment in ranger.pyhut2009-12-262-11/+9
* implemented OpenConsolehut2009-12-253-3/+69
* moved /uml to /doc/umlhut2009-12-2514-2/+2
* random updateshut2009-12-257-7/+45
* Explained cd-after-exit featurehut2009-12-251-0/+132
* moved pydoc pages to doc/pydochut2009-12-2565-0/+0
* updated pydoc pageshut2009-12-2565-0/+10505
* bugfixeshut2009-12-255-10/+18
* made directories use the accumulator "interface"hut2009-12-257-89/+49
* improved paste-generatorshut2009-12-251-17/+32
* don't modify directory.__dict__ until last yield of load generatorhut2009-12-251-6/+6
* don't reconstruct statusbar if nothing changedhut2009-12-251-3/+20
* schedule loading of directories whereever possiblehut2009-12-252-21/+21
* customized process manager (colors, hotkeys, title)hut2009-12-253-5/+4
>40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
   
            



















                                                                       
                   

                   

                         
                       
 
                        
 

                                                         
                       
 
                                         

 
                              
 
                                   

 
                                             
 
                            

                                          
                                                

 
                                        
 
                            
                                          

                                            
 
 









                                                        
/* 
 * history.c
 *
 * Copyright (C) 2012 James Booth <boothj5@gmail.com>
 * 
 * This file is part of Profanity.
 *
 * Profanity is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Profanity is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Profanity.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include <stdlib.h>
#include <string.h>

#include "prof_history.h"

#define MAX_HISTORY 100

static PHistory history;

void _stringify_input(char *inp, int size, char *string);

void history_init(void)
{
    history = p_history_new(MAX_HISTORY);
}

void history_append(char *inp)
{
    p_history_append(history, inp);
}

char * history_previous(char *inp, int *size)
{
    char inp_str[*size + 1];
    _stringify_input(inp, *size, inp_str);
    
    return p_history_previous(history, inp_str);
}

char *history_next(char *inp, int *size)
{
    char inp_str[*size + 1];
    _stringify_input(inp, *size, inp_str);

    return p_history_next(history, inp_str);
}

void _stringify_input(char *inp, int size, char *string)
{
    int i;
    for (i = 0; i < size; i++) {
        string[i] = inp[i];
    }
    string[size] = '\0';
}