Changeset 10b866d for history.c


Ignore:
Timestamp:
Jul 8, 2002, 10:37:21 PM (18 years ago)
Author:
Erik Nygren <nygren@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
e1c4636
Parents:
8df36cc
Message:
* Fixed preservation of e->dotsend across owl_editwin_clear().

* Added history for multiline edit windows (eg, for zephyr composition).
  The M-n and M-p keys will cycle through the history ring.
  In particular, it is now possible to edit the command line
  of a zephyr being composed:  C-c it and restart it
  and then M-p to get the aborted composition back.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • history.c

    r1aee7d9 r10b866d  
    55void owl_history_init(owl_history *h) {
    66  owl_list_create(&(h->hist));
    7   h->cur=0;
    8   h->touched=0;
    9   h->partial=0;
     7  h->cur=0;                     /* current position in history */
     8  h->touched=0;                 /* whether we've gone into history */
     9  h->partial=0;                 /* is the 0th element is partially composed? */
    1010}
    1111
    1212char *owl_history_get_prev(owl_history *h) {
     13
     14  if (!h) return NULL;
    1315  h->touched=1;
    1416
     
    2022
    2123  h->cur++;
     24
    2225  return(owl_list_get_element(&(h->hist), h->cur));
    2326}
    2427
    2528char *owl_history_get_next(owl_history *h) {
     29  if (!h) return NULL;
    2630  if (owl_list_get_size(&(h->hist))==0) return(NULL);
    27 
    2831  if (h->cur==0) {
    2932    return(NULL);
     
    3740  int size;
    3841
     42  if (!h) return;
     43
    3944  /* if partial is set, remove the first entry first */
    4045  if (h->partial) {
    4146    owl_list_remove_element(&(h->hist), 0);
    4247  }
    43    
     48
    4449  /* if we've reached the max history size, pop off the last element */
    4550  size=owl_list_get_size(&(h->hist));
     
    5459
    5560void owl_history_set_partial(owl_history *h) {
     61  if (!h) return;
    5662  h->partial=1;
    5763}
    5864
    5965void owl_history_reset(owl_history *h) {
     66  if (!h) return;
    6067  h->cur=0;
    6168  h->touched=0;
     
    6471
    6572int owl_history_is_touched(owl_history *h) {
     73  if (!h) return(0);
    6674  if (h->touched) return(1);
    6775  return(0);
Note: See TracChangeset for help on using the changeset viewer.