void TSC_source::cmd_tab(bool invert, bool backup) { QString str; int selline1,selcol1,selline2,selcol2; if (!G_sel(selline1,selcol1,selline2,selcol2)) { //try to indent int linenr=G_cursor_linenr(); if ((linenr<0)||(linenr>=G_linecount())) return; int colnr=G_cursor_colnr(); if ((colnr<G_line(linenr)->G_length())) return; if (backup) undo_begin(); (*lines[linenr])+=_qstr(" "); if (backup) addundo(new TSC_source_undoaction_insertstring(this,_qstr(" "))); cursor_colnr+=3; if (backup) undo_end(); modified=true; return; } //shift group block if (backup) undo_begin(); int ct1=selline1; int ct2=selline2; if (selcol2<0) ct2=selline2-1; for (int i=ct1; i<=ct2; i++) { if (!invert) { cursor_linenr=i;cursor_colnr=0; str=_qstr(" "); str+=*lines[cursor_linenr]; if (backup) addundo(new TSC_source_undoaction_insertstring(this,_qstr(" "))); *lines[cursor_linenr]=str; } else { cursor_linenr=i;cursor_colnr=0; str=*lines[cursor_linenr]; if (str.G_char(0)==' ') { str.substring(1,str.G_length()-1); if (backup) addundo(new TSC_source_undoaction_del(this,1)); *lines[cursor_linenr]=str; } } } if (backup) undo_end(); modified=true; }