// If no selection, then select all. // Otherwise, select the whole lines for all selected lines. // Suggested shortcut: C+a // Author: AhLeung Cheng https://plus.google.com/+AhLeungCheng // GNU General Public License if (textArea.getSelectionCount() == 0) { textArea.selectAll(); return; } int[] lines = textArea.getSelectedLines(); end = lines[lines.length-1]; endOffset = buffer.getLineEndOffset(end); textArea.setSelection(new Selection.Range(buffer.getLineStartOffset(lines[0]), end==buffer.getLineCount()-1? endOffset-1:endOffset));