|
|
|
@ -202,8 +202,23 @@ void Source::CommonView::cut() { |
|
|
|
Gtk::Clipboard::get()->set_text(selection); |
|
|
|
Gtk::Clipboard::get()->set_text(selection); |
|
|
|
get_buffer()->erase(start, end); |
|
|
|
get_buffer()->erase(start, end); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
Gtk::TextIter start, end; |
|
|
|
|
|
|
|
get_buffer()->get_selection_bounds(start, end); |
|
|
|
|
|
|
|
if(start.get_line() == end.get_line() || start.starts_line()) |
|
|
|
|
|
|
|
get_buffer()->cut_clipboard(Gtk::Clipboard::get()); |
|
|
|
|
|
|
|
else { // In order to improve paste indentation: copy entire starting line if only whitespaces before start iter
|
|
|
|
|
|
|
|
auto iter = start; |
|
|
|
|
|
|
|
while(!iter.starts_line() && iter.backward_char() && (*iter == ' ' || *iter == '\t')) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(iter.starts_line()) { |
|
|
|
|
|
|
|
Gtk::Clipboard::get()->set_text(get_buffer()->get_text(iter, end)); |
|
|
|
|
|
|
|
get_buffer()->erase(start, end); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
get_buffer()->cut_clipboard(Gtk::Clipboard::get()); |
|
|
|
get_buffer()->cut_clipboard(Gtk::Clipboard::get()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
keep_clipboard = true; |
|
|
|
keep_clipboard = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -268,8 +283,21 @@ void Source::CommonView::copy() { |
|
|
|
} |
|
|
|
} |
|
|
|
Gtk::Clipboard::get()->set_text(selection); |
|
|
|
Gtk::Clipboard::get()->set_text(selection); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
Gtk::TextIter start, end; |
|
|
|
|
|
|
|
get_buffer()->get_selection_bounds(start, end); |
|
|
|
|
|
|
|
if(start.get_line() == end.get_line() || start.starts_line()) |
|
|
|
|
|
|
|
get_buffer()->copy_clipboard(Gtk::Clipboard::get()); |
|
|
|
|
|
|
|
else { // In order to improve paste indentation: copy entire starting line if only whitespaces before start iter
|
|
|
|
|
|
|
|
auto iter = start; |
|
|
|
|
|
|
|
while(!iter.starts_line() && iter.backward_char() && (*iter == ' ' || *iter == '\t')) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(iter.starts_line()) |
|
|
|
|
|
|
|
Gtk::Clipboard::get()->set_text(get_buffer()->get_text(iter, end)); |
|
|
|
else |
|
|
|
else |
|
|
|
get_buffer()->copy_clipboard(Gtk::Clipboard::get()); |
|
|
|
get_buffer()->copy_clipboard(Gtk::Clipboard::get()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Source::CommonView::copy_lines() { |
|
|
|
void Source::CommonView::copy_lines() { |
|
|
|
|