forked from bartvdbraak/blender
fix for own mistake for ctrl+left/right movement and code cleanup for txt_jump_left/right
This commit is contained in:
parent
7a4ad3aaae
commit
ba7d24559d
@ -956,60 +956,46 @@ void txt_move_right(Text *text, short sel)
|
||||
|
||||
void txt_jump_left(Text *text, short sel)
|
||||
{
|
||||
TextLine **linep, *oldl;
|
||||
int *charp, oldc, oldflags;
|
||||
unsigned char oldu;
|
||||
TextLine **linep;
|
||||
int *charp, oldc;
|
||||
|
||||
if (!text) return;
|
||||
if (sel) txt_curs_sel(text, &linep, &charp);
|
||||
else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
|
||||
if (!*linep) return;
|
||||
|
||||
oldflags = text->flags;
|
||||
text->flags &= ~TXT_TABSTOSPACES;
|
||||
|
||||
oldl = *linep;
|
||||
oldc = *charp;
|
||||
oldu = undoing;
|
||||
undoing = 1; /* Don't push individual moves to undo stack */
|
||||
|
||||
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
|
||||
charp, STRCUR_DIR_PREV,
|
||||
STRCUR_JUMP_DELIM);
|
||||
|
||||
text->flags = oldflags;
|
||||
|
||||
undoing = oldu;
|
||||
if (!undoing) txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, txt_get_span(text->lines.first, oldl), oldc, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
|
||||
if (!sel) txt_pop_sel(text);
|
||||
if (!undoing) {
|
||||
int span = txt_get_span(text->lines.first, *linep);
|
||||
txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, span, oldc, span, (unsigned short)*charp);
|
||||
}
|
||||
}
|
||||
|
||||
void txt_jump_right(Text *text, short sel)
|
||||
{
|
||||
TextLine **linep, *oldl;
|
||||
int *charp, oldc, oldflags;
|
||||
unsigned char oldu;
|
||||
TextLine **linep;
|
||||
int *charp, oldc;
|
||||
|
||||
if (!text) return;
|
||||
if (sel) txt_curs_sel(text, &linep, &charp);
|
||||
else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
|
||||
if (!*linep) return;
|
||||
|
||||
oldflags = text->flags;
|
||||
text->flags &= ~TXT_TABSTOSPACES;
|
||||
|
||||
oldl = *linep;
|
||||
oldc = *charp;
|
||||
oldu = undoing;
|
||||
undoing = 1; /* Don't push individual moves to undo stack */
|
||||
|
||||
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
|
||||
charp, STRCUR_DIR_NEXT,
|
||||
STRCUR_JUMP_DELIM);
|
||||
|
||||
text->flags = oldflags;
|
||||
|
||||
undoing = oldu;
|
||||
if (!undoing) txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, txt_get_span(text->lines.first, oldl), oldc, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
|
||||
if (!sel) txt_pop_sel(text);
|
||||
if (!undoing) {
|
||||
int span = txt_get_span(text->lines.first, *linep);
|
||||
txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, span, oldc, span, (unsigned short)*charp);
|
||||
}
|
||||
}
|
||||
|
||||
void txt_move_bol(Text *text, short sel)
|
||||
|
Loading…
Reference in New Issue
Block a user