… | |
… | |
928 | if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) |
928 | if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) |
929 | croak ("first argument to urxvt::term->_new must be arrayref"); |
929 | croak ("first argument to urxvt::term->_new must be arrayref"); |
930 | |
930 | |
931 | rxvt_term *term = new rxvt_term; |
931 | rxvt_term *term = new rxvt_term; |
932 | |
932 | |
933 | term->argv = new stringvec; |
933 | stringvec *argv = new stringvec; |
934 | term->envv = new stringvec; |
934 | stringvec *envv = new stringvec; |
935 | |
935 | |
936 | for (int i = 1; i < items; i++) |
936 | for (int i = 1; i < items; i++) |
937 | term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
937 | argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
938 | |
938 | |
939 | AV *envv = (AV *)SvRV (ST (0)); |
939 | AV *env = (AV *)SvRV (ST (0)); |
940 | for (int i = AvFILL (envv) + 1; i--; ) |
940 | for (int i = AvFILL (env) + 1; i--; ) |
941 | term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); |
941 | envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); |
942 | |
942 | |
943 | term->envv->push_back (0); |
943 | envv->push_back (0); |
944 | |
944 | |
945 | bool success; |
945 | bool success; |
946 | |
946 | |
947 | try |
947 | try |
948 | { |
948 | { |
949 | success = term->init (term->argv->size (), term->argv->begin ()); |
949 | success = term->init (argv, envv); |
950 | } |
950 | } |
951 | catch (const class rxvt_failure_exception &e) |
951 | catch (const class rxvt_failure_exception &e) |
952 | { |
952 | { |
953 | success = false; |
953 | success = false; |
954 | } |
954 | } |
… | |
… | |
1531 | if (items == 3) |
1531 | if (items == 3) |
1532 | { |
1532 | { |
1533 | rc.row = SvIV (ST (1)); |
1533 | rc.row = SvIV (ST (1)); |
1534 | rc.col = SvIV (ST (2)); |
1534 | rc.col = SvIV (ST (2)); |
1535 | |
1535 | |
1536 | if (ix == 2 && rc.col == 0) |
1536 | if (ix == 2) |
1537 | { |
1537 | { |
|
|
1538 | if (rc.col == 0) |
|
|
1539 | { |
|
|
1540 | // col == 0 means end of previous line |
1538 | rc.row--; |
1541 | rc.row--; |
1539 | rc.col = THIS->ncol; |
1542 | rc.col = THIS->ncol; |
|
|
1543 | } |
|
|
1544 | else if (IN_RANGE_EXC (rc.row, THIS->top_row, THIS->nrow) |
|
|
1545 | && rc.col > ROW(rc.row).l) |
|
|
1546 | { |
|
|
1547 | // col >= length means while line and add newline |
|
|
1548 | rc.col = THIS->ncol; |
|
|
1549 | } |
1540 | } |
1550 | } |
1541 | |
1551 | |
1542 | clamp_it (rc.col, 0, THIS->ncol); |
1552 | clamp_it (rc.col, 0, THIS->ncol); |
1543 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1553 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1544 | |
1554 | |