comparison mcabber/src/commands.c @ 370:dd9e2eb52916

Add /buffer search_{backward,forward}
author Mikael Berthe <mikael@lilotux.net>
date Sun, 24 Jul 2005 22:56:42 +0100
parents 499170ed71c9
children bc54af8ed048
comparison
equal deleted inserted replaced
369:499170ed71c9 370:dd9e2eb52916
125 125
126 // Roster category 126 // Roster category
127 compl_add_category_word(COMPL_BUFFER, "bottom"); 127 compl_add_category_word(COMPL_BUFFER, "bottom");
128 compl_add_category_word(COMPL_BUFFER, "clear"); 128 compl_add_category_word(COMPL_BUFFER, "clear");
129 compl_add_category_word(COMPL_BUFFER, "top"); 129 compl_add_category_word(COMPL_BUFFER, "top");
130 compl_add_category_word(COMPL_BUFFER, "search_backward");
131 compl_add_category_word(COMPL_BUFFER, "search_forward");
130 132
131 // Group category 133 // Group category
132 compl_add_category_word(COMPL_GROUP, "fold"); 134 compl_add_category_word(COMPL_GROUP, "fold");
133 compl_add_category_word(COMPL_GROUP, "unfold"); 135 compl_add_category_word(COMPL_GROUP, "unfold");
134 compl_add_category_word(COMPL_GROUP, "toggle"); 136 compl_add_category_word(COMPL_GROUP, "toggle");
562 scr_set_multimode(FALSE); 564 scr_set_multimode(FALSE);
563 } 565 }
564 566
565 static void do_buffer(char *arg) 567 static void do_buffer(char *arg)
566 { 568 {
569 int search_dir = 0;
570
567 if (!strcasecmp(arg, "top")) { 571 if (!strcasecmp(arg, "top")) {
568 scr_BufferTopBottom(-1); 572 scr_BufferTopBottom(-1);
569 } else if (!strcasecmp(arg, "bottom")) { 573 } else if (!strcasecmp(arg, "bottom")) {
570 scr_BufferTopBottom(1); 574 scr_BufferTopBottom(1);
571 } else if (!strcasecmp(arg, "clear")) { 575 } else if (!strcasecmp(arg, "clear")) {
572 scr_BufferClear(); 576 scr_BufferClear();
577 } else if (!strncasecmp(arg, "search_backward", 15)) {
578 arg += 15;
579 if (*arg++ == ' ')
580 search_dir = -1;
581 else
582 scr_LogPrint("Missing parameter");
583 } else if (!strncasecmp(arg, "search_forward", 14)) {
584 arg += 14;
585 if (*arg++ == ' ')
586 search_dir = 1;
587 else
588 scr_LogPrint("Missing parameter");
573 } else 589 } else
574 scr_LogPrint("Unrecognized parameter!"); 590 scr_LogPrint("Unrecognized parameter!");
591
592 // Is it a string search command?
593 if (search_dir)
594 scr_BufferSearch(search_dir, arg);
575 } 595 }
576 596
577 static void do_clear(char *arg) // Alias for "/buffer clear" 597 static void do_clear(char *arg) // Alias for "/buffer clear"
578 { 598 {
579 do_buffer("clear"); 599 do_buffer("clear");