Changeset 5eeea3b for functions.c


Ignore:
Timestamp:
Aug 17, 2002, 3:23:00 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:
1354456
Parents:
9bd2c17
Message:
	Modified the behavior of last so that "> >" will clear the screen.
	The new behavior of last is:
	      Moves the pointer to the last message in the view.
	      If we are already at the last message in the view,
	      blanks the screen and moves just past the end of the view
	      so that new messages will appear starting at the top
	      of the screen.
	Fixed a typo in the help for smartzpunt.
	Fixed functions to handle curmsg being past the end of the view.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r9bd2c17 r5eeea3b  
    375375  v=owl_global_get_current_view(&g);
    376376  ml=owl_global_get_msglist(&g);
     377
     378  /* just check to make sure we're in bounds... */
     379  if (curmsg>owl_view_get_size(v)-1) curmsg=owl_view_get_size(v)-1;
     380  if (curmsg<0) curmsg=0;
    377381
    378382  /* first try to move to an undeleted message in the view*/
     
    389393
    390394    /* if we weren't successful try to find one backwards */
    391     curmsg=owl_global_get_curmsg(&g);
    392395    if (owl_message_is_delete(owl_view_get_element(v, curmsg))) {
    393396      for (i=curmsg; i>0; i--) {
     
    431434
    432435void owl_function_lastmsg_noredisplay() {
    433   int curmsg;
     436  int oldcurmsg, curmsg;
    434437  owl_view *v;
    435438
    436439  v=owl_global_get_current_view(&g);
    437  
    438   curmsg=owl_view_get_size(v)-1;
     440  oldcurmsg=owl_global_get_curmsg(&g);
     441  curmsg=owl_view_get_size(v)-1; 
    439442  if (curmsg<0) curmsg=0;
    440443  owl_global_set_curmsg(&g, curmsg);
    441   owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS);
     444  if (oldcurmsg < curmsg) {
     445    owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS);
     446  } else if (curmsg<owl_view_get_size(v)) {
     447    /* If already at the end, blank the screen and move curmsg
     448     * past the end of the messages. */
     449    owl_global_set_topmsg(&g, curmsg+1);
     450    owl_global_set_curmsg(&g, curmsg+1);
     451  }
    442452  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    443453  owl_global_set_direction_downwards(&g);
     
    631641  v=owl_global_get_current_view(&g);
    632642 
    633   if (owl_view_get_size(v)==0) {
     643  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
     644
     645  if (!m || owl_view_get_size(v)==0) {
    634646    owl_function_makemsg("No current message selected");
    635647    return;
    636648  }
    637649
    638   m=owl_view_get_element(v, owl_global_get_curmsg(&g));
    639650  text=owl_message_get_text(m);
    640651
     
    10561067  v=owl_global_get_current_view(&g);
    10571068 
    1058   if (owl_view_get_size(v)==0) {
     1069  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
     1070
     1071  if (!m || owl_view_get_size(v)==0) {
    10591072    owl_function_makemsg("No message selected\n");
    10601073    return;
    10611074  }
    10621075
    1063   m=owl_view_get_element(v, owl_global_get_curmsg(&g));
    10641076  if (!owl_message_is_zephyr(m)) {
    10651077    sprintf(buff,   "Owl Message Id: %i\n", owl_message_get_id(m));
     
    11581170  pw=owl_global_get_popwin(&g);
    11591171
    1160   if (owl_view_get_size(v)==0) {
     1172  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
     1173
     1174  if (!m || owl_view_get_size(v)==0) {
    11611175    owl_function_makemsg("No current message");
    11621176    return;
    11631177  }
    11641178
    1165   m=owl_view_get_element(v, owl_global_get_curmsg(&g));
    11661179  owl_function_popless_fmtext(owl_message_get_fmtext(m));
    11671180}
     
    11771190  offset=owl_global_get_curmsg_vert_offset(&g);
    11781191  v=owl_global_get_current_view(&g);
    1179   if (owl_view_get_size(v)==0) return;
    11801192  curmsg=owl_global_get_curmsg(&g);
    11811193  m=owl_view_get_element(v, curmsg);
     1194  if (!m || owl_view_get_size(v)==0) return;
    11821195  lines=owl_message_get_numlines(m);
    11831196
     
    14791492   
    14801493    m=owl_view_get_element(owl_global_get_current_view(&g), owl_global_get_curmsg(&g));
     1494    if (!m) {
     1495      owl_function_makemsg("No message selected");
     1496      return;
     1497    }
     1498
    14811499
    14821500    /* first check if we catch the reply-lockout filter */
     
    19862004  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
    19872005
    1988   if (owl_view_get_size(v)==0) {
     2006  if (!m || owl_view_get_size(v)==0) {
    19892007    owl_function_makemsg("No message selected\n");
    19902008    return NULL;
     
    20332051  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
    20342052
    2035   if (owl_view_get_size(v)==0) {
     2053  if (!m || owl_view_get_size(v)==0) {
    20362054    owl_function_makemsg("No message selected\n");
    20372055    return;
Note: See TracChangeset for help on using the changeset viewer.