Changeset 8c97fa1


Ignore:
Timestamp:
Dec 19, 2009, 10:49:57 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
6aa4611
Parents:
1247aaa
git-author:
Alex Dehnert <adehnert@mit.edu> (12/19/09 21:45:37)
git-committer:
Nelson Elhage <nelhage@mit.edu> (12/19/09 22:49:57)
Message:
Add recv:getshift and recv:setshift

[nelhage@mit.edu: Clean up shift_left logic slightly]
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r1247aaa r8c97fa1  
    314314              "toggle-oneline",
    315315              ""),
     316
     317  OWLCMD_ARGS("recv:getshift", owl_command_get_shift, OWL_CTX_INTERACTIVE,
     318              "gets position of receive window scrolling", "", ""),
     319
     320  OWLCMD_INT("recv:setshift", owl_command_set_shift, OWL_CTX_INTERACTIVE,
     321              "scrolls receive window to specified position", "", ""),
    316322
    317323  OWLCMD_VOID("recv:shiftleft", owl_command_shift_left, OWL_CTX_INTERACTIVE,
     
    13371343{
    13381344  owl_function_full_redisplay();
     1345  owl_global_set_needrefresh(&g);
     1346}
     1347
     1348char *owl_command_get_shift(int argc, const char *const *argv, const char *buff)
     1349{
     1350  if(argc != 1)
     1351  {
     1352    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
     1353    return NULL;
     1354  }
     1355  return owl_sprintf("%d", owl_global_get_rightshift(&g));
     1356}
     1357
     1358void owl_command_set_shift(int shift)
     1359{
     1360  owl_global_set_rightshift(&g, shift);
     1361  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    13391362  owl_global_set_needrefresh(&g);
    13401363}
  • functions.c

    r129e609 r8c97fa1  
    843843
    844844  shift=owl_global_get_rightshift(&g);
    845   if (shift>=10) {
    846     owl_global_set_rightshift(&g, shift-10);
     845  if (shift > 0) {
     846    owl_global_set_rightshift(&g, MAX(shift - 10, 0));
    847847    owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    848848    owl_global_set_needrefresh(&g);
Note: See TracChangeset for help on using the changeset viewer.