Commits

Herbert Breunung committed a3b1447

when dedent lines and caret is before text, it doesnt jumps now in the line before

Comments (0)

Files changed (1)

lib/Kephra/Edit.pm

 	my ($start, $end) = $self->GetSelection;
 	my $line_sel = [ $self->LineFromPosition($start), $self->LineFromPosition($end) ];
 	my $last_line = $self->LineFromPosition( $self->GetLength );
-#print @$line_sel,"--\n";
-	#$last_line-- if $self->PositionFromLine($last_line) == $self->GetLineEndPosition($last_line);
+	$last_line-- if $self->PositionFromLine($last_line) == $self->GetLineEndPosition($last_line);
 	$movement = $line_sel->[0]              
 		if $movement < 0 and $line_sel->[0]+$movement < 0;
 	$movement = $last_line - $line_sel->[1]
 		$self->BeginUndoAction;
 		$self->_change_indentionlevel_level($change, $line);
 		$pos += $self->GetLineIndentPosition($line) - $old_indention;
+		$pos = $self->PositionFromLine($line) if $line > $self->LineFromPosition($pos)
+		                                      or $pos == -1;
 		$self->SetSelection( $pos, $pos );
 		$self->EndUndoAction;
 	}