/[LeafOK_CVS]/lbbs/src/section_list_display.c
ViewVC logotype

Diff of /lbbs/src/section_list_display.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.10 by sysadm, Fri May 30 12:51:00 2025 UTC Revision 1.11 by sysadm, Sat May 31 03:37:47 2025 UTC
# Line 27  Line 27 
27  #define _POSIX_C_SOURCE 200809L  #define _POSIX_C_SOURCE 200809L
28  #include <string.h>  #include <string.h>
29    
30    static int section_topic_view_mode = 0;
31    
32  enum select_cmd_t  enum select_cmd_t
33  {  {
34          EXIT_SECTION = 0,          EXIT_SECTION = 0,
# Line 244  static enum select_cmd_t section_list_se Line 246  static enum select_cmd_t section_list_se
246          return EXIT_SECTION;          return EXIT_SECTION;
247  }  }
248    
249  static int display_article_key_handler(int *key, char *msg, size_t msg_len)  static int display_article_key_handler(int *p_key, DISPLAY_CTX *p_ctx)
250  {  {
251          static int topic_view = 0;          switch (*p_key)
   
         switch (*key)  
252          {          {
         case 0: // Set msg  
                 snprintf(msg, msg_len,  
                                  "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] │ "  
                                  "移动[\033[32m↑\033[33m/\033[32m↓\033[33m/\033[32mPgUp\033[33m/\033[32mPgDn\033[33m] │ "  
                                  "帮助[\033[32mh\033[33m] |");  
                 break;  
253          case 'p':          case 'p':
254                  break;                  section_topic_view_mode = !section_topic_view_mode;
255                  topic_view = !topic_view;          case 0: // Set msg
256                  if (topic_view)                  if (section_topic_view_mode)
257                  {                  {
258                          snprintf(msg, msg_len,                          snprintf(p_ctx->msg, sizeof(p_ctx->msg),
259                                           "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] │ "                                           "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] │ "
260                                           "同主题阅读[\033[32m↑\033[33m/\033[32m↓\033[33m] │ "                                           "同主题阅读[\033[32m↑\033[33m/\033[32m↓\033[33m] │ "
261                                           "帮助[\033[32mh\033[33m] |");                                           "帮助[\033[32mh\033[33m] |");
262                  }                  }
263                  else                  else
264                  {                  {
265                          snprintf(msg, msg_len,                          snprintf(p_ctx->msg, sizeof(p_ctx->msg),
266                                           "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] │ "                                           "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] │ "
267                                           "移动[\033[32m↑\033[33m/\033[32m↓\033[33m/\033[32mPgUp\033[33m/\033[32mPgDn\033[33m] │ "                                           "移动[\033[32m↑\033[33m/\033[32m↓\033[33m/\033[32mPgUp\033[33m/\033[32mPgDn\033[33m] │ "
268                                           "帮助[\033[32mh\033[33m] |");                                           "帮助[\033[32mh\033[33m] |");
269                  }                  }
270                  *key = 0;                  *p_key = 0;
271                  break;                  break;
         case 'H':  
                 *key = 'h';  
                 return 0;  
272          }          }
273    
274          return 0;          return 0;


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1