Commits

Herbert Breunung committed 4112270

switch to toggle comment

Comments (0)

Files changed (2)

lib/Kephra/App/Editor.pm

 		elsif ($key ==  &Wx::WXK_TAB    + 2000){ } # rotate focus
 		elsif ($key ==      ord('#')    + 2000){$self->next_comment() }
 		elsif ($key ==      ord('#')    + 3000){$self->prev_comment() }
-		elsif ($key ==      ord('#')    + 4000){$self->comment() }
-		elsif ($key ==      ord('#')    + 5000){$self->decomment() }
+		elsif ($key ==      ord('#')    + 4000){$self->toggle_comment() }
+		#elsif ($key ==      ord('#')    + 5000){$self->decomment() }
 		elsif ($key ==      ord('G')    + 3000){$self->goto_last_edit() } # last selection?
 		elsif ($key ==      ord('G')    + 5000){$self->goto_last_edit() }
 		elsif ($key ==      ord('Q')    + 2000){Kephra::File::close_active() }

lib/Kephra/Edit.pm

 	);
 	$self->EndUndoAction;
 }
-sub toggle_comment {}
+sub toggle_comment {
+	my ($self) = @_;
+	$self->GetCharAt( $self->GetLineIndentPosition( 
+		$self->LineFromPosition ($self->GetSelectionStart)) ) eq ord '#'
+			? decomment(@_)
+			:   comment(@_);
+}
 sub prev_comment{
 	my ($self) = @_;
 	my ($start, $end) = $self->GetSelection;