… | |
… | |
762 | /* ------------------------------------------------------------------------- */ |
762 | /* ------------------------------------------------------------------------- */ |
763 | /* |
763 | /* |
764 | * Add text given in <str> of length <len> to screen struct |
764 | * Add text given in <str> of length <len> to screen struct |
765 | */ |
765 | */ |
766 | void |
766 | void |
767 | rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len) |
767 | rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len) |
768 | { |
768 | { |
769 | unsigned char checksel, clearsel; |
769 | unsigned char checksel, clearsel; |
770 | uint32_t c; |
770 | unicode_t c; |
771 | int i, row, last_col; |
771 | int i, row, last_col; |
772 | text_t *stp; |
772 | text_t *stp; |
773 | rend_t *srp; |
773 | rend_t *srp; |
774 | |
774 | |
775 | if (len <= 0) /* sanity */ |
775 | if (len <= 0) /* sanity */ |
… | |
… | |
951 | // handle double-width-chars by making them look extremely ugly |
951 | // handle double-width-chars by making them look extremely ugly |
952 | if (*tp == NOCHAR) |
952 | if (*tp == NOCHAR) |
953 | *tp = ' '; // hack //D //TODO //--tp, --rp; |
953 | *tp = ' '; // hack //D //TODO //--tp, --rp; |
954 | |
954 | |
955 | // first try to find a precomposed character |
955 | // first try to find a precomposed character |
956 | uint32_t n = rxvt_compose (*tp, c); |
956 | unicode_t n = rxvt_compose (*tp, c); |
957 | if (n == NOCHAR) |
957 | if (n == NOCHAR) |
958 | n = rxvt_composite.compose (*tp, c); |
958 | n = rxvt_composite.compose (*tp, c); |
959 | |
959 | |
960 | *tp = n; |
960 | *tp = n; |
961 | *rp = SET_FONT (*rp, TermWin.fontset->find_font (*tp)); |
961 | *rp = SET_FONT (*rp, TermWin.fontset->find_font (*tp)); |
… | |
… | |
2857 | |
2857 | |
2858 | if (screen.tlen[row] != -1 && row != end_row) |
2858 | if (screen.tlen[row] != -1 && row != end_row) |
2859 | new_selection_text[ofs++] = L'\n'; |
2859 | new_selection_text[ofs++] = L'\n'; |
2860 | } |
2860 | } |
2861 | |
2861 | |
2862 | #ifndef NO_OLD_SELECTION |
2862 | if (end_col != selection.end.col) |
2863 | if (selection_style == OLD_SELECT) |
|
|
2864 | if (end_col == TermWin.ncol) |
|
|
2865 | new_selection_text[ofs++] = L'\n'; |
2863 | new_selection_text[ofs++] = L'\n'; |
2866 | #endif |
2864 | |
2867 | #ifndef NO_NEW_SELECTION |
|
|
2868 | if (selection_style != OLD_SELECT) |
|
|
2869 | if (end_col != selection.end.col) |
|
|
2870 | new_selection_text[ofs++] = L'\n'; |
|
|
2871 | #endif |
|
|
2872 | new_selection_text[ofs] = 0; |
2865 | new_selection_text[ofs] = 0; |
2873 | |
2866 | |
2874 | if (ofs == 0) |
2867 | if (ofs == 0) |
2875 | { |
2868 | { |
2876 | free (new_selection_text); |
2869 | free (new_selection_text); |
… | |
… | |
2935 | rxvt_term::selection_start_colrow (int col, int row) |
2928 | rxvt_term::selection_start_colrow (int col, int row) |
2936 | { |
2929 | { |
2937 | want_refresh = 1; |
2930 | want_refresh = 1; |
2938 | selection.mark.col = col; |
2931 | selection.mark.col = col; |
2939 | selection.mark.row = row - TermWin.view_start; |
2932 | selection.mark.row = row - TermWin.view_start; |
|
|
2933 | |
2940 | MAX_IT (selection.mark.row, - (int32_t)TermWin.nscrolled); |
2934 | MAX_IT (selection.mark.row, - (int32_t)TermWin.nscrolled); |
2941 | MIN_IT (selection.mark.row, (int32_t)TermWin.nrow - 1); |
2935 | MIN_IT (selection.mark.row, (int32_t)TermWin.nrow - 1); |
2942 | MAX_IT (selection.mark.col, 0); |
2936 | MAX_IT (selection.mark.col, 0); |
2943 | MIN_IT (selection.mark.col, (int32_t)TermWin.ncol - 1); |
2937 | MIN_IT (selection.mark.col, (int32_t)TermWin.ncol - 1); |
2944 | |
2938 | |
|
|
2939 | while (selection.mark.col > 0 |
|
|
2940 | && screen.text[selection.mark.row + TermWin.saveLines][selection.mark.col] == NOCHAR) |
|
|
2941 | --selection.mark.col; |
|
|
2942 | |
2945 | if (selection.op) |
2943 | if (selection.op) |
2946 | { /* clear the old selection */ |
2944 | { /* clear the old selection */ |
2947 | selection.beg.row = selection.end.row = selection.mark.row; |
2945 | selection.beg.row = selection.end.row = selection.mark.row; |
2948 | selection.beg.col = selection.end.col = selection.mark.col; |
2946 | selection.beg.col = selection.end.col = selection.mark.col; |
2949 | } |
2947 | } |
|
|
2948 | |
2950 | selection.op = SELECTION_INIT; |
2949 | selection.op = SELECTION_INIT; |
2951 | selection.screen = current_screen; |
2950 | selection.screen = current_screen; |
2952 | } |
2951 | } |
2953 | |
2952 | |
2954 | /* ------------------------------------------------------------------------- */ |
2953 | /* ------------------------------------------------------------------------- */ |
… | |
… | |
2956 | * Word select: select text for 2 clicks |
2955 | * Word select: select text for 2 clicks |
2957 | * We now only find out the boundary in one direction |
2956 | * We now only find out the boundary in one direction |
2958 | */ |
2957 | */ |
2959 | |
2958 | |
2960 | /* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */ |
2959 | /* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */ |
2961 | #define DELIMIT_TEXT(x) \ |
2960 | #define DELIMIT_TEXT(x) \ |
2962 | (((x) == ' ' || (x) == '\t') ? 2 : (STRCHR (rs[Rs_cutchars], (x)) != NULL)) |
2961 | (unicode::is_space (x) ? 2 : (x) <= 0xff && !!STRCHR (rs[Rs_cutchars], (x))) |
2963 | #define DELIMIT_REND(x) 1 |
2962 | #define DELIMIT_REND(x) 1 |
2964 | |
2963 | |
2965 | void |
2964 | void |
2966 | rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) |
2965 | rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) |
2967 | { |
2966 | { |
2968 | int col, row, dirnadd, tcol, trow, w1, w2; |
2967 | int col, row, dirnadd, tcol, trow, w1, w2; |
2969 | row_col_t bound; |
2968 | row_col_t bound; |
2970 | text_t *stp; |
2969 | text_t *stp; |
2971 | rend_t *srp; |
2970 | rend_t *srp; |
2972 | |
2971 | |
2973 | if (dirn == UP) |
2972 | if (dirn == UP) |
2974 | { |
2973 | { |
2975 | bound.row = TermWin.saveLines - TermWin.nscrolled - 1; |
2974 | bound.row = TermWin.saveLines - TermWin.nscrolled - 1; |
2976 | bound.col = 0; |
2975 | bound.col = 0; |
… | |
… | |
2980 | { |
2979 | { |
2981 | bound.row = TermWin.saveLines + TermWin.nrow; |
2980 | bound.row = TermWin.saveLines + TermWin.nrow; |
2982 | bound.col = TermWin.ncol - 1; |
2981 | bound.col = TermWin.ncol - 1; |
2983 | dirnadd = 1; |
2982 | dirnadd = 1; |
2984 | } |
2983 | } |
|
|
2984 | |
2985 | row = mark->row + TermWin.saveLines; |
2985 | row = mark->row + TermWin.saveLines; |
2986 | col = mark->col; |
2986 | col = mark->col; |
2987 | MAX_IT (col, 0); |
2987 | MAX_IT (col, 0); |
2988 | /* find the edge of a word */ |
2988 | /* find the edge of a word */ |
2989 | stp = & (screen.text[row][col]); |
2989 | stp = & (screen.text[row][col]); |
2990 | w1 = DELIMIT_TEXT (*stp); |
2990 | w1 = DELIMIT_TEXT (*stp); |
2991 | |
2991 | |
2992 | if (selection_style != NEW_SELECT) |
|
|
2993 | { |
|
|
2994 | if (w1 == 1) |
|
|
2995 | { |
|
|
2996 | stp += dirnadd; |
|
|
2997 | if (DELIMIT_TEXT (*stp) == 1) |
|
|
2998 | goto Old_Word_Selection_You_Die; |
|
|
2999 | col += dirnadd; |
|
|
3000 | } |
|
|
3001 | w1 = 0; |
|
|
3002 | } |
|
|
3003 | srp = (&screen.rend[row][col]); |
2992 | srp = (&screen.rend[row][col]); |
3004 | w2 = DELIMIT_REND (*srp); |
2993 | w2 = DELIMIT_REND (*srp); |
3005 | |
2994 | |
3006 | for (;;) |
2995 | for (;;) |
3007 | { |
2996 | { |
3008 | for (; col != bound.col; col += dirnadd) |
2997 | for (; col != bound.col; col += dirnadd) |
3009 | { |
2998 | { |
3010 | stp += dirnadd; |
2999 | stp += dirnadd; |
|
|
3000 | srp += dirnadd; |
|
|
3001 | |
|
|
3002 | if (*stp == NOCHAR) |
|
|
3003 | continue; |
|
|
3004 | |
3011 | if (DELIMIT_TEXT (*stp) != w1) |
3005 | if (DELIMIT_TEXT (*stp) != w1) |
3012 | break; |
3006 | break; |
3013 | srp += dirnadd; |
|
|
3014 | if (DELIMIT_REND (*srp) != w2) |
3007 | if (DELIMIT_REND (*srp) != w2) |
3015 | break; |
3008 | break; |
3016 | } |
3009 | } |
|
|
3010 | |
3017 | if ((col == bound.col) && (row != bound.row)) |
3011 | if ((col == bound.col) && (row != bound.row)) |
3018 | { |
3012 | { |
3019 | if (screen.tlen[ (row - (dirn == UP ? 1 : 0))] == -1) |
3013 | if (screen.tlen[ (row - (dirn == UP ? 1 : 0))] == -1) |
3020 | { |
3014 | { |
3021 | trow = row + dirnadd; |
3015 | trow = row + dirnadd; |
3022 | tcol = dirn == UP ? TermWin.ncol - 1 : 0; |
3016 | tcol = dirn == UP ? TermWin.ncol - 1 : 0; |
|
|
3017 | |
3023 | if (screen.text[trow] == NULL) |
3018 | if (screen.text[trow] == NULL) |
3024 | break; |
3019 | break; |
|
|
3020 | |
3025 | stp = & (screen.text[trow][tcol]); |
3021 | stp = & (screen.text[trow][tcol]); |
3026 | srp = & (screen.rend[trow][tcol]); |
3022 | srp = & (screen.rend[trow][tcol]); |
|
|
3023 | |
3027 | if (DELIMIT_TEXT (*stp) != w1 || DELIMIT_REND (*srp) != w2) |
3024 | if (DELIMIT_TEXT (*stp) != w1 || DELIMIT_REND (*srp) != w2) |
3028 | break; |
3025 | break; |
|
|
3026 | |
3029 | row = trow; |
3027 | row = trow; |
3030 | col = tcol; |
3028 | col = tcol; |
3031 | continue; |
3029 | continue; |
3032 | } |
3030 | } |
3033 | } |
3031 | } |
3034 | break; |
3032 | break; |
3035 | } |
3033 | } |
|
|
3034 | |
3036 | Old_Word_Selection_You_Die: |
3035 | Old_Word_Selection_You_Die: |
3037 | D_SELECT ((stderr, "rxvt_selection_delimit_word (%s,...) @ (r:%3d, c:%3d) has boundary (r:%3d, c:%3d)", (dirn == UP ? "up " : "down"), mark->row, mark->col, row - TermWin.saveLines, col)); |
3036 | D_SELECT ((stderr, "rxvt_selection_delimit_word (%s,...) @ (r:%3d, c:%3d) has boundary (r:%3d, c:%3d)", (dirn == UP ? "up " : "down"), mark->row, mark->col, row - TermWin.saveLines, col)); |
3038 | |
3037 | |
3039 | if (dirn == DN) |
3038 | if (dirn == DN) |
3040 | col++; /* put us on one past the end */ |
3039 | col++; /* put us on one past the end */ |
… | |
… | |
3062 | MAX_IT (row, 0); |
3061 | MAX_IT (row, 0); |
3063 | MIN_IT (row, (int)TermWin.nrow - 1); |
3062 | MIN_IT (row, (int)TermWin.nrow - 1); |
3064 | MAX_IT (col, 0); |
3063 | MAX_IT (col, 0); |
3065 | MIN_IT (col, (int)TermWin.ncol); |
3064 | MIN_IT (col, (int)TermWin.ncol); |
3066 | |
3065 | |
3067 | #ifndef NO_NEW_SELECTION |
|
|
3068 | /* |
3066 | /* |
3069 | * If we're selecting characters (single click) then we must check first |
3067 | * If we're selecting characters (single click) then we must check first |
3070 | * if we are at the same place as the original mark. If we are then |
3068 | * if we are at the same place as the original mark. If we are then |
3071 | * select nothing. Otherwise, if we're to the right of the mark, you have to |
3069 | * select nothing. Otherwise, if we're to the right of the mark, you have to |
3072 | * be _past_ a character for it to be selected. |
3070 | * be _past_ a character for it to be selected. |
3073 | */ |
3071 | */ |
3074 | if (selection_style != OLD_SELECT) |
|
|
3075 | { |
|
|
3076 | if (((selection.clicks % 3) == 1) && !flag |
3072 | if (((selection.clicks % 3) == 1) && !flag |
3077 | && (col == selection.mark.col |
3073 | && (col == selection.mark.col |
3078 | && (row == selection.mark.row + TermWin.view_start))) |
3074 | && (row == selection.mark.row + TermWin.view_start))) |
3079 | { |
3075 | { |
3080 | /* select nothing */ |
3076 | /* select nothing */ |
3081 | selection.beg.row = selection.end.row = 0; |
3077 | selection.beg.row = selection.end.row = 0; |
3082 | selection.beg.col = selection.end.col = 0; |
3078 | selection.beg.col = selection.end.col = 0; |
3083 | selection.clicks = 4; |
3079 | selection.clicks = 4; |
3084 | want_refresh = 1; |
3080 | want_refresh = 1; |
3085 | D_SELECT ((stderr, "rxvt_selection_extend () selection.clicks = 4")); |
3081 | D_SELECT ((stderr, "rxvt_selection_extend () selection.clicks = 4")); |
3086 | return; |
3082 | return; |
3087 | } |
|
|
3088 | } |
3083 | } |
3089 | #endif |
3084 | |
3090 | if (selection.clicks == 4) |
3085 | if (selection.clicks == 4) |
3091 | selection.clicks = 1; |
3086 | selection.clicks = 1; |
3092 | |
3087 | |
3093 | selection_extend_colrow (col, row, !!flag, /* ? button 3 */ |
3088 | selection_extend_colrow (col, row, !!flag, /* ? button 3 */ |
3094 | flag == 1 ? 1 : 0, /* ? button press */ |
3089 | flag == 1 ? 1 : 0, /* ? button press */ |
… | |
… | |
3148 | pos.col = col; |
3143 | pos.col = col; |
3149 | pos.row = row; |
3144 | pos.row = row; |
3150 | |
3145 | |
3151 | pos.row -= TermWin.view_start; /* adjust for scroll */ |
3146 | pos.row -= TermWin.view_start; /* adjust for scroll */ |
3152 | |
3147 | |
3153 | #ifndef NO_OLD_SELECTION |
|
|
3154 | /* |
|
|
3155 | * This mimics some of the selection behaviour of version 2.20 and before. |
|
|
3156 | * There are no ``selection modes'', button3 is always character extension. |
|
|
3157 | * Note: button3 drag is always available, c.f. v2.20 |
|
|
3158 | * Selection always terminates (left or right as appropriate) at the mark. |
|
|
3159 | */ |
|
|
3160 | if (selection_style == OLD_SELECT) |
|
|
3161 | { |
|
|
3162 | if (selection.clicks == 1 || button3) |
|
|
3163 | { |
|
|
3164 | if (hate_those_clicks) |
|
|
3165 | { |
|
|
3166 | hate_those_clicks = 0; |
|
|
3167 | if (selection.clicks == 1) |
|
|
3168 | { |
|
|
3169 | selection.beg.row = selection.mark.row; |
|
|
3170 | selection.beg.col = selection.mark.col; |
|
|
3171 | } |
|
|
3172 | else |
|
|
3173 | { |
|
|
3174 | selection.mark.row = selection.beg.row; |
|
|
3175 | selection.mark.col = selection.beg.col; |
|
|
3176 | } |
|
|
3177 | } |
|
|
3178 | if (ROWCOL_IS_BEFORE (pos, selection.mark)) |
|
|
3179 | { |
|
|
3180 | selection.end.row = selection.mark.row; |
|
|
3181 | selection.end.col = selection.mark.col + 1; |
|
|
3182 | selection.beg.row = pos.row; |
|
|
3183 | selection.beg.col = pos.col; |
|
|
3184 | } |
|
|
3185 | else |
|
|
3186 | { |
|
|
3187 | selection.beg.row = selection.mark.row; |
|
|
3188 | selection.beg.col = selection.mark.col; |
|
|
3189 | selection.end.row = pos.row; |
|
|
3190 | selection.end.col = pos.col + 1; |
|
|
3191 | } |
|
|
3192 | } |
|
|
3193 | else if (selection.clicks == 2) |
|
|
3194 | { |
|
|
3195 | selection_delimit_word (UP, & (selection.mark), |
|
|
3196 | & (selection.beg)); |
|
|
3197 | selection_delimit_word (DN, & (selection.mark), |
|
|
3198 | & (selection.end)); |
|
|
3199 | hate_those_clicks = 1; |
|
|
3200 | } |
|
|
3201 | else if (selection.clicks == 3) |
|
|
3202 | { |
|
|
3203 | selection.beg.row = selection.end.row = selection.mark.row; |
|
|
3204 | selection.beg.col = 0; |
|
|
3205 | selection.end.col = ncol; |
|
|
3206 | hate_those_clicks = 1; |
|
|
3207 | } |
|
|
3208 | D_SELECT ((stderr, "rxvt_selection_extend_colrow () EXIT b: (r:%d,c:%d) m: (r:%d,c:%d), e: (r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); |
|
|
3209 | return; |
|
|
3210 | } |
|
|
3211 | #endif /* ! NO_OLD_SELECTION */ |
|
|
3212 | #ifndef NO_NEW_SELECTION |
|
|
3213 | /* selection_style must not be OLD_SELECT to get here */ |
|
|
3214 | /* |
3148 | /* |
3215 | * This is mainly xterm style selection with a couple of differences, mainly |
3149 | * This is mainly xterm style selection with a couple of differences, mainly |
3216 | * in the way button3 drag extension works. |
3150 | * in the way button3 drag extension works. |
3217 | * We're either doing: button1 drag; button3 press; or button3 drag |
3151 | * We're either doing: button1 drag; button3 press; or button3 drag |
3218 | * a) button1 drag : select around a midpoint/word/line - that point/word/line |
3152 | * a) button1 drag : select around a midpoint/word/line - that point/word/line |
… | |
… | |
3223 | * a point/word/line which is either the start or end of the selection |
3157 | * a point/word/line which is either the start or end of the selection |
3224 | * and it was decided by whichever point/word/line was `fixed' at the |
3158 | * and it was decided by whichever point/word/line was `fixed' at the |
3225 | * time of the most recent button3 press |
3159 | * time of the most recent button3 press |
3226 | */ |
3160 | */ |
3227 | if (button3 && buttonpress) |
3161 | if (button3 && buttonpress) |
3228 | { /* button3 press */ |
3162 | { /* button3 press */ |
3229 | /* |
3163 | /* |
3230 | * first determine which edge of the selection we are closest to |
3164 | * first determine which edge of the selection we are closest to |
3231 | */ |
3165 | */ |
3232 | if (ROWCOL_IS_BEFORE (pos, selection.beg) |
3166 | if (ROWCOL_IS_BEFORE (pos, selection.beg) |
3233 | || (!ROWCOL_IS_AFTER (pos, selection.end) |
3167 | || (!ROWCOL_IS_AFTER (pos, selection.end) |
3234 | && (((pos.col - selection.beg.col) |
3168 | && (((pos.col - selection.beg.col) |
3235 | + ((pos.row - selection.beg.row) * ncol)) |
3169 | + ((pos.row - selection.beg.row) * ncol)) |
3236 | < ((selection.end.col - pos.col) |
3170 | < ((selection.end.col - pos.col) |
3237 | + ((selection.end.row - pos.row) * ncol))))) |
3171 | + ((selection.end.row - pos.row) * ncol))))) |
3238 | closeto = LEFT; |
3172 | closeto = LEFT; |
|
|
3173 | |
3239 | if (closeto == LEFT) |
3174 | if (closeto == LEFT) |
3240 | { |
3175 | { |
3241 | selection.beg.row = pos.row; |
3176 | selection.beg.row = pos.row; |
3242 | selection.beg.col = pos.col; |
3177 | selection.beg.col = pos.col; |
3243 | selection.mark.row = selection.end.row; |
3178 | selection.mark.row = selection.end.row; |
3244 | selection.mark.col = selection.end.col |
3179 | selection.mark.col = selection.end.col - (selection.clicks == 2); |
3245 | - (selection.clicks == 2); |
|
|
3246 | } |
3180 | } |
3247 | else |
3181 | else |
3248 | { |
3182 | { |
3249 | selection.end.row = pos.row; |
3183 | selection.end.row = pos.row; |
3250 | selection.end.col = pos.col; |
3184 | selection.end.col = pos.col; |
3251 | selection.mark.row = selection.beg.row; |
3185 | selection.mark.row = selection.beg.row; |
3252 | selection.mark.col = selection.beg.col; |
3186 | selection.mark.col = selection.beg.col; |
3253 | } |
3187 | } |
3254 | } |
3188 | } |
3255 | else |
3189 | else |
3256 | { /* button1 drag or button3 drag */ |
3190 | { /* button1 drag or button3 drag */ |
3257 | if (ROWCOL_IS_AFTER (selection.mark, pos)) |
3191 | if (ROWCOL_IS_AFTER (selection.mark, pos)) |
3258 | { |
3192 | { |
3259 | if ((selection.mark.row == selection.end.row) |
3193 | if ((selection.mark.row == selection.end.row) |
3260 | && (selection.mark.col == selection.end.col) |
3194 | && (selection.mark.col == selection.end.col) |
3261 | && clickchange && selection.clicks == 2) |
3195 | && clickchange && selection.clicks == 2) |
3262 | selection.mark.col--; |
3196 | selection.mark.col--; |
|
|
3197 | |
3263 | selection.beg.row = pos.row; |
3198 | selection.beg.row = pos.row; |
3264 | selection.beg.col = pos.col; |
3199 | selection.beg.col = pos.col; |
3265 | selection.end.row = selection.mark.row; |
3200 | selection.end.row = selection.mark.row; |
3266 | selection.end.col = selection.mark.col |
3201 | selection.end.col = selection.mark.col + (selection.clicks == 2); |
3267 | + (selection.clicks == 2); |
|
|
3268 | } |
3202 | } |
3269 | else |
3203 | else |
3270 | { |
3204 | { |
3271 | selection.beg.row = selection.mark.row; |
3205 | selection.beg.row = selection.mark.row; |
3272 | selection.beg.col = selection.mark.col; |
3206 | selection.beg.col = selection.mark.col; |
… | |
… | |
3276 | } |
3210 | } |
3277 | |
3211 | |
3278 | if (selection.clicks == 1) |
3212 | if (selection.clicks == 1) |
3279 | { |
3213 | { |
3280 | end_col = screen.tlen[selection.beg.row + TermWin.saveLines]; |
3214 | end_col = screen.tlen[selection.beg.row + TermWin.saveLines]; |
|
|
3215 | |
3281 | if (end_col != -1 && selection.beg.col > end_col) |
3216 | if (end_col != -1 && selection.beg.col > end_col) |
3282 | { |
3217 | { |
3283 | #if 1 |
3218 | #if 1 |
3284 | selection.beg.col = ncol; |
3219 | selection.beg.col = ncol; |
3285 | #else |
3220 | #else |
3286 | if (selection.beg.row != selection.end.row) |
3221 | if (selection.beg.row != selection.end.row) |
3287 | selection.beg.col = ncol; |
3222 | selection.beg.col = ncol; |
3288 | else |
3223 | else |
3289 | selection.beg.col = selection.mark.col; |
3224 | selection.beg.col = selection.mark.col; |
3290 | #endif |
3225 | #endif |
3291 | |
|
|
3292 | } |
3226 | } |
|
|
3227 | |
3293 | end_col = screen.tlen[selection.end.row + TermWin.saveLines]; |
3228 | end_col = screen.tlen[selection.end.row + TermWin.saveLines]; |
|
|
3229 | |
3294 | if (end_col != -1 && selection.end.col > end_col) |
3230 | if (end_col != -1 && selection.end.col > end_col) |
3295 | selection.end.col = ncol; |
3231 | selection.end.col = ncol; |
3296 | |
|
|
3297 | } |
3232 | } |
3298 | else if (selection.clicks == 2) |
3233 | else if (selection.clicks == 2) |
3299 | { |
3234 | { |
3300 | if (ROWCOL_IS_AFTER (selection.end, selection.beg)) |
3235 | if (ROWCOL_IS_AFTER (selection.end, selection.beg)) |
3301 | selection.end.col--; |
3236 | selection.end.col--; |
|
|
3237 | |
3302 | selection_delimit_word (UP, & (selection.beg), |
3238 | selection_delimit_word (UP, & (selection.beg), & (selection.beg)); |
3303 | & (selection.beg)); |
|
|
3304 | selection_delimit_word (DN, & (selection.end), |
3239 | selection_delimit_word (DN, & (selection.end), & (selection.end)); |
3305 | & (selection.end)); |
|
|
3306 | } |
3240 | } |
3307 | else if (selection.clicks == 3) |
3241 | else if (selection.clicks == 3) |
3308 | { |
3242 | { |
3309 | #ifndef NO_FRILLS |
3243 | #ifndef NO_FRILLS |
3310 | if ((Options & Opt_tripleclickwords)) |
3244 | if ((Options & Opt_tripleclickwords)) |
3311 | { |
3245 | { |
3312 | int end_row; |
3246 | int end_row; |
3313 | |
3247 | |
3314 | selection_delimit_word (UP, & (selection.beg), |
3248 | selection_delimit_word (UP, & (selection.beg), & (selection.beg)); |
3315 | & (selection.beg)); |
|
|
3316 | end_row = screen.tlen[selection.mark.row |
3249 | end_row = screen.tlen[selection.mark.row + TermWin.saveLines]; |
3317 | + TermWin.saveLines]; |
3250 | |
3318 | for (end_row = selection.mark.row; end_row < TermWin.nrow; |
3251 | for (end_row = selection.mark.row; end_row < TermWin.nrow; end_row++) |
3319 | end_row++) |
|
|
3320 | { |
3252 | { |
3321 | end_col = screen.tlen[end_row + TermWin.saveLines]; |
3253 | end_col = screen.tlen[end_row + TermWin.saveLines]; |
|
|
3254 | |
3322 | if (end_col != -1) |
3255 | if (end_col != -1) |
3323 | { |
3256 | { |
3324 | selection.end.row = end_row; |
3257 | selection.end.row = end_row; |
3325 | selection.end.col = end_col; |
3258 | selection.end.col = end_col; |
3326 | selection_remove_trailing_spaces (); |
3259 | selection_remove_trailing_spaces (); |
… | |
… | |
3328 | } |
3261 | } |
3329 | } |
3262 | } |
3330 | } |
3263 | } |
3331 | else |
3264 | else |
3332 | #endif |
3265 | #endif |
3333 | |
|
|
3334 | { |
3266 | { |
3335 | if (ROWCOL_IS_AFTER (selection.mark, selection.beg)) |
3267 | if (ROWCOL_IS_AFTER (selection.mark, selection.beg)) |
3336 | selection.mark.col++; |
3268 | selection.mark.col++; |
3337 | selection.beg.col = 0; |
3269 | selection.beg.col = 0; |
3338 | selection.end.col = ncol; |
3270 | selection.end.col = ncol; |
3339 | } |
3271 | } |
3340 | } |
3272 | } |
|
|
3273 | |
3341 | if (button3 && buttonpress) |
3274 | if (button3 && buttonpress) |
3342 | { /* mark may need to be changed */ |
3275 | { /* mark may need to be changed */ |
3343 | if (closeto == LEFT) |
3276 | if (closeto == LEFT) |
3344 | { |
3277 | { |
3345 | selection.mark.row = selection.end.row; |
3278 | selection.mark.row = selection.end.row; |
3346 | selection.mark.col = selection.end.col |
3279 | selection.mark.col = selection.end.col |
3347 | - (selection.clicks == 2); |
3280 | - (selection.clicks == 2); |
… | |
… | |
3351 | selection.mark.row = selection.beg.row; |
3284 | selection.mark.row = selection.beg.row; |
3352 | selection.mark.col = selection.beg.col; |
3285 | selection.mark.col = selection.beg.col; |
3353 | } |
3286 | } |
3354 | } |
3287 | } |
3355 | D_SELECT ((stderr, "rxvt_selection_extend_colrow () EXIT b: (r:%d,c:%d) m: (r:%d,c:%d), e: (r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); |
3288 | D_SELECT ((stderr, "rxvt_selection_extend_colrow () EXIT b: (r:%d,c:%d) m: (r:%d,c:%d), e: (r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); |
3356 | #endif /* ! NO_NEW_SELECTION */ |
|
|
3357 | } |
3289 | } |
3358 | |
3290 | |
3359 | #ifndef NO_FRILLS |
3291 | #ifndef NO_FRILLS |
3360 | void |
3292 | void |
3361 | rxvt_term::selection_remove_trailing_spaces () |
3293 | rxvt_term::selection_remove_trailing_spaces () |