Draw cursor at the leading edge of selection (as in other apps.) and hide cursor swapping from the user.
This commit is contained in:
@@ -1712,7 +1712,6 @@ void txt_do_undo(Text *text)
|
||||
|
||||
case UNDO_SWAP:
|
||||
txt_curs_swap(text);
|
||||
txt_do_undo(text); /* swaps should appear transparent */
|
||||
break;
|
||||
|
||||
case UNDO_DBLOCK:
|
||||
@@ -1829,9 +1828,16 @@ void txt_do_undo(Text *text)
|
||||
}
|
||||
|
||||
/* next undo step may need evaluating */
|
||||
if (text->undo_pos>=0 && text->undo_buf[text->undo_pos] == UNDO_STO) {
|
||||
txt_do_undo(text);
|
||||
txt_do_redo(text); /* selections need restoring */
|
||||
if (text->undo_pos>=0) {
|
||||
switch (text->undo_buf[text->undo_pos]) {
|
||||
case UNDO_STO:
|
||||
txt_do_undo(text);
|
||||
txt_do_redo(text); /* selections need restoring */
|
||||
break;
|
||||
case UNDO_SWAP:
|
||||
txt_do_undo(text); /* swaps should appear transparent */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
undoing= 0;
|
||||
|
||||
@@ -695,17 +695,17 @@ static void draw_cursor(SpaceText *st) {
|
||||
|
||||
}
|
||||
|
||||
/* Draw the cursor itself */
|
||||
x= text_draw(st, text->curl->line, st->left, text->curc, 0, 0, 0, NULL);
|
||||
/* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */
|
||||
x= text_draw(st, text->sell->line, st->left, text->selc, 0, 0, 0, NULL);
|
||||
|
||||
if (x) {
|
||||
offl= offc= 0;
|
||||
if (st->wordwrap) wrap_offset(st, text->curl, text->curc, &offl, &offc);
|
||||
if (st->wordwrap) wrap_offset(st, text->sell, text->selc, &offl, &offc);
|
||||
x += offc*spacetext_get_fontwidth(st);
|
||||
h= txt_get_span(text->lines.first, text->curl) - st->top + offl;
|
||||
h= txt_get_span(text->lines.first, text->sell) - st->top + offl;
|
||||
|
||||
if (st->overwrite) {
|
||||
ch[0]= (unsigned char) text->curl->line[text->curc];
|
||||
ch[0]= (unsigned char) text->sell->line[text->selc];
|
||||
if (ch[0]=='\0') ch[0]=' ';
|
||||
ch[1]= '\0';
|
||||
w= BMF_GetStringWidth(spacetext_get_font(st), ch);
|
||||
|
||||
Reference in New Issue
Block a user