~ubuntu-branches/ubuntu/intrepid/lynx-cur/intrepid

« back to all changes in this revision

Viewing changes to src/LYStrings.c

  • Committer: Bazaar Package Importer
  • Author(s): Atsuhito KOHDA
  • Date: 2006-10-13 09:48:33 UTC
  • mfrom: (1.4.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061013094833-ip3n5me59lbsles4
Tags: 2.8.7dev1-1
New Upstream Release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
247
247
 
248
248
/************************************************************************/
249
249
#endif /* USE_MOUSE */
 
250
    (void) win;
 
251
    (void) row;
 
252
    (void) position;
 
253
 
250
254
    return cmd;
251
255
}
252
256
 
704
708
#else /* curses */
705
709
#if defined(DJGPP)
706
710
#define GetChar() (djgpp_idle_loop(), wgetch(LYtopwindow()))
 
711
#elif defined(NCURSES_VERSION) && defined(__BEOS__)
 
712
#define GetChar() myGetCharNodelay()
707
713
#elif defined(NCURSES)
708
714
#define GetChar() wgetch(LYtopwindow())
709
715
#endif
710
716
#endif
711
717
 
 
718
#ifdef USE_CURSES_NODELAY
 
719
/* PDCurses - until version 2.7 in 2005 - defined ERR as 0, unlike other
 
720
 * versions of curses.  Generally both EOF and ERR are defined as -1's. 
 
721
 * However, there is a special case (see HTCheckForInterrupt()) to handle a
 
722
 * case where no select() function is used in the win32 environment.
 
723
 *
 
724
 * HTCheckForInterrupt() uses nodelay() in this special case to check for
 
725
 * pending input.  That normally returns ERR.  But LYgetch_for() checks the
 
726
 * return value of this function for EOF (to handle some antique runtime
 
727
 * libraries which did not set the state for feof/ferror).  Returning a zero
 
728
 * (0) is safer since normally that is not mapped to any commands, and will be
 
729
 * ignored by lynx.
 
730
 */
 
731
static int myGetCharNodelay(void)
 
732
{
 
733
    int c = wgetch(LYwin);
 
734
    if (c == -1)
 
735
        c = 0;
 
736
 
 
737
    return c;
 
738
}
 
739
#else
 
740
#define myGetCharNodelay() wgetch(LYwin)
 
741
#endif
 
742
 
712
743
#if !defined(GetChar) && defined(PDCURSES) && defined(PDC_BUILD) && PDC_BUILD >= 2401
713
744
/* PDCurses sends back key-modifiers that we don't use, but would waste time
714
745
 * upon, e.g., repainting the status line
719
750
    BOOL done = FALSE;
720
751
 
721
752
    do {
722
 
        switch (c = wgetch(LYwin)) {
 
753
        switch (c = myGetCharNodelay()) {
723
754
        case KEY_SHIFT_L:
724
755
        case KEY_SHIFT_R:
725
756
        case KEY_CONTROL_L:
733
764
            break;
734
765
        }
735
766
    } while (!done);
 
767
 
736
768
    return c;
737
769
}
738
770
#define GetChar() myGetChar()
1070
1102
            dst[1] = '\0';
1071
1103
            ok = TRUE;
1072
1104
        }
1073
 
    } else if (*src == DQUOTE)
 
1105
    } else if (*src == DQUOTE) {
1074
1106
        ok = expand_substring(dst, src + 1, src + strlen(src) - 1, final);
 
1107
        (void) final;
 
1108
    }
1075
1109
    return ok;
1076
1110
}
1077
1111
 
1110
1144
        if (*str) {
1111
1145
            size_t len = strlen(str);
1112
1146
 
1113
 
            if (len == 1)
 
1147
            if (len == 1) {
1114
1148
                return (*keysym = (UCH(str[0])) | modifier);
1115
 
            else if (len == 2 && str[0] == '^' &&
1116
 
                     (isalpha(UCH(str[1])) ||
1117
 
                      (TOASCII(str[1]) >= '@' && TOASCII(str[1]) <= '_')))
 
1149
            } else if (len == 2 && str[0] == '^' &&
 
1150
                       (isalpha(UCH(str[1])) ||
 
1151
                        (TOASCII(str[1]) >= '@' && TOASCII(str[1]) <= '_'))) {
1118
1152
                return (*keysym = FROMASCII(UCH(str[1] & 0x1f)) | modifier);
1119
 
            else if (len == 2 && str[0] == '^' &&
1120
 
                     str[1] == '?')
 
1153
            } else if (len == 2 && str[0] == '^' &&
 
1154
                       str[1] == '?') {
1121
1155
                return (*keysym = CH_DEL | modifier);
 
1156
            }
1122
1157
            if (*str == '^' || *str == '\\') {
1123
1158
                char buf[BUFSIZ];
1124
1159
 
1343
1378
        INTERN_KEY( "\033OP",   F1,             KEY_F(1) ),
1344
1379
        INTERN_KEY( "\033[OP",  F1,             KEY_F(1) ),
1345
1380
        INTERN_KEY( "\033[29~", DO_KEY,         KEY_F(16) ),
1346
 
#if defined(USE_SLANG) && defined(__MINGW32__)
 
1381
#if defined(USE_SLANG) && (defined(__WIN32__) || defined(__MINGW32__))
1347
1382
        INTERN_KEY( "\xE0H",    UPARROW,        KEY_UP ),
1348
1383
        INTERN_KEY( "\xE0P",    DNARROW,        KEY_DOWN ),
1349
1384
        INTERN_KEY( "\xE0M",    RTARROW,        KEY_RIGHT ),
1552
1587
 
1553
1588
    key = SLang_do_key(Keymap_List, myGetChar);
1554
1589
    if ((key == NULL) || (key->type != SLKEY_F_KEYSYM)) {
1555
 
#ifdef __MINGW32__
 
1590
#if defined(__WIN32__) || defined(__MINGW32__)
1556
1591
        if ((key == NULL) && (current_sl_modifier == LKC_ISLKC)) {
1557
1592
            key = SLang_do_key(Keymap_List, myGetChar);
1558
1593
            keysym = key->f.keysym;
1637
1672
    int current_modifier = 0;
1638
1673
    BOOLEAN done_esc = FALSE;
1639
1674
 
 
1675
    (void) code;
 
1676
 
1640
1677
    have_levent = 0;
1641
1678
 
1642
1679
  re_read:
3800
3837
{
3801
3838
    char Cnum[MAX_LINE];
3802
3839
 
 
3840
    (void) width;
 
3841
 
3803
3842
    FormatChoiceNum(Cnum, num_choices, number, "");
3804
3843
#ifdef USE_SLANG
3805
3844
    SLsmg_gotorc(win->top_y + entry, (win->left_x + 2));
4902
4941
                            _statusline(": ");
4903
4942
                        reinsertEdit(&MyEdit, data[cur_choice]);
4904
4943
                    }
4905
 
                    wmove(LYwin, old_y, old_x);
 
4944
                    LYmove(old_y, old_x);
4906
4945
                    FREE(data);
4907
4946
                }
4908
4947
            } else {