diff options
| author | Christoph Lohmann <20h@r-36.net> | 2013-05-04 08:05:11 +0200 |
|---|---|---|
| committer | Christoph Lohmann <20h@r-36.net> | 2013-05-04 08:05:11 +0200 |
| commit | 634c247fa76a5f649cdcc51109970e46ddaf5c32 (patch) | |
| tree | 8f42272af65dd8c93633480b7b37bcf3f7d02c7a | |
| parent | Better comments for the snapping code. (diff) | |
| download | st-634c247fa76a5f649cdcc51109970e46ddaf5c32.tar.gz st-634c247fa76a5f649cdcc51109970e46ddaf5c32.zip | |
Select to the end of row if end of line is reached.
Thanks Alexander Rezinsky <alexrez@gmail.com>!
Diffstat (limited to '')
| -rw-r--r-- | st.c | 12 |
1 files changed, 12 insertions, 0 deletions
| @@ -679,6 +679,8 @@ selected(int x, int y) { | |||
| 679 | 679 | ||
| 680 | void | 680 | void |
| 681 | selsnap(int mode, int *x, int *y, int direction) { | 681 | selsnap(int mode, int *x, int *y, int direction) { |
| 682 | int i; | ||
| 683 | |||
| 682 | switch(mode) { | 684 | switch(mode) { |
| 683 | case SNAP_WORD: | 685 | case SNAP_WORD: |
| 684 | /* | 686 | /* |
| @@ -735,6 +737,16 @@ selsnap(int mode, int *x, int *y, int direction) { | |||
| 735 | } | 737 | } |
| 736 | break; | 738 | break; |
| 737 | default: | 739 | default: |
| 740 | /* | ||
| 741 | * Select the whole line when the end of line is reached. | ||
| 742 | */ | ||
| 743 | if(direction > 0) { | ||
| 744 | i = term.col; | ||
| 745 | while(--i > 0 && term.line[*y][i].c[0] == ' ') | ||
| 746 | /* nothing */; | ||
| 747 | if(i > 0 && i < *x) | ||
| 748 | *x = term.col - 1; | ||
| 749 | } | ||
| 738 | break; | 750 | break; |
| 739 | } | 751 | } |
| 740 | } | 752 | } |
